Merge: matrix-synapse: 1.122.0 -> 1.123.0 (#378018)
[NixPkgs.git] / pkgs / development / python-modules / langchain / default.nix
blob6723d53d9f10217977e450f8dcf17711f8f4cb69
2   lib,
3   buildPythonPackage,
4   fetchFromGitHub,
6   # build-system
7   poetry-core,
9   # buildInputs
10   bash,
12   # dependencies
13   aiohttp,
14   langchain-core,
15   langchain-text-splitters,
16   langsmith,
17   pydantic,
18   pyyaml,
19   requests,
20   sqlalchemy,
21   tenacity,
23   # optional-dependencies
24   numpy,
26   # tests
27   freezegun,
28   httpx,
29   lark,
30   pandas,
31   pytest-asyncio,
32   pytest-mock,
33   pytest-socket,
34   pytestCheckHook,
35   requests-mock,
36   responses,
37   syrupy,
38   toml,
41 buildPythonPackage rec {
42   pname = "langchain";
43   version = "0.3.15";
44   pyproject = true;
46   src = fetchFromGitHub {
47     owner = "langchain-ai";
48     repo = "langchain";
49     tag = "langchain==${version}";
50     hash = "sha256-lANGoMABH1f9Tl/GgMMr7eTCji9q3uqD+Mwjr4nd2Dg=";
51   };
53   sourceRoot = "${src.name}/libs/langchain";
55   build-system = [ poetry-core ];
57   buildInputs = [ bash ];
59   pythonRelaxDeps = [
60     "numpy"
61     "tenacity"
62   ];
64   dependencies = [
65     aiohttp
66     langchain-core
67     langchain-text-splitters
68     langsmith
69     pydantic
70     pyyaml
71     requests
72     sqlalchemy
73     tenacity
74   ];
76   optional-dependencies = {
77     numpy = [ numpy ];
78   };
80   nativeCheckInputs = [
81     freezegun
82     httpx
83     lark
84     pandas
85     pytest-asyncio
86     pytest-mock
87     pytest-socket
88     pytestCheckHook
89     requests-mock
90     responses
91     syrupy
92     toml
93   ];
95   pytestFlagsArray = [
96     # integration_tests require network access, database access and require `OPENAI_API_KEY`, etc.
97     "tests/unit_tests"
98     "--only-core"
99   ];
101   disabledTests = [
102     # These tests have database access
103     "test_table_info"
104     "test_sql_database_run"
105     # These tests have network access
106     "test_socket_disabled"
107     "test_openai_agent_with_streaming"
108     "test_openai_agent_tools_agent"
109     # This test may require a specific version of langchain-community
110     "test_compatible_vectorstore_documentation"
111     # AssertionErrors
112     "test_callback_handlers"
113     "test_generic_fake_chat_model"
114     # Test is outdated
115     "test_serializable_mapping"
116     "test_person"
117     "test_aliases_hidden"
118   ];
120   disabledTestPaths = [
121     # pydantic.errors.PydanticUserError: `ConversationSummaryMemory` is not fully defined; you should define `BaseCache`, then call `ConversationSummaryMemory.model_rebuild()`.
122     "tests/unit_tests/chains/test_conversation.py"
123     # pydantic.errors.PydanticUserError: `ConversationSummaryMemory` is not fully defined; you should define `BaseCache`, then call `ConversationSummaryMemory.model_rebuild()`.
124     "tests/unit_tests/chains/test_memory.py"
125     # pydantic.errors.PydanticUserError: `ConversationSummaryBufferMemory` is not fully defined; you should define `BaseCache`, then call `ConversationSummaryBufferMemory.model_rebuild()`.
126     "tests/unit_tests/chains/test_summary_buffer_memory.py"
127     "tests/unit_tests/output_parsers/test_fix.py"
128     "tests/unit_tests/chains/test_llm_checker.py"
129     # TypeError: Can't instantiate abstract class RunnableSerializable[RetryOutputParserRetryChainInput, str] without an implementation for abstract method 'invoke'
130     "tests/unit_tests/output_parsers/test_retry.py"
131     # pydantic.errors.PydanticUserError: `LLMSummarizationCheckerChain` is not fully defined; you should define `BaseCache`, then call `LLMSummarizationCheckerChain.model_rebuild()`.
132     "tests/unit_tests/chains/test_llm_summarization_checker.py"
133   ];
135   pythonImportsCheck = [ "langchain" ];
137   passthru = {
138     updateScript = langchain-core.updateScript;
139   };
141   meta = {
142     description = "Building applications with LLMs through composability";
143     homepage = "https://github.com/langchain-ai/langchain";
144     changelog = "https://github.com/langchain-ai/langchain/releases/tag/v${version}";
145     license = lib.licenses.mit;
146     maintainers = with lib.maintainers; [ natsukium ];
147     mainProgram = "langchain-server";
148   };