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