nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 hatchling,
8
9 # dependencies
10 filetype,
11 google-api-core,
12 google-auth,
13 google-genai,
14 langchain-core,
15 pydantic,
16
17 # tests
18 freezegun,
19 langchain-tests,
20 numpy,
21 pytest-asyncio,
22 pytest-mock,
23 pytestCheckHook,
24 syrupy,
25
26 # passthru
27 gitUpdater,
28}:
29
30buildPythonPackage rec {
31 pname = "langchain-google-genai";
32 version = "4.1.1";
33 pyproject = true;
34
35 src = fetchFromGitHub {
36 owner = "langchain-ai";
37 repo = "langchain-google";
38 tag = "libs/genai/v${version}";
39 hash = "sha256-PqJyT6Z6XpDvbexLlrrfeeycS4mXNR3vpWz3vSy+iac=";
40 };
41
42 sourceRoot = "${src.name}/libs/genai";
43
44 build-system = [ hatchling ];
45
46 pythonRelaxDeps = [
47 # Each component release requests the exact latest core.
48 # That prevents us from updating individual components.
49 "langchain-core"
50 ];
51
52 dependencies = [
53 filetype
54 google-api-core
55 google-auth
56 google-genai
57 langchain-core
58 pydantic
59 ];
60
61 nativeCheckInputs = [
62 freezegun
63 langchain-tests
64 numpy
65 pytest-asyncio
66 pytest-mock
67 pytestCheckHook
68 syrupy
69 ];
70
71 enabledTestPaths = [ "tests/unit_tests" ];
72
73 disabledTests = [
74 # Fails when langchain-core gets ahead of this package
75 "test_serdes"
76 "test_serialize"
77 ];
78
79 pythonImportsCheck = [ "langchain_google_genai" ];
80
81 passthru = {
82 # python updater script sets the wrong tag
83 skipBulkUpdate = true;
84 updateScript = gitUpdater {
85 rev-prefix = "libs/genai/v";
86 };
87 };
88
89 meta = {
90 changelog = "https://github.com/langchain-ai/langchain-google/releases/tag/${src.tag}";
91 description = "LangChain integrations for Google Gemini";
92 homepage = "https://github.com/langchain-ai/langchain-google/tree/main/libs/genai";
93 license = lib.licenses.mit;
94 maintainers = with lib.maintainers; [
95 eu90h
96 sarahec
97 ];
98 };
99}