1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 poetry-core,
8
9 # dependencies
10 filetype,
11 google-api-core,
12 google-auth,
13 google-generativeai,
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 = "2.1.8";
33 pyproject = true;
34
35 src = fetchFromGitHub {
36 owner = "langchain-ai";
37 repo = "langchain-google";
38 tag = "libs/genai/v${version}";
39 hash = "sha256-ObeQuxBEiJhR2AgkFeIZ1oe2GxhhQywRA8eCALOwkT8=";
40 };
41
42 sourceRoot = "${src.name}/libs/genai";
43
44 build-system = [ poetry-core ];
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-generativeai
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 pytestFlagsArray = [ "tests/unit_tests" ];
72
73 pythonImportsCheck = [ "langchain_google_genai" ];
74
75 passthru.updateScript = gitUpdater {
76 rev-prefix = "libs/genai/v";
77 };
78
79 meta = {
80 changelog = "https://github.com/langchain-ai/langchain-google/releases/tag/${src.tag}";
81 description = "LangChain integrations for Google Gemini";
82 homepage = "https://github.com/langchain-ai/langchain-google/tree/main/libs/genai";
83 license = lib.licenses.mit;
84 maintainers = [
85 lib.maintainers.eu90h
86 lib.maintainers.sarahec
87 ];
88 };
89}