Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenvNoCC,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 hatchling,
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 = "1.2.1";
29 pyproject = true;
30
31 src = fetchFromGitHub {
32 owner = "langchain-ai";
33 repo = "langchain";
34 tag = "langchain-xai==${version}";
35 hash = "sha256-Eryr68TQDN37AwJVEm1jJvwqcxMjl2KO42dy7doJCrA=";
36 };
37
38 sourceRoot = "${src.name}/libs/partners/xai";
39
40 build-system = [ hatchling ];
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 # Breaks when langchain-core is updated
66 # Also: Compares a diff to a string literal and misses platform differences (aarch64-linux)
67 "test_serdes"
68 ];
69
70 pythonImportsCheck = [ "langchain_xai" ];
71
72 passthru = {
73 # python updater script sets the wrong tag
74 skipBulkUpdate = true;
75 updateScript = gitUpdater {
76 rev-prefix = "langchain-xai==";
77 };
78 };
79
80 meta = {
81 changelog = "https://github.com/langchain-ai/langchain-xai/releases/tag/${src.tag}";
82 description = "Build LangChain applications with X AI";
83 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/xai";
84 license = lib.licenses.mit;
85 maintainers = [
86 lib.maintainers.sarahec
87 ];
88 };
89}