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