Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 135 lines 2.6 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 pythonOlder, 6 7 # build-system 8 poetry-core, 9 10 # buildInputs 11 bash, 12 13 # dependencies 14 aiohttp, 15 httpx-sse, 16 langchain-core, 17 langchain-text-splitters, 18 langsmith, 19 pydantic, 20 pyyaml, 21 requests, 22 sqlalchemy, 23 tenacity, 24 async-timeout, 25 26 # optional-dependencies 27 numpy, 28 29 # tests 30 freezegun, 31 httpx, 32 lark, 33 pandas, 34 pytest-asyncio, 35 pytest-mock, 36 pytest-socket, 37 pytestCheckHook, 38 requests-mock, 39 responses, 40 syrupy, 41 toml, 42}: 43 44buildPythonPackage rec { 45 pname = "langchain"; 46 version = "0.3.7"; 47 pyproject = true; 48 49 src = fetchFromGitHub { 50 owner = "langchain-ai"; 51 repo = "langchain"; 52 rev = "refs/tags/langchain==${version}"; 53 hash = "sha256-TaK8lnPxKUqwvKLtQIfzg2l8McQ1fd0g9vocHM0+kjY="; 54 }; 55 56 sourceRoot = "${src.name}/libs/langchain"; 57 58 build-system = [ poetry-core ]; 59 60 buildInputs = [ bash ]; 61 62 pythonRelaxDeps = [ "tenacity" ]; 63 64 dependencies = [ 65 aiohttp 66 httpx-sse 67 langchain-core 68 langchain-text-splitters 69 langsmith 70 pydantic 71 pyyaml 72 requests 73 sqlalchemy 74 tenacity 75 ] ++ lib.optionals (pythonOlder "3.11") [ async-timeout ]; 76 77 optional-dependencies = { 78 numpy = [ numpy ]; 79 }; 80 81 nativeCheckInputs = [ 82 freezegun 83 httpx 84 lark 85 pandas 86 pytest-asyncio 87 pytest-mock 88 pytest-socket 89 pytestCheckHook 90 requests-mock 91 responses 92 syrupy 93 toml 94 ]; 95 96 pytestFlagsArray = [ 97 # integration_tests require network access, database access and require `OPENAI_API_KEY`, etc. 98 "tests/unit_tests" 99 "--only-core" 100 ]; 101 102 disabledTests = [ 103 # These tests have database access 104 "test_table_info" 105 "test_sql_database_run" 106 # These tests have network access 107 "test_socket_disabled" 108 "test_openai_agent_with_streaming" 109 "test_openai_agent_tools_agent" 110 # This test may require a specific version of langchain-community 111 "test_compatible_vectorstore_documentation" 112 # AssertionErrors 113 "test_callback_handlers" 114 "test_generic_fake_chat_model" 115 # Test is outdated 116 "test_serializable_mapping" 117 "test_person" 118 "test_aliases_hidden" 119 ]; 120 121 pythonImportsCheck = [ "langchain" ]; 122 123 passthru = { 124 updateScript = langchain-core.updateScript; 125 }; 126 127 meta = { 128 description = "Building applications with LLMs through composability"; 129 homepage = "https://github.com/langchain-ai/langchain"; 130 changelog = "https://github.com/langchain-ai/langchain/releases/tag/v${version}"; 131 license = lib.licenses.mit; 132 maintainers = with lib.maintainers; [ natsukium ]; 133 mainProgram = "langchain-server"; 134 }; 135}