Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 23.05 235 lines 4.0 kB view raw
1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4, pythonOlder 5, poetry-core 6, numpy 7, pyyaml 8, sqlalchemy 9, requests 10, async-timeout 11, aiohttp 12, numexpr 13, openapi-schema-pydantic 14, dataclasses-json 15, tqdm 16, tenacity 17, bash 18 # optional dependencies 19, anthropic 20, cohere 21, openai 22, nlpcloud 23, huggingface-hub 24, manifest-ml 25, torch 26, transformers 27, qdrant-client 28, sentence-transformers 29, azure-identity 30, azure-cosmos 31, azure-core 32, elasticsearch 33, opensearch-py 34, faiss 35, spacy 36, nltk 37, beautifulsoup4 38, tiktoken 39, jinja2 40, pinecone-client 41, weaviate-client 42, redis 43, google-api-python-client 44, pypdf 45, networkx 46, psycopg2 47, boto3 48, pyowm 49, pytesseract 50, html2text 51, atlassian-python-api 52, duckduckgo-search 53, lark 54, jq 55, protobuf 56, steamship 57, pdfminer-six 58, lxml 59 # test dependencies 60, pytest-vcr 61, pytest-asyncio 62, pytest-mock 63, pandas 64, toml 65, freezegun 66, responses 67, pexpect 68, pytestCheckHook 69}: 70 71buildPythonPackage rec { 72 pname = "langchain"; 73 version = "0.0.170"; 74 format = "pyproject"; 75 76 disabled = pythonOlder "3.8"; 77 78 src = fetchFromGitHub { 79 owner = "hwchase17"; 80 repo = "langchain"; 81 rev = "refs/tags/v${version}"; 82 hash = "sha256-0hV8X1c+vMJlynNud//hb164oTYmYlsmeSM4dKwC0G4="; 83 }; 84 85 postPatch = '' 86 substituteInPlace langchain/utilities/bash.py \ 87 --replace '"env", ["-i", "bash", ' '"${lib.getExe bash}", [' 88 substituteInPlace tests/unit_tests/test_bash.py \ 89 --replace "/bin/sh" "${bash}/bin/sh" 90 ''; 91 92 nativeBuildInputs = [ 93 poetry-core 94 ]; 95 96 buildInputs = [ 97 bash 98 ]; 99 100 propagatedBuildInputs = [ 101 numpy 102 pyyaml 103 sqlalchemy 104 requests 105 aiohttp 106 numexpr 107 openapi-schema-pydantic 108 dataclasses-json 109 tqdm 110 tenacity 111 ] ++ lib.optionals (pythonOlder "3.11") [ 112 async-timeout 113 ] ++ passthru.optional-dependencies.all; 114 115 passthru.optional-dependencies = { 116 llms = [ 117 anthropic 118 cohere 119 openai 120 nlpcloud 121 huggingface-hub 122 manifest-ml 123 torch 124 transformers 125 ]; 126 qdrant = [ 127 qdrant-client 128 ]; 129 openai = [ 130 openai 131 ]; 132 cohere = [ 133 cohere 134 ]; 135 embeddings = [ 136 sentence-transformers 137 ]; 138 azure = [ 139 azure-identity 140 azure-cosmos 141 openai 142 azure-core 143 ]; 144 all = [ 145 anthropic 146 cohere 147 openai 148 nlpcloud 149 huggingface-hub 150 # jina 151 manifest-ml 152 elasticsearch 153 opensearch-py 154 # google-search-results 155 faiss 156 sentence-transformers 157 transformers 158 spacy 159 nltk 160 # wikipedia 161 beautifulsoup4 162 tiktoken 163 torch 164 jinja2 165 pinecone-client 166 # pinecone-text 167 weaviate-client 168 redis 169 google-api-python-client 170 # wolframalpha 171 qdrant-client 172 # tensorflow-text 173 pypdf 174 networkx 175 # nomic 176 # aleph-alpha-client 177 # deeplake 178 # pgvector 179 psycopg2 180 boto3 181 pyowm 182 pytesseract 183 html2text 184 atlassian-python-api 185 # gptcache 186 duckduckgo-search 187 # arxiv 188 azure-identity 189 # clickhouse-connect 190 azure-cosmos 191 # lancedb 192 lark 193 pexpect 194 # pyvespa 195 # O365 196 jq 197 # docarray 198 protobuf 199 # hnswlib 200 steamship 201 pdfminer-six 202 lxml 203 ]; 204 }; 205 206 nativeCheckInputs = [ 207 pytestCheckHook 208 pytest-vcr 209 pytest-mock 210 pytest-asyncio 211 pandas 212 toml 213 freezegun 214 responses 215 ]; 216 217 pytestFlagsArray = [ 218 # integration_tests have many network, db access and require `OPENAI_API_KEY`, etc. 219 "tests/unit_tests" 220 ]; 221 222 disabledTests = [ 223 # these tests have db access 224 "test_table_info" 225 "test_sql_database_run" 226 ]; 227 228 meta = with lib; { 229 description = "Building applications with LLMs through composability"; 230 homepage = "https://github.com/hwchase17/langchain"; 231 changelog = "https://github.com/hwchase17/langchain/releases/tag/v${version}"; 232 license = licenses.mit; 233 maintainers = with maintainers; [ natsukium ]; 234 }; 235}