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.18";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "langchain-ai";
30 repo = "langchain";
31 tag = "langchain-anthropic==${version}";
32 hash = "sha256-ZedCz4FyKowhxLVpHrBsmGKHkMCA5yW7ui6LI0QGQ44=";
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 = {
64 # python updater script sets the wrong tag
65 skipBulkUpdate = true;
66 updateScript = gitUpdater {
67 rev-prefix = "langchain-anthropic==";
68 };
69 };
70
71 meta = {
72 changelog = "https://github.com/langchain-ai/langchain-anthropic/releases/tag/${src.tag}";
73 description = "Build LangChain applications with Anthropic";
74 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/anthropic";
75 license = lib.licenses.mit;
76 maintainers = [
77 lib.maintainers.sarahec
78 ];
79 };
80}