google-genai 1.52.0__py3-none-any.whl → 1.54.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- google/genai/_api_client.py +6 -6
- google/genai/_live_converters.py +3 -3
- google/genai/batches.py +11 -15
- google/genai/caches.py +40 -20
- google/genai/documents.py +3 -23
- google/genai/errors.py +16 -1
- google/genai/file_search_stores.py +9 -25
- google/genai/files.py +47 -45
- google/genai/live.py +8 -1
- google/genai/models.py +3 -3
- google/genai/tunings.py +121 -43
- google/genai/types.py +197 -127
- google/genai/version.py +1 -1
- {google_genai-1.52.0.dist-info → google_genai-1.54.0.dist-info}/METADATA +51 -30
- {google_genai-1.52.0.dist-info → google_genai-1.54.0.dist-info}/RECORD +18 -18
- {google_genai-1.52.0.dist-info → google_genai-1.54.0.dist-info}/WHEEL +0 -0
- {google_genai-1.52.0.dist-info → google_genai-1.54.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.52.0.dist-info → google_genai-1.54.0.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: google-genai
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.54.0
|
|
4
4
|
Summary: GenAI Python SDK
|
|
5
5
|
Author-email: Google LLC <googleapis-packages@google.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -20,7 +20,7 @@ Requires-Python: >=3.10
|
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
22
|
Requires-Dist: anyio<5.0.0,>=4.8.0
|
|
23
|
-
Requires-Dist: google-auth<3.0.0,>=2.14.1
|
|
23
|
+
Requires-Dist: google-auth[requests]<3.0.0,>=2.14.1
|
|
24
24
|
Requires-Dist: httpx<1.0.0,>=0.28.1
|
|
25
25
|
Requires-Dist: pydantic<3.0.0,>=2.9.0
|
|
26
26
|
Requires-Dist: requests<3.0.0,>=2.28.1
|
|
@@ -51,6 +51,16 @@ Google's generative models into their Python applications. It supports the
|
|
|
51
51
|
[Vertex AI](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/overview)
|
|
52
52
|
APIs.
|
|
53
53
|
|
|
54
|
+
## Code Generation
|
|
55
|
+
|
|
56
|
+
Generative models are often unaware of recent API and SDK updates and may suggest outdated or legacy code.
|
|
57
|
+
|
|
58
|
+
We recommend using our Code Generation instructions [codegen_instructions.md](https://raw.githubusercontent.com/googleapis/python-genai/refs/heads/main/codegen_instructions.md) when generating Google Gen AI SDK code to guide your model towards using the more recent SDK features.
|
|
59
|
+
|
|
60
|
+
Copy and paste the instructions from [this file](https://raw.githubusercontent.com/googleapis/python-genai/refs/heads/main/codegen_instructions.md)
|
|
61
|
+
into your development environment to provide the model with the necessary
|
|
62
|
+
context
|
|
63
|
+
|
|
54
64
|
## Installation
|
|
55
65
|
|
|
56
66
|
```sh
|
|
@@ -91,6 +101,44 @@ client = genai.Client(
|
|
|
91
101
|
)
|
|
92
102
|
```
|
|
93
103
|
|
|
104
|
+
## Using types
|
|
105
|
+
|
|
106
|
+
All API methods support Pydantic types and dictionaries, which you can access
|
|
107
|
+
from `google.genai.types`. You can import the types module with the following:
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from google.genai import types
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Below is an example `generate_content()` call using types from the types module:
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
response = client.models.generate_content(
|
|
117
|
+
model='gemini-2.0-flash-001',
|
|
118
|
+
contents=types.Part.from_text(text='Why is the sky blue?'),
|
|
119
|
+
config=types.GenerateContentConfig(
|
|
120
|
+
temperature=0,
|
|
121
|
+
top_p=0.95,
|
|
122
|
+
top_k=20,
|
|
123
|
+
),
|
|
124
|
+
)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Alternatively, you can accomplish the same request using dictionaries instead of
|
|
128
|
+
types:
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
response = client.models.generate_content(
|
|
132
|
+
model='gemini-2.0-flash-001',
|
|
133
|
+
contents={'text': 'Why is the sky blue?'},
|
|
134
|
+
config={
|
|
135
|
+
'temperature': 0,
|
|
136
|
+
'top_p': 0.95,
|
|
137
|
+
'top_k': 20,
|
|
138
|
+
},
|
|
139
|
+
)
|
|
140
|
+
```
|
|
141
|
+
|
|
94
142
|
**(Optional) Using environment variables:**
|
|
95
143
|
|
|
96
144
|
You can create a client by configuring the necessary environment variables.
|
|
@@ -165,7 +213,7 @@ await aclient.aclose()
|
|
|
165
213
|
## Client context managers
|
|
166
214
|
|
|
167
215
|
By using the sync client context manager, it will close the underlying
|
|
168
|
-
sync client when exiting the with block.
|
|
216
|
+
sync client when exiting the with block and avoid httpx "client has been closed" error like [issues#1763](https://github.com/googleapis/python-genai/issues/1763).
|
|
169
217
|
|
|
170
218
|
```python
|
|
171
219
|
from google.genai import Client
|
|
@@ -583,33 +631,6 @@ response = client.models.generate_content(
|
|
|
583
631
|
print(response.text)
|
|
584
632
|
```
|
|
585
633
|
|
|
586
|
-
### Typed Config
|
|
587
|
-
|
|
588
|
-
All API methods support Pydantic types for parameters as well as
|
|
589
|
-
dictionaries. You can get the type from `google.genai.types`.
|
|
590
|
-
|
|
591
|
-
```python
|
|
592
|
-
from google.genai import types
|
|
593
|
-
|
|
594
|
-
response = client.models.generate_content(
|
|
595
|
-
model='gemini-2.0-flash-001',
|
|
596
|
-
contents=types.Part.from_text(text='Why is the sky blue?'),
|
|
597
|
-
config=types.GenerateContentConfig(
|
|
598
|
-
temperature=0,
|
|
599
|
-
top_p=0.95,
|
|
600
|
-
top_k=20,
|
|
601
|
-
candidate_count=1,
|
|
602
|
-
seed=5,
|
|
603
|
-
max_output_tokens=100,
|
|
604
|
-
stop_sequences=['STOP!'],
|
|
605
|
-
presence_penalty=0.0,
|
|
606
|
-
frequency_penalty=0.0,
|
|
607
|
-
),
|
|
608
|
-
)
|
|
609
|
-
|
|
610
|
-
print(response.text)
|
|
611
|
-
```
|
|
612
|
-
|
|
613
634
|
### List Base Models
|
|
614
635
|
|
|
615
636
|
To retrieve tuned models, see [list tuned models](#list-tuned-models).
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
google/genai/__init__.py,sha256=SKz_9WQKA3R4OpJIDJlgssVfizLNDG2tuWtOD9pxrPE,729
|
|
2
2
|
google/genai/_adapters.py,sha256=Kok38miNYJff2n--l0zEK_hbq0y2rWOH7k75J7SMYbQ,1744
|
|
3
|
-
google/genai/_api_client.py,sha256=
|
|
3
|
+
google/genai/_api_client.py,sha256=CrHSu9Hd4rhhEpv5ds5jU_5xk0XwixTY055pRQRbFnE,67216
|
|
4
4
|
google/genai/_api_module.py,sha256=lj8eUWx8_LBGBz-49qz6_ywWm3GYp3d8Bg5JoOHbtbI,902
|
|
5
5
|
google/genai/_automatic_function_calling_util.py,sha256=xXNkJR-pzSMkeSXMz3Jw-kMHFbTJEiRJ3wocuwtWW4I,11627
|
|
6
6
|
google/genai/_base_transformers.py,sha256=wljA6m4tLl4XLGlBC2DNOls5N9-X9tffBq0M7i8jgpw,1034
|
|
7
7
|
google/genai/_base_url.py,sha256=E5H4dew14Y16qfnB3XRnjSCi19cJVlkaMNoM_8ip-PM,1597
|
|
8
8
|
google/genai/_common.py,sha256=9HOP8GtEnTGTF-5A92hQdcPWeaCS6ig3vgnmm-8jiTY,25421
|
|
9
9
|
google/genai/_extra_utils.py,sha256=GXsUfyKAPZaW9_ySvdzSAXThvuzaKwXcAmdHW_hoHpY,25309
|
|
10
|
-
google/genai/_live_converters.py,sha256=
|
|
10
|
+
google/genai/_live_converters.py,sha256=b1If4I7rpmJu9DMnFqKex0jeu5AVUGeTLo1XSd4HqN4,43721
|
|
11
11
|
google/genai/_local_tokenizer_loader.py,sha256=7yvJfEkWIpw2ueY4ZmoOAamJD-G7bm_9g44glD6bVwM,7147
|
|
12
12
|
google/genai/_mcp_utils.py,sha256=HuWJ8FUjquv40Mf_QjcL5r5yXWrS-JjINsjlOSbbyAc,3870
|
|
13
13
|
google/genai/_operations_converters.py,sha256=zw8DqkgJWHphrw9waAjAiH98QbE2Rnum3zGm02dHQWo,11695
|
|
@@ -15,27 +15,27 @@ google/genai/_replay_api_client.py,sha256=-sZY8pM8JulqTfuqIKaKHCy9MNXF7HJnX6fCzy
|
|
|
15
15
|
google/genai/_test_api_client.py,sha256=4ruFIy5_1qcbKqqIBu3HSQbpSOBrxiecBtDZaTGFR1s,4797
|
|
16
16
|
google/genai/_tokens_converters.py,sha256=sAx3CjSKR2PX2eppuJPvt_LgjYJZF9zh-fSUvDwa0WQ,15431
|
|
17
17
|
google/genai/_transformers.py,sha256=I19zzGXCrRd64lrBPpeawhBq7vifKn3fNUX9iIJ8Kwo,43266
|
|
18
|
-
google/genai/batches.py,sha256=
|
|
19
|
-
google/genai/caches.py,sha256=
|
|
18
|
+
google/genai/batches.py,sha256=MNQga5CkQduCf4fKIy4yNqcSc9YY64hL-dCNGnQTdxg,78419
|
|
19
|
+
google/genai/caches.py,sha256=MPYIElWqWtXkxiZ2FFCZspRVdT9sTrZzWEkBpQ-XII0,48118
|
|
20
20
|
google/genai/chats.py,sha256=pIBw8d13llupLn4a7vP6vnpbzDcvCCrZZ-Q2r8Cvo7g,16652
|
|
21
21
|
google/genai/client.py,sha256=xKiAg6h4kB_l9uBwgJzSlSjZ0icyCMsWPTFvhJ0_HJQ,13526
|
|
22
|
-
google/genai/documents.py,sha256=
|
|
23
|
-
google/genai/errors.py,sha256=
|
|
24
|
-
google/genai/file_search_stores.py,sha256=
|
|
25
|
-
google/genai/files.py,sha256=
|
|
26
|
-
google/genai/live.py,sha256=
|
|
22
|
+
google/genai/documents.py,sha256=GuYWVgRaYBzHv9aMgcZBrVkFlpBeaAeZsfhgvC_SLTA,16218
|
|
23
|
+
google/genai/errors.py,sha256=2Iux-5iGUJzEB6OWE3R18SckMEvNimOfpNCQIYL6cn8,8118
|
|
24
|
+
google/genai/file_search_stores.py,sha256=4EW_hRjkaGYu4gbQyNbiswTWk5nUgooxB5pqMi_WAME,41418
|
|
25
|
+
google/genai/files.py,sha256=g-geVkMmcgAsI7CPJqt3jzucEcjQf6He1fhnscUdxvs,31766
|
|
26
|
+
google/genai/live.py,sha256=ajM3lTDo9eT1KYVF5fLivuQeOtfbJcedQuDXHxmtNPo,41560
|
|
27
27
|
google/genai/live_music.py,sha256=Y7I7jh5SAKgyjBIMLboH0oTnZJ18uOT2SpRDKURvp94,6783
|
|
28
28
|
google/genai/local_tokenizer.py,sha256=EKZ72cV2Zfutlo_efMOPnLRNZN4WQe57rD3G80cF340,14109
|
|
29
|
-
google/genai/models.py,sha256=
|
|
29
|
+
google/genai/models.py,sha256=UeqEVqK-JO0fAW4DIbiXMQmejoYlM5kVv0h_QMX4z6A,238803
|
|
30
30
|
google/genai/operations.py,sha256=FXJOnYp2HA5Xqa5mHW67mSa9p1D_EaGGyUoKc09xFPQ,16384
|
|
31
31
|
google/genai/pagers.py,sha256=1i8NXDuKuQznFin5H5-I0hmj6H5YMTYsEJP7S0ITSbY,7158
|
|
32
32
|
google/genai/py.typed,sha256=RsMFoLwBkAvY05t6izop4UHZtqOPLiKp3GkIEizzmQY,40
|
|
33
33
|
google/genai/tokens.py,sha256=4BPW0gGWFeFVk3INkuY2tfREnsrvzQDhouvRI6_F9Q8,12235
|
|
34
|
-
google/genai/tunings.py,sha256=
|
|
35
|
-
google/genai/types.py,sha256=
|
|
36
|
-
google/genai/version.py,sha256=
|
|
37
|
-
google_genai-1.
|
|
38
|
-
google_genai-1.
|
|
39
|
-
google_genai-1.
|
|
40
|
-
google_genai-1.
|
|
41
|
-
google_genai-1.
|
|
34
|
+
google/genai/tunings.py,sha256=JR_ngNjjgIMd_iYDD53wBCYyHfY5V83njmtQOpBNpL0,76343
|
|
35
|
+
google/genai/types.py,sha256=qrRxDiTGbfkog6DhOBhpVkSQCJ6jSXt1iLioLxLOUXs,645693
|
|
36
|
+
google/genai/version.py,sha256=Bh860abHuAZdE4MCKzCPHNCKqbhUGiJldF39ctkV7nU,627
|
|
37
|
+
google_genai-1.54.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
38
|
+
google_genai-1.54.0.dist-info/METADATA,sha256=kD0yIP7EQVoq00wLiIXdkfug9OFfN8J71TPEPiwaIe0,47834
|
|
39
|
+
google_genai-1.54.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
40
|
+
google_genai-1.54.0.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
|
|
41
|
+
google_genai-1.54.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|