1{ 2 lib, 3 aiohttp, 4 async-timeout, 5 azure-core, 6 azure-cosmos, 7 azure-identity, 8 bash, 9 buildPythonPackage, 10 chardet, 11 clarifai, 12 cohere, 13 dataclasses-json, 14 esprima, 15 fetchFromGitHub, 16 freezegun, 17 huggingface-hub, 18 jsonpatch, 19 langchain-community, 20 langchain-core, 21 langchain-text-splitters, 22 langsmith, 23 lark, 24 manifest-ml, 25 nlpcloud, 26 numpy, 27 openai, 28 pandas, 29 poetry-core, 30 pydantic, 31 pytest-asyncio, 32 pytest-mock, 33 pytest-socket, 34 pytestCheckHook, 35 pythonOlder, 36 pyyaml, 37 qdrant-client, 38 requests-mock, 39 requests, 40 responses, 41 sentence-transformers, 42 sqlalchemy, 43 syrupy, 44 tenacity, 45 tiktoken, 46 toml, 47 torch, 48 transformers, 49 typer, 50}: 51 52buildPythonPackage rec { 53 pname = "langchain"; 54 version = "0.1.52"; 55 pyproject = true; 56 57 disabled = pythonOlder "3.8"; 58 59 src = fetchFromGitHub { 60 owner = "langchain-ai"; 61 repo = "langchain"; 62 rev = "refs/tags/langchain-core==${version}"; 63 hash = "sha256-H8rtysRIwyuJEUFI93vid3MsqReyRCER88xztsuYpOc="; 64 }; 65 66 sourceRoot = "${src.name}/libs/langchain"; 67 68 build-system = [ poetry-core ]; 69 70 buildInputs = [ bash ]; 71 72 dependencies = [ 73 aiohttp 74 dataclasses-json 75 jsonpatch 76 langchain-community 77 langchain-core 78 langchain-text-splitters 79 langsmith 80 numpy 81 pydantic 82 pyyaml 83 requests 84 sqlalchemy 85 tenacity 86 ] ++ lib.optionals (pythonOlder "3.11") [ async-timeout ]; 87 88 passthru.optional-dependencies = { 89 llms = [ 90 clarifai 91 cohere 92 openai 93 # openlm 94 nlpcloud 95 huggingface-hub 96 manifest-ml 97 torch 98 transformers 99 ]; 100 qdrant = [ qdrant-client ]; 101 openai = [ 102 openai 103 tiktoken 104 ]; 105 text_helpers = [ chardet ]; 106 clarifai = [ clarifai ]; 107 cohere = [ cohere ]; 108 docarray = [ 109 # docarray 110 ]; 111 embeddings = [ sentence-transformers ]; 112 javascript = [ esprima ]; 113 azure = [ 114 azure-identity 115 azure-cosmos 116 openai 117 azure-core 118 # azure-ai-formrecognizer 119 # azure-ai-vision 120 # azure-cognitiveservices-speech 121 # azure-search-documents 122 # azure-ai-textanalytics 123 ]; 124 all = [ ]; 125 cli = [ typer ]; 126 }; 127 128 nativeCheckInputs = [ 129 freezegun 130 lark 131 pandas 132 pytest-asyncio 133 pytest-mock 134 pytest-socket 135 pytestCheckHook 136 requests-mock 137 responses 138 syrupy 139 toml 140 ]; 141 142 pytestFlagsArray = [ 143 # integration_tests require network access, database access and require `OPENAI_API_KEY`, etc. 144 "tests/unit_tests" 145 "--only-core" 146 ]; 147 148 disabledTests = [ 149 # These tests have database access 150 "test_table_info" 151 "test_sql_database_run" 152 # These tests have network access 153 "test_socket_disabled" 154 "test_openai_agent_with_streaming" 155 "test_openai_agent_tools_agent" 156 # This test may require a specific version of langchain-community 157 "test_compatible_vectorstore_documentation" 158 # AssertionErrors 159 "test_callback_handlers" 160 "test_generic_fake_chat_model" 161 # Test is outdated 162 "test_serializable_mapping" 163 "test_person" 164 "test_aliases_hidden" 165 ]; 166 167 pythonImportsCheck = [ "langchain" ]; 168 169 meta = with lib; { 170 description = "Building applications with LLMs through composability"; 171 homepage = "https://github.com/langchain-ai/langchain"; 172 changelog = "https://github.com/langchain-ai/langchain/releases/tag/v${version}"; 173 license = licenses.mit; 174 maintainers = with maintainers; [ natsukium ]; 175 mainProgram = "langchain-server"; 176 }; 177}