1{ 2 lib, 3 stdenvNoCC, 4 buildPythonPackage, 5 fetchFromGitHub, 6 7 # build-system 8 pdm-backend, 9 10 # dependencies 11 aiohttp, 12 langchain-core, 13 langchain-openai, 14 requests, 15 16 # tests 17 langchain-tests, 18 pytest-asyncio, 19 pytest-mock, 20 pytestCheckHook, 21 22 # passthru 23 gitUpdater, 24}: 25 26buildPythonPackage rec { 27 pname = "langchain-xai"; 28 version = "0.2.5"; 29 pyproject = true; 30 31 src = fetchFromGitHub { 32 owner = "langchain-ai"; 33 repo = "langchain"; 34 tag = "langchain-xai==${version}"; 35 hash = "sha256-nae7KwCKjkvenOO8vErxFQStHolc+N8EUuK6U8r48Kc="; 36 }; 37 38 sourceRoot = "${src.name}/libs/partners/xai"; 39 40 build-system = [ pdm-backend ]; 41 42 dependencies = [ 43 aiohttp 44 langchain-core 45 langchain-openai 46 requests 47 ]; 48 49 pythonRelaxDeps = [ 50 # Each component release requests the exact latest core. 51 # That prevents us from updating individual components. 52 "langchain-core" 53 ]; 54 55 nativeCheckInputs = [ 56 langchain-tests 57 pytest-asyncio 58 pytest-mock 59 pytestCheckHook 60 ]; 61 62 enabledTestPaths = [ "tests/unit_tests" ]; 63 64 disabledTests = 65 lib.optionals (stdenvNoCC.hostPlatform.isLinux && stdenvNoCC.hostPlatform.isAarch64) 66 [ 67 # Compares a diff to a string literal and misses platform differences 68 "test_serdes" 69 ]; 70 71 pythonImportsCheck = [ "langchain_xai" ]; 72 73 passthru = { 74 # python updater script sets the wrong tag 75 skipBulkUpdate = true; 76 updateScript = gitUpdater { 77 rev-prefix = "langchain-xai=="; 78 }; 79 }; 80 81 meta = { 82 changelog = "https://github.com/langchain-ai/langchain-xai/releases/tag/${src.tag}"; 83 description = "Build LangChain applications with X AI"; 84 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/xai"; 85 license = lib.licenses.mit; 86 maintainers = [ 87 lib.maintainers.sarahec 88 ]; 89 }; 90}