1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 google-ai-generativelanguage,
6 google-api-core,
7 google-api-python-client,
8 google-auth,
9 protobuf,
10 pydantic,
11 pythonOlder,
12 pythonRelaxDepsHook,
13 setuptools,
14 tqdm,
15 typing-extensions,
16}:
17
18buildPythonPackage rec {
19 pname = "google-generativeai";
20 version = "0.5.4";
21 pyproject = true;
22
23 disabled = pythonOlder "3.9";
24
25 src = fetchFromGitHub {
26 owner = "google";
27 repo = "generative-ai-python";
28 rev = "refs/tags/v${version}";
29 hash = "sha256-g/strcvXNT21pD4Lt9sgFBgEgiFid+D/cUlTm6k3R6s=";
30 };
31
32 pythonRelaxDeps = [ "google-ai-generativelanguage" ];
33
34 build-system = [ setuptools ];
35
36 nativeBuildInputs = [ pythonRelaxDepsHook ];
37
38 dependencies = [
39 google-ai-generativelanguage
40 google-api-core
41 google-api-python-client
42 google-auth
43 protobuf
44 pydantic
45 tqdm
46 typing-extensions
47 ];
48
49 # Issue with the google.ai module. Check with the next release
50 doCheck = false;
51
52 pythonImportsCheck = [ "google.generativeai" ];
53
54 meta = with lib; {
55 description = "Python client library for Google's large language model PaLM API";
56 homepage = "https://github.com/google/generative-ai-python";
57 changelog = "https://github.com/google/generative-ai-python/releases/tag/v${version}";
58 license = licenses.asl20;
59 maintainers = with maintainers; [ fab ];
60 };
61}