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