2023-05-24 13:37:59 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pythonOlder
|
|
|
|
, poetry-core
|
|
|
|
, numpy
|
|
|
|
, pyyaml
|
|
|
|
, sqlalchemy
|
|
|
|
, requests
|
|
|
|
, async-timeout
|
|
|
|
, aiohttp
|
|
|
|
, numexpr
|
|
|
|
, openapi-schema-pydantic
|
|
|
|
, dataclasses-json
|
|
|
|
, tqdm
|
|
|
|
, tenacity
|
|
|
|
, bash
|
|
|
|
# optional dependencies
|
|
|
|
, anthropic
|
2023-07-15 17:15:38 +00:00
|
|
|
, clarifai
|
2023-05-24 13:37:59 +00:00
|
|
|
, cohere
|
|
|
|
, openai
|
|
|
|
, nlpcloud
|
|
|
|
, huggingface-hub
|
|
|
|
, manifest-ml
|
|
|
|
, torch
|
|
|
|
, transformers
|
|
|
|
, qdrant-client
|
|
|
|
, sentence-transformers
|
|
|
|
, azure-identity
|
|
|
|
, azure-cosmos
|
|
|
|
, azure-core
|
|
|
|
, elasticsearch
|
|
|
|
, opensearch-py
|
2023-07-15 17:15:38 +00:00
|
|
|
, google-search-results
|
2023-05-24 13:37:59 +00:00
|
|
|
, faiss
|
|
|
|
, spacy
|
|
|
|
, nltk
|
2023-07-15 17:15:38 +00:00
|
|
|
, wikipedia
|
2023-05-24 13:37:59 +00:00
|
|
|
, beautifulsoup4
|
|
|
|
, tiktoken
|
|
|
|
, jinja2
|
|
|
|
, pinecone-client
|
|
|
|
, weaviate-client
|
|
|
|
, redis
|
|
|
|
, google-api-python-client
|
|
|
|
, pypdf
|
|
|
|
, networkx
|
2023-07-15 17:15:38 +00:00
|
|
|
, pgvector
|
2023-05-24 13:37:59 +00:00
|
|
|
, psycopg2
|
|
|
|
, boto3
|
|
|
|
, pyowm
|
|
|
|
, pytesseract
|
|
|
|
, html2text
|
|
|
|
, atlassian-python-api
|
|
|
|
, duckduckgo-search
|
|
|
|
, lark
|
|
|
|
, jq
|
|
|
|
, steamship
|
|
|
|
, pdfminer-six
|
|
|
|
, lxml
|
2023-07-15 17:15:38 +00:00
|
|
|
, chardet
|
|
|
|
, requests-toolbelt
|
|
|
|
, neo4j
|
|
|
|
, langchainplus-sdk
|
2023-05-24 13:37:59 +00:00
|
|
|
# test dependencies
|
|
|
|
, pytest-vcr
|
|
|
|
, pytest-asyncio
|
|
|
|
, pytest-mock
|
2023-07-15 17:15:38 +00:00
|
|
|
, pytest-socket
|
2023-05-24 13:37:59 +00:00
|
|
|
, pandas
|
2023-07-15 17:15:38 +00:00
|
|
|
, syrupy
|
2023-05-24 13:37:59 +00:00
|
|
|
, toml
|
|
|
|
, freezegun
|
|
|
|
, responses
|
|
|
|
, pexpect
|
|
|
|
, pytestCheckHook
|
2023-07-15 17:15:38 +00:00
|
|
|
, pythonRelaxDepsHook
|
2023-05-24 13:37:59 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "langchain";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "0.0.229";
|
2023-05-24 13:37:59 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.8";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "hwchase17";
|
|
|
|
repo = "langchain";
|
|
|
|
rev = "refs/tags/v${version}";
|
2023-07-15 17:15:38 +00:00
|
|
|
hash = "sha256-9hPF+0bEcFGH2oop3e513kBp6UeUEBlPXD+2pZ4dCi0=";
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace langchain/utilities/bash.py \
|
|
|
|
--replace '"env", ["-i", "bash", ' '"${lib.getExe bash}", ['
|
|
|
|
substituteInPlace tests/unit_tests/test_bash.py \
|
|
|
|
--replace "/bin/sh" "${bash}/bin/sh"
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
poetry-core
|
2023-07-15 17:15:38 +00:00
|
|
|
pythonRelaxDepsHook
|
2023-05-24 13:37:59 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
bash
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
pyyaml
|
|
|
|
sqlalchemy
|
|
|
|
requests
|
|
|
|
aiohttp
|
|
|
|
numexpr
|
|
|
|
openapi-schema-pydantic
|
|
|
|
dataclasses-json
|
|
|
|
tqdm
|
|
|
|
tenacity
|
|
|
|
] ++ lib.optionals (pythonOlder "3.11") [
|
|
|
|
async-timeout
|
|
|
|
] ++ passthru.optional-dependencies.all;
|
|
|
|
|
|
|
|
passthru.optional-dependencies = {
|
|
|
|
llms = [
|
|
|
|
anthropic
|
2023-07-15 17:15:38 +00:00
|
|
|
clarifai
|
2023-05-24 13:37:59 +00:00
|
|
|
cohere
|
|
|
|
openai
|
|
|
|
nlpcloud
|
|
|
|
huggingface-hub
|
|
|
|
manifest-ml
|
|
|
|
torch
|
|
|
|
transformers
|
|
|
|
];
|
|
|
|
qdrant = [
|
|
|
|
qdrant-client
|
|
|
|
];
|
|
|
|
openai = [
|
|
|
|
openai
|
|
|
|
];
|
2023-07-15 17:15:38 +00:00
|
|
|
text_helpers = [
|
|
|
|
chardet
|
|
|
|
];
|
|
|
|
clarifai = [
|
|
|
|
clarifai
|
|
|
|
];
|
2023-05-24 13:37:59 +00:00
|
|
|
cohere = [
|
|
|
|
cohere
|
|
|
|
];
|
2023-07-15 17:15:38 +00:00
|
|
|
docarray = [
|
|
|
|
# docarray
|
|
|
|
];
|
2023-05-24 13:37:59 +00:00
|
|
|
embeddings = [
|
|
|
|
sentence-transformers
|
|
|
|
];
|
|
|
|
azure = [
|
|
|
|
azure-identity
|
|
|
|
azure-cosmos
|
|
|
|
openai
|
|
|
|
azure-core
|
|
|
|
];
|
|
|
|
all = [
|
|
|
|
anthropic
|
2023-07-15 17:15:38 +00:00
|
|
|
clarifai
|
2023-05-24 13:37:59 +00:00
|
|
|
cohere
|
|
|
|
openai
|
|
|
|
nlpcloud
|
|
|
|
huggingface-hub
|
|
|
|
# jina
|
|
|
|
manifest-ml
|
|
|
|
elasticsearch
|
|
|
|
opensearch-py
|
2023-07-15 17:15:38 +00:00
|
|
|
google-search-results
|
2023-05-24 13:37:59 +00:00
|
|
|
faiss
|
|
|
|
sentence-transformers
|
|
|
|
transformers
|
|
|
|
spacy
|
|
|
|
nltk
|
2023-07-15 17:15:38 +00:00
|
|
|
wikipedia
|
2023-05-24 13:37:59 +00:00
|
|
|
beautifulsoup4
|
|
|
|
tiktoken
|
|
|
|
torch
|
|
|
|
jinja2
|
|
|
|
pinecone-client
|
|
|
|
# pinecone-text
|
|
|
|
weaviate-client
|
|
|
|
redis
|
|
|
|
google-api-python-client
|
|
|
|
# wolframalpha
|
|
|
|
qdrant-client
|
|
|
|
# tensorflow-text
|
|
|
|
pypdf
|
|
|
|
networkx
|
|
|
|
# nomic
|
|
|
|
# aleph-alpha-client
|
|
|
|
# deeplake
|
2023-07-15 17:15:38 +00:00
|
|
|
pgvector
|
2023-05-24 13:37:59 +00:00
|
|
|
psycopg2
|
|
|
|
boto3
|
|
|
|
pyowm
|
|
|
|
pytesseract
|
|
|
|
html2text
|
|
|
|
atlassian-python-api
|
|
|
|
# gptcache
|
|
|
|
duckduckgo-search
|
|
|
|
# arxiv
|
|
|
|
azure-identity
|
|
|
|
# clickhouse-connect
|
|
|
|
azure-cosmos
|
|
|
|
# lancedb
|
2023-07-15 17:15:38 +00:00
|
|
|
# langkit
|
2023-05-24 13:37:59 +00:00
|
|
|
lark
|
|
|
|
pexpect
|
|
|
|
# pyvespa
|
|
|
|
# O365
|
|
|
|
jq
|
|
|
|
# docarray
|
|
|
|
steamship
|
|
|
|
pdfminer-six
|
|
|
|
lxml
|
2023-07-15 17:15:38 +00:00
|
|
|
requests-toolbelt
|
|
|
|
neo4j
|
|
|
|
# openlm
|
|
|
|
# azure-ai-formrecognizer
|
|
|
|
# azure-ai-vision
|
|
|
|
# azure-cognitiveservices-speech
|
|
|
|
langchainplus-sdk
|
2023-05-24 13:37:59 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
pytest-vcr
|
|
|
|
pytest-mock
|
2023-07-15 17:15:38 +00:00
|
|
|
pytest-socket
|
2023-05-24 13:37:59 +00:00
|
|
|
pytest-asyncio
|
|
|
|
pandas
|
2023-07-15 17:15:38 +00:00
|
|
|
syrupy
|
2023-05-24 13:37:59 +00:00
|
|
|
toml
|
|
|
|
freezegun
|
|
|
|
responses
|
|
|
|
];
|
|
|
|
|
|
|
|
pytestFlagsArray = [
|
|
|
|
# integration_tests have many network, db access and require `OPENAI_API_KEY`, etc.
|
|
|
|
"tests/unit_tests"
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# these tests have db access
|
|
|
|
"test_table_info"
|
|
|
|
"test_sql_database_run"
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
# these tests have network access
|
|
|
|
"test_socket_disabled"
|
2023-05-24 13:37:59 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Building applications with LLMs through composability";
|
|
|
|
homepage = "https://github.com/hwchase17/langchain";
|
|
|
|
changelog = "https://github.com/hwchase17/langchain/releases/tag/v${version}";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ natsukium ];
|
|
|
|
};
|
|
|
|
}
|