1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 poetry-core,
9
10 # dependencies
11 httpx,
12 orjson,
13 pydantic,
14 requests,
15 requests-toolbelt,
16
17 # tests
18 anthropic,
19 dataclasses-json,
20 fastapi,
21 freezegun,
22 instructor,
23 pytest-asyncio,
24 pytestCheckHook,
25 uvicorn,
26 attr,
27}:
28
29buildPythonPackage rec {
30 pname = "langsmith";
31 version = "0.1.147";
32 pyproject = true;
33
34 src = fetchFromGitHub {
35 owner = "langchain-ai";
36 repo = "langsmith-sdk";
37 rev = "refs/tags/v${version}";
38 hash = "sha256-d0PJaC1MhVS3i4AtXUjSkkq/Yj2Pi42H/cW/XML/94o=";
39 };
40
41 sourceRoot = "${src.name}/python";
42
43 pythonRelaxDeps = [ "orjson" ];
44
45 build-system = [ poetry-core ];
46
47 dependencies = [
48 httpx
49 orjson
50 pydantic
51 requests
52 requests-toolbelt
53 ];
54
55 nativeCheckInputs = [
56 anthropic
57 dataclasses-json
58 fastapi
59 freezegun
60 instructor
61 pytest-asyncio
62 pytestCheckHook
63 uvicorn
64 ] ++ lib.optionals stdenv.hostPlatform.isLinux [ attr ];
65
66 disabledTests = [
67 # These tests require network access
68 "integration_tests"
69 # due to circular import
70 "test_as_runnable"
71 "test_as_runnable_batch"
72 "test_as_runnable_async"
73 "test_as_runnable_async_batch"
74 # Test requires git repo
75 "test_git_info"
76 # Tests require OpenAI API key
77 "test_chat_async_api"
78 "test_chat_sync_api"
79 "test_completions_async_api"
80 "test_completions_sync_api"
81 ];
82
83 disabledTestPaths = [
84 # due to circular import
85 "tests/integration_tests/test_client.py"
86 "tests/integration_tests/test_prompts.py"
87 "tests/unit_tests/test_client.py"
88 # Tests require a Langsmith API key
89 "tests/evaluation/test_evaluation.py"
90 "tests/external/test_instructor_evals.py"
91 ];
92
93 pythonImportsCheck = [ "langsmith" ];
94
95 __darwinAllowLocalNetworking = true;
96
97 meta = {
98 description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform";
99 homepage = "https://github.com/langchain-ai/langsmith-sdk";
100 changelog = "https://github.com/langchain-ai/langsmith-sdk/releases/tag/v${version}";
101 license = lib.licenses.mit;
102 maintainers = with lib.maintainers; [ natsukium ];
103 mainProgram = "langsmith";
104 };
105}