nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 (finalAttrs: {
27 pname = "langchain-xai";
28 version = "1.2.2";
29 pyproject = true;
30
31 src = fetchFromGitHub {
32 owner = "langchain-ai";
33 repo = "langchain";
34 tag = "langchain-xai==${finalAttrs.version}";
35 hash = "sha256-RUklm627HiwMcpKkm+0uWZgHp4iDtSsmEpLb9MxumqI=";
36 };
37
38 sourceRoot = "${finalAttrs.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 nativeCheckInputs = [
50 langchain-tests
51 pytest-asyncio
52 pytest-mock
53 pytestCheckHook
54 ];
55
56 enabledTestPaths = [ "tests/unit_tests" ];
57
58 disabledTests = [
59 # Breaks when langchain-core is updated
60 # Also: Compares a diff to a string literal and misses platform differences (aarch64-linux)
61 "test_serdes"
62 ];
63
64 pythonImportsCheck = [ "langchain_xai" ];
65
66 passthru = {
67 # python updater script sets the wrong tag
68 skipBulkUpdate = true;
69 updateScript = gitUpdater {
70 rev-prefix = "langchain-xai==";
71 };
72 };
73
74 meta = {
75 changelog = "https://github.com/langchain-ai/langchain-xai/releases/tag/${finalAttrs.src.tag}";
76 description = "Build LangChain applications with X AI";
77 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/xai";
78 license = lib.licenses.mit;
79 maintainers = [
80 lib.maintainers.sarahec
81 ];
82 };
83})