1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 pdm-backend,
8
9 # dependencies
10 httpx,
11 langchain-core,
12 syrupy,
13
14 # buildInputs
15 pytest,
16
17 # tests
18 numpy,
19 pytest-asyncio,
20 pytest-socket,
21 pytestCheckHook,
22
23 # passthru
24 nix-update-script,
25}:
26
27buildPythonPackage rec {
28 pname = "langchain-tests";
29 version = "0.3.19";
30 pyproject = true;
31
32 src = fetchFromGitHub {
33 owner = "langchain-ai";
34 repo = "langchain";
35 tag = "langchain-tests==${version}";
36 hash = "sha256-DSTngWRFseJ6kSAY7Lxxkh77QFr0jhHxG3mH89QmdxA=";
37 };
38
39 sourceRoot = "${src.name}/libs/standard-tests";
40
41 build-system = [ pdm-backend ];
42
43 pythonRelaxDeps = [
44 # Each component release requests the exact latest core.
45 # That prevents us from updating individul components.
46 "langchain-core"
47 "numpy"
48 ];
49
50 dependencies = [
51 httpx
52 langchain-core
53 pytest-asyncio
54 pytest-socket
55 syrupy
56 ];
57
58 buildInputs = [ pytest ];
59
60 pythonImportsCheck = [ "langchain_tests" ];
61
62 nativeBuildInputs = [
63 numpy
64 pytestCheckHook
65 ];
66
67 passthru.updateScript = nix-update-script {
68 extraArgs = [
69 "--version-regex"
70 "langchain-tests==([0-9.]+)"
71 ];
72 };
73
74 meta = {
75 description = "Build context-aware reasoning applications";
76 homepage = "https://github.com/langchain-ai/langchain";
77 license = lib.licenses.mit;
78 maintainers = with lib.maintainers; [
79 natsukium
80 sarahec
81 ];
82 };
83}