nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at r-updates 112 lines 2.2 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 6 # build-system 7 hatchling, 8 9 # dependencies 10 langchain-core, 11 openai, 12 tiktoken, 13 14 # tests 15 freezegun, 16 langchain, 17 langchain-tests, 18 lark, 19 pandas, 20 pytest-asyncio, 21 pytest-cov-stub, 22 pytestCheckHook, 23 pytest-mock, 24 pytest-socket, 25 requests-mock, 26 responses, 27 syrupy, 28 toml, 29 30 # passthru 31 gitUpdater, 32}: 33 34buildPythonPackage (finalAttrs: { 35 pname = "langchain-openai"; 36 version = "1.1.10"; 37 pyproject = true; 38 39 src = fetchFromGitHub { 40 owner = "langchain-ai"; 41 repo = "langchain"; 42 tag = "langchain-openai==${finalAttrs.version}"; 43 hash = "sha256-k0JpzgF+2UaYUbtzOB+NFxq7Ge/eRbT8M4PgvDpRG2g="; 44 }; 45 46 sourceRoot = "${finalAttrs.src.name}/libs/partners/openai"; 47 48 build-system = [ hatchling ]; 49 50 dependencies = [ 51 langchain-core 52 openai 53 tiktoken 54 ]; 55 56 nativeCheckInputs = [ 57 freezegun 58 langchain 59 langchain-tests 60 lark 61 pandas 62 pytest-asyncio 63 pytest-cov-stub 64 pytestCheckHook 65 pytest-mock 66 pytest-socket 67 requests-mock 68 responses 69 syrupy 70 toml 71 ]; 72 73 enabledTestPaths = [ "tests/unit_tests" ]; 74 75 disabledTests = [ 76 # These tests require network access 77 "test__get_encoding_model" 78 "test_chat_openai_get_num_tokens" 79 "test_embed_documents_with_custom_chunk_size" 80 "test_get_num_tokens_from_messages" 81 "test_get_token_ids" 82 "test_embeddings_respects_token_limit" 83 84 # Fail when langchain-core gets ahead of this package 85 "test_serdes" 86 "test_loads_openai_llm" 87 "test_load_openai_llm" 88 "test_loads_openai_chat" 89 "test_load_openai_chat" 90 ]; 91 92 pythonImportsCheck = [ "langchain_openai" ]; 93 94 passthru = { 95 # python updater script sets the wrong tag 96 skipBulkUpdate = true; 97 updateScript = gitUpdater { 98 rev-prefix = "langchain-openai=="; 99 }; 100 }; 101 102 meta = { 103 changelog = "https://github.com/langchain-ai/langchain/releases/tag/${finalAttrs.src.tag}"; 104 description = "Integration package connecting OpenAI and LangChain"; 105 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/openai"; 106 license = lib.licenses.mit; 107 maintainers = with lib.maintainers; [ 108 natsukium 109 sarahec 110 ]; 111 }; 112})