Something went wrong. Try again.
lol
Something went wrong. Try again.
3.7 kB · 158 lines
Nix
at master
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159{ lib, buildPythonPackage, fetchFromGitHub,
# build-system hatchling,
# dependencies langchain-core, langgraph, pydantic,
# Optional dependencies langchain-anthropic, langchain-aws, langchain-community, langchain-deepseek, langchain-fireworks, langchain-google-genai, langchain-groq, langchain-huggingface, langchain-mistralai, langchain-ollama, langchain-openai, langchain-perplexity, langchain-xai,
# runtime runtimeShell,
# tests blockbuster, langchain-tests, pytest-asyncio, pytest-mock, pytest-socket, pytest-xdist, pytestCheckHook, syrupy, toml,
# passthru gitUpdater,}:
buildPythonPackage (finalAttrs: { pname = "langchain"; version = "1.2.15"; pyproject = true;
src = fetchFromGitHub { owner = "langchain-ai"; repo = "langchain"; tag = "langchain==${finalAttrs.version}"; hash = "sha256-aRiU8UwzotSybfgjexV9hYXsm5Ub3PFTz0k0hz1p2lk="; };
sourceRoot = "${finalAttrs.src.name}/libs/langchain_v1";
postPatch = '' substituteInPlace langchain/agents/middleware/shell_tool.py \ --replace-fail '"/bin/bash"' '"${runtimeShell}"' '';
build-system = [ hatchling ];
dependencies = [ langchain-core langgraph pydantic ];
optional-dependencies = { anthropic = [ langchain-anthropic ]; aws = [ langchain-aws ]; # azure-ai = [langchain-azure-ai]; community = [ langchain-community ]; deepseek = [ langchain-deepseek ]; fireworks = [ langchain-fireworks ]; google-genai = [ langchain-google-genai ]; # google-vertexai = [langchain-google-vertexai]; groq = [ langchain-groq ]; huggingface = [ langchain-huggingface ]; mistralai = [ langchain-mistralai ]; ollama = [ langchain-ollama ]; openai = [ langchain-openai ]; perplexity = [ langchain-perplexity ]; # together = [langchain-together]; xai = [ langchain-xai ]; };
nativeCheckInputs = [ blockbuster langchain-tests # langchain-openai -- causes recursion error pytest-asyncio pytest-mock pytest-socket pytest-xdist pytestCheckHook syrupy toml ];
pytestFlags = [ "--only-core" ];
# Note: Not testing with optional dependencies due to mutual recursion enabledTestPaths = [ # integration_tests require network access, database access and require `OPENAI_API_KEY`, etc. "tests/unit_tests" ];
# All pass with sandbox=false disabledTests = [ # Depends on shell's truncation style "test_truncation_indicator_present" "test_truncation_by_bytes" # Depends on the sleep shell command "test_timeout_returns_error" # Can't see the shell session results when sandboxed "test_startup_and_shutdown_commands" # Timing sensitive tests "test_tool_retry_constant_backoff" # AttributeError: 'ImportErrorProfileModel' object has no attribute 'profile' # https://github.com/langchain-ai/langchain/issues/36312 "test_summarization_middleware_missing_profile" ];
disabledTestPaths = [ # Their configuration tests don't place nicely with nixpkgs "tests/unit_tests/test_pytest_config.py" ];
pythonImportsCheck = [ "langchain" ];
passthru = { skipBulkUpdate = true; updateScript = gitUpdater { rev-prefix = "langchain=="; }; };
__darwinAllowLocalNetworking = true;
meta = { description = "Building applications with LLMs through composability"; homepage = "https://github.com/langchain-ai/langchain"; changelog = "https://github.com/langchain-ai/langchain/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ natsukium sarahec ]; };})