1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 nix-update-script,
6
7 # build-system
8 pdm-backend,
9
10 # dependencies
11 anthropic,
12 langchain-core,
13 pydantic,
14
15 # tests
16 langchain-tests,
17 pytest-asyncio,
18 pytestCheckHook,
19}:
20
21buildPythonPackage rec {
22 pname = "langchain-anthropic";
23 version = "0.3.13";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "langchain-ai";
28 repo = "langchain";
29 tag = "langchain-anthropic==${version}";
30 hash = "sha256-CloIxDPnBnKDUeS4psRvpz8ifK/xR/U62wG+ORHginM=";
31 };
32
33 sourceRoot = "${src.name}/libs/partners/anthropic";
34
35 build-system = [ pdm-backend ];
36
37 dependencies = [
38 anthropic
39 langchain-core
40 pydantic
41 ];
42
43 pythonRelaxDeps = [
44 # Each component release requests the exact latest core.
45 # That prevents us from updating individual components.
46 "langchain-core"
47 ];
48
49 nativeCheckInputs = [
50 langchain-tests
51 pytest-asyncio
52 pytestCheckHook
53 ];
54
55 pytestFlagsArray = [ "tests/unit_tests" ];
56
57 pythonImportsCheck = [ "langchain_anthropic" ];
58
59 passthru.updateScript = nix-update-script {
60 extraArgs = [
61 "--version-regex"
62 "langchain-anthropic==([0-9.]+)"
63 ];
64 };
65
66 meta = {
67 changelog = "https://github.com/langchain-ai/langchain-anthropic/releases/tag/langchain-anthropic==${version}";
68 description = "Build LangChain applications with Anthropic";
69 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/anthropic";
70 license = lib.licenses.mit;
71 maintainers = [
72 lib.maintainers.sarahec
73 ];
74 };
75}