1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 nix-update-script, 6 7 # build-system 8 pdm-backend, 9 10 # dependencies 11 aiohttp, 12 dataclasses-json, 13 httpx-sse, 14 langchain, 15 langchain-core, 16 langsmith, 17 numpy, 18 pydantic-settings, 19 pyyaml, 20 requests, 21 sqlalchemy, 22 tenacity, 23 24 # tests 25 blockbuster, 26 httpx, 27 langchain-tests, 28 lark, 29 pandas, 30 pytest-asyncio, 31 pytest-mock, 32 pytestCheckHook, 33 requests-mock, 34 responses, 35 syrupy, 36 toml, 37}: 38 39buildPythonPackage rec { 40 pname = "langchain-community"; 41 version = "0.3.22"; 42 pyproject = true; 43 44 src = fetchFromGitHub { 45 owner = "langchain-ai"; 46 repo = "langchain"; 47 tag = "langchain-community==${version}"; 48 hash = "sha256-fotu3vUCWnAVyjFjsIUjk1If81yQ3/YLj26PksmnvGE="; 49 }; 50 51 sourceRoot = "${src.name}/libs/community"; 52 53 build-system = [ pdm-backend ]; 54 55 pythonRelaxDeps = [ 56 # Each component release requests the exact latest langchain and -core. 57 # That prevents us from updating individul components. 58 "langchain" 59 "langchain-core" 60 "numpy" 61 "pydantic-settings" 62 "tenacity" 63 ]; 64 65 dependencies = [ 66 aiohttp 67 dataclasses-json 68 httpx-sse 69 langchain 70 langchain-core 71 langsmith 72 numpy 73 pydantic-settings 74 pyyaml 75 requests 76 sqlalchemy 77 tenacity 78 ]; 79 pythonImportsCheck = [ "langchain_community" ]; 80 81 nativeCheckInputs = [ 82 blockbuster 83 httpx 84 langchain-tests 85 lark 86 pandas 87 pytest-asyncio 88 pytest-mock 89 pytestCheckHook 90 requests-mock 91 responses 92 syrupy 93 toml 94 ]; 95 96 pytestFlagsArray = [ "tests/unit_tests" ]; 97 98 __darwinAllowLocalNetworking = true; 99 100 disabledTests = [ 101 # Test require network access 102 "test_ovhcloud_embed_documents" 103 "test_yandex" 104 "test_table_info" 105 "test_sql_database_run" 106 # pydantic.errors.PydanticUserError: `SQLDatabaseToolkit` is not fully defined; you should define `BaseCache`, then call `SQLDatabaseToolkit.model_rebuild()`. 107 "test_create_sql_agent" 108 # pydantic.errors.PydanticUserError: `NatBotChain` is not fully defined; you should define `BaseCache`, then call `NatBotChain.model_rebuild()`. 109 "test_proper_inputs" 110 # pydantic.errors.PydanticUserError: `NatBotChain` is not fully defined; you should define `BaseCache`, then call `NatBotChain.model_rebuild()`. 111 "test_variable_key_naming" 112 # Tests against magic values in dict 113 "test_serializable_mapping" 114 ]; 115 116 disabledTestPaths = [ 117 # ValueError: Received unsupported arguments {'strict': None} 118 "tests/unit_tests/chat_models/test_cloudflare_workersai.py" 119 # depends on Pydantic v1 notations, will not load 120 "tests/unit_tests/document_loaders/test_gitbook.py" 121 ]; 122 123 passthru.updateScript = nix-update-script { 124 extraArgs = [ 125 "--version-regex" 126 "langchain-community==([0-9.]+)" 127 ]; 128 }; 129 130 meta = { 131 changelog = "https://github.com/langchain-ai/langchain/releases/tag/langchain-community==${version}"; 132 description = "Community contributed LangChain integrations"; 133 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/community"; 134 license = lib.licenses.mit; 135 maintainers = with lib.maintainers; [ 136 natsukium 137 sarahec 138 ]; 139 }; 140}