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