diff --git a/pkgs/development/python-modules/langchain-ollama/default.nix b/pkgs/development/python-modules/langchain-ollama/default.nix new file mode 100644 index 000000000000..72bcf180d414 --- /dev/null +++ b/pkgs/development/python-modules/langchain-ollama/default.nix @@ -0,0 +1,68 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + poetry-core, + + # dependencies + langchain-core, + ollama, + + # testing + langchain-standard-tests, + pytestCheckHook, + pytest-asyncio, + syrupy, + + nix-update-script, +}: + +buildPythonPackage rec { + pname = "langchain-ollama"; + version = "0.2.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "langchain-ai"; + repo = "langchain"; + rev = "refs/tags/langchain-ollama==${version}"; + hash = "sha256-NtlJqIevdaoOO4oDqKsL4OFbw8tHb3FjV9LrTytOGKE="; + }; + + sourceRoot = "${src.name}/libs/partners/ollama"; + + build-system = [ poetry-core ]; + + dependencies = [ + langchain-core + ollama + ]; + + nativeCheckInputs = [ + langchain-standard-tests + pytestCheckHook + pytest-asyncio + syrupy + ]; + + pytestFlagsArray = [ "tests/unit_tests" ]; + + pythonImportsCheck = [ "langchain_ollama" ]; + + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "langchain-ollama==(.*)" + ]; + }; + + meta = { + changelog = "https://github.com/langchain-ai/langchain/releases/tag/langchain-ollama==${version}"; + description = "Integration package connecting Ollama and LangChain"; + homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/ollama"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ sarahec ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 74cb990650ae..d2444a80a387 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -6825,6 +6825,8 @@ self: super: with self; { langchain-mongodb = callPackage ../development/python-modules/langchain-mongodb { }; + langchain-ollama = callPackage ../development/python-modules/langchain-ollama { }; + langchain-openai = callPackage ../development/python-modules/langchain-openai { }; langchain-standard-tests = callPackage ../development/python-modules/langchain-standard-tests { };