From f622331fe8f131064a91fb9c8bcf221cbdb07f82 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Wed, 2 Jul 2025 10:55:18 +0200 Subject: [PATCH] python3Packages.langchain-experimental: Init at 0.3.4 --- .../001-avoid-check-fullpath.patch | 13 ++++ .../langchain-experimental/default.nix | 76 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 91 insertions(+) create mode 100644 pkgs/development/python-modules/langchain-experimental/001-avoid-check-fullpath.patch create mode 100644 pkgs/development/python-modules/langchain-experimental/default.nix diff --git a/pkgs/development/python-modules/langchain-experimental/001-avoid-check-fullpath.patch b/pkgs/development/python-modules/langchain-experimental/001-avoid-check-fullpath.patch new file mode 100644 index 000000000000..9dd3284bd7c9 --- /dev/null +++ b/pkgs/development/python-modules/langchain-experimental/001-avoid-check-fullpath.patch @@ -0,0 +1,13 @@ +diff --git a/tests/unit_tests/test_bash.py b/tests/unit_tests/test_bash.py +index ba7b0d0..cade19e 100644 +--- a/tests/unit_tests/test_bash.py ++++ b/tests/unit_tests/test_bash.py +@@ -58,7 +58,7 @@ def test_incorrect_command_return_err_output() -> None: + session = BashProcess(return_err_output=True) + output = session.run(["invalid_command"]) + assert re.match( +- r"^/bin/sh:.*invalid_command.*(?:not found|Permission denied).*$", output ++ r".*/bin/sh:.*invalid_command.*(?:not found|Permission denied).*$", output + ) + + diff --git a/pkgs/development/python-modules/langchain-experimental/default.nix b/pkgs/development/python-modules/langchain-experimental/default.nix new file mode 100644 index 000000000000..c7e2748b02f3 --- /dev/null +++ b/pkgs/development/python-modules/langchain-experimental/default.nix @@ -0,0 +1,76 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + poetry-core, + + # dependencies + langchain-core, + langchain-community, + + # testing + langchain-tests, + pytestCheckHook, + + # passthru + gitUpdater, +}: + +buildPythonPackage rec { + pname = "langchain-experimental"; + version = "0.3.4"; + pyproject = true; + + src = fetchFromGitHub { + owner = "langchain-ai"; + repo = "langchain-experimental"; + tag = "libs/experimental/v${version}"; + hash = "sha256-KgGfJfxHOfpwVVo/OcbOjiO5pbxoDE1MiyKqUwsqfIg="; + }; + + sourceRoot = "${src.name}/libs/experimental"; + + patches = [ + # Remove it when https://github.com/langchain-ai/langchain-experimental/pull/58 is merged and released + ./001-avoid-check-fullpath.patch + ]; + + build-system = [ + poetry-core + ]; + + pythonRelaxDeps = [ + # Each component release requests the exact latest core. + # That prevents us from updating individual components. + "langchain-core" + "langchain-community" + ]; + + dependencies = [ + langchain-core + langchain-community + ]; + + nativeCheckInputs = [ + langchain-tests + pytestCheckHook + ]; + + pytestFlagsArray = [ "tests/unit_tests" ]; + + pythonImportsCheck = [ "langchain_experimental" ]; + + passthru.updateScript = gitUpdater { + rev-prefix = "libs/experimental/v"; + }; + + meta = { + changelog = "https://github.com/langchain-ai/langchain-experimental/releases/tag/${src.tag}"; + description = "Package add experimental features on LangChain"; + homepage = "https://github.com/langchain-ai/langchain-experimental/tree/main/libs/experimental"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ mrdev023 ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index c5a2e934e94b..ae375e34fcad 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7717,6 +7717,8 @@ self: super: with self; { langchain-deepseek = callPackage ../development/python-modules/langchain-deepseek { }; + langchain-experimental = callPackage ../development/python-modules/langchain-experimental { }; + langchain-fireworks = callPackage ../development/python-modules/langchain-fireworks { }; langchain-groq = callPackage ../development/python-modules/langchain-groq { };