google-genai 1.23.0__py3-none-any.whl → 1.25.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 +43 -31
- google/genai/_common.py +6 -4
- google/genai/_live_converters.py +14 -6
- google/genai/_replay_api_client.py +15 -8
- google/genai/_tokens_converters.py +6 -0
- google/genai/_transformers.py +12 -6
- google/genai/batches.py +84 -12
- google/genai/caches.py +6 -0
- google/genai/errors.py +2 -2
- google/genai/live.py +14 -5
- google/genai/models.py +6 -0
- google/genai/tokens.py +8 -4
- google/genai/tunings.py +12 -0
- google/genai/types.py +312 -34
- google/genai/version.py +1 -1
- {google_genai-1.23.0.dist-info → google_genai-1.25.0.dist-info}/METADATA +96 -7
- google_genai-1.25.0.dist-info/RECORD +35 -0
- google_genai-1.23.0.dist-info/RECORD +0 -35
- {google_genai-1.23.0.dist-info → google_genai-1.25.0.dist-info}/WHEEL +0 -0
- {google_genai-1.23.0.dist-info → google_genai-1.25.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.23.0.dist-info → google_genai-1.25.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.25.0
|
4
4
|
Summary: GenAI Python SDK
|
5
5
|
Author-email: Google LLC <googleapis-packages@google.com>
|
6
6
|
License: Apache-2.0
|
@@ -89,10 +89,13 @@ You can create a client by configuring the necessary environment variables.
|
|
89
89
|
Configuration setup instructions depends on whether you're using the Gemini
|
90
90
|
Developer API or the Gemini API in Vertex AI.
|
91
91
|
|
92
|
-
**Gemini Developer API:** Set `
|
92
|
+
**Gemini Developer API:** Set the `GEMINI_API_KEY` or `GOOGLE_API_KEY`.
|
93
|
+
It will automatically be picked up by the client. It's recommended that you
|
94
|
+
set only one of those variables, but if both are set, `GOOGLE_API_KEY` takes
|
95
|
+
precedence.
|
93
96
|
|
94
97
|
```bash
|
95
|
-
export
|
98
|
+
export GEMINI_API_KEY='your-api-key'
|
96
99
|
```
|
97
100
|
|
98
101
|
**Gemini API on Vertex AI:** Set `GOOGLE_GENAI_USE_VERTEXAI`,
|
@@ -1132,9 +1135,9 @@ response3.generated_images[0].image.show()
|
|
1132
1135
|
|
1133
1136
|
### Veo
|
1134
1137
|
|
1135
|
-
|
1138
|
+
Support for generating videos is considered public preview
|
1136
1139
|
|
1137
|
-
|
1140
|
+
#### Generate Videos (Text to Video)
|
1138
1141
|
|
1139
1142
|
```python
|
1140
1143
|
from google.genai import types
|
@@ -1145,7 +1148,6 @@ operation = client.models.generate_videos(
|
|
1145
1148
|
prompt='A neon hologram of a cat driving at top speed',
|
1146
1149
|
config=types.GenerateVideosConfig(
|
1147
1150
|
number_of_videos=1,
|
1148
|
-
fps=24,
|
1149
1151
|
duration_seconds=5,
|
1150
1152
|
enhance_prompt=True,
|
1151
1153
|
),
|
@@ -1156,7 +1158,73 @@ while not operation.done:
|
|
1156
1158
|
time.sleep(20)
|
1157
1159
|
operation = client.operations.get(operation)
|
1158
1160
|
|
1159
|
-
video = operation.
|
1161
|
+
video = operation.response.generated_videos[0].video
|
1162
|
+
video.show()
|
1163
|
+
```
|
1164
|
+
|
1165
|
+
#### Generate Videos (Image to Video)
|
1166
|
+
|
1167
|
+
```python
|
1168
|
+
from google.genai import types
|
1169
|
+
|
1170
|
+
# Read local image (uses mimetypes.guess_type to infer mime type)
|
1171
|
+
image = types.Image.from_file("local/path/file.png")
|
1172
|
+
|
1173
|
+
# Create operation
|
1174
|
+
operation = client.models.generate_videos(
|
1175
|
+
model='veo-2.0-generate-001',
|
1176
|
+
# Prompt is optional if image is provided
|
1177
|
+
prompt='Night sky',
|
1178
|
+
image=image,
|
1179
|
+
config=types.GenerateVideosConfig(
|
1180
|
+
number_of_videos=1,
|
1181
|
+
duration_seconds=5,
|
1182
|
+
enhance_prompt=True,
|
1183
|
+
# Can also pass an Image into last_frame for frame interpolation
|
1184
|
+
),
|
1185
|
+
)
|
1186
|
+
|
1187
|
+
# Poll operation
|
1188
|
+
while not operation.done:
|
1189
|
+
time.sleep(20)
|
1190
|
+
operation = client.operations.get(operation)
|
1191
|
+
|
1192
|
+
video = operation.response.generated_videos[0].video
|
1193
|
+
video.show()
|
1194
|
+
```
|
1195
|
+
|
1196
|
+
#### Generate Videos (Video to Video)
|
1197
|
+
|
1198
|
+
Currently, only Vertex supports Video to Video generation (Video extension).
|
1199
|
+
|
1200
|
+
```python
|
1201
|
+
from google.genai import types
|
1202
|
+
|
1203
|
+
# Read local video (uses mimetypes.guess_type to infer mime type)
|
1204
|
+
video = types.Video.from_file("local/path/video.mp4")
|
1205
|
+
|
1206
|
+
# Create operation
|
1207
|
+
operation = client.models.generate_videos(
|
1208
|
+
model='veo-2.0-generate-001',
|
1209
|
+
# Prompt is optional if Video is provided
|
1210
|
+
prompt='Night sky',
|
1211
|
+
# Input video must be in GCS
|
1212
|
+
video=types.Video(
|
1213
|
+
uri="gs://bucket-name/inputs/videos/cat_driving.mp4",
|
1214
|
+
),
|
1215
|
+
config=types.GenerateVideosConfig(
|
1216
|
+
number_of_videos=1,
|
1217
|
+
duration_seconds=5,
|
1218
|
+
enhance_prompt=True,
|
1219
|
+
),
|
1220
|
+
)
|
1221
|
+
|
1222
|
+
# Poll operation
|
1223
|
+
while not operation.done:
|
1224
|
+
time.sleep(20)
|
1225
|
+
operation = client.operations.get(operation)
|
1226
|
+
|
1227
|
+
video = operation.response.generated_videos[0].video
|
1160
1228
|
video.show()
|
1161
1229
|
```
|
1162
1230
|
|
@@ -1568,3 +1636,24 @@ except errors.APIError as e:
|
|
1568
1636
|
print(e.code) # 404
|
1569
1637
|
print(e.message)
|
1570
1638
|
```
|
1639
|
+
|
1640
|
+
## Extra Request Body
|
1641
|
+
|
1642
|
+
The `extra_body` field in `HttpOptions` accepts a dictionary of additional JSON
|
1643
|
+
properties to include in the request body. This can be used to access new or
|
1644
|
+
experimental backend features that are not yet formally supported in the SDK.
|
1645
|
+
The structure of the dictionary must match the backend API's request structure.
|
1646
|
+
|
1647
|
+
- VertexAI backend API docs: https://cloud.google.com/vertex-ai/docs/reference/rest
|
1648
|
+
- GeminiAPI backend API docs: https://ai.google.dev/api/rest
|
1649
|
+
|
1650
|
+
```python
|
1651
|
+
response = client.models.generate_content(
|
1652
|
+
model="gemini-2.5-pro",
|
1653
|
+
contents="What is the weather in Boston? and how about Sunnyvale?",
|
1654
|
+
config=types.GenerateContentConfig(
|
1655
|
+
tools=[get_current_weather],
|
1656
|
+
http_options=types.HttpOptions(extra_body={'tool_config': {'function_calling_config': {'mode': 'COMPOSITIONAL'}}}),
|
1657
|
+
),
|
1658
|
+
)
|
1659
|
+
```
|
@@ -0,0 +1,35 @@
|
|
1
|
+
google/genai/__init__.py,sha256=SYTxz3Ho06pP2TBlvDU0FkUJz8ytbR3MgEpS9HvVYq4,709
|
2
|
+
google/genai/_adapters.py,sha256=Kok38miNYJff2n--l0zEK_hbq0y2rWOH7k75J7SMYbQ,1744
|
3
|
+
google/genai/_api_client.py,sha256=X9JVR_XBnedZgkOKbBcvJjMuHupA75XXJkmlrVZqTw0,53102
|
4
|
+
google/genai/_api_module.py,sha256=lj8eUWx8_LBGBz-49qz6_ywWm3GYp3d8Bg5JoOHbtbI,902
|
5
|
+
google/genai/_automatic_function_calling_util.py,sha256=IJkPq2fT9pYxYm5Pbu5-e0nBoZKoZla7yT4_txWRKLs,10324
|
6
|
+
google/genai/_base_url.py,sha256=E5H4dew14Y16qfnB3XRnjSCi19cJVlkaMNoM_8ip-PM,1597
|
7
|
+
google/genai/_common.py,sha256=sJpzeoEJ6dZSPPfHb2Dsar-F5KmpwLjFqNSkxxxVfS8,19876
|
8
|
+
google/genai/_extra_utils.py,sha256=GoIh_SxB5nf_0sjErYkjm8wdg93sfemLKrU_5QhlcBo,20562
|
9
|
+
google/genai/_live_converters.py,sha256=mkxudlXXXAxuK6eWMj_-jVLQs9eOr4EX0GYCBvhIZAw,108962
|
10
|
+
google/genai/_mcp_utils.py,sha256=khECx-DMuHemKzOQQ3msWp7FivPeEOnl3n1lvWc_b5o,3833
|
11
|
+
google/genai/_replay_api_client.py,sha256=2ndavmUMySvjLIdYEvjPZIOPfc-IA5rbWQgEwWuWpfc,21567
|
12
|
+
google/genai/_test_api_client.py,sha256=4ruFIy5_1qcbKqqIBu3HSQbpSOBrxiecBtDZaTGFR1s,4797
|
13
|
+
google/genai/_tokens_converters.py,sha256=jQlwRZU4mlIBv6i8Lu62e6u9dvgNtOnko5WEYnjkU_A,49159
|
14
|
+
google/genai/_transformers.py,sha256=aNWqCQid4ISorbE8nj_ONfrkbQiD75vBFkYCYbXxzHQ,37033
|
15
|
+
google/genai/batches.py,sha256=qnyWQ1RfAdSVQgV7vGor9BIWmRwUilJ0wfqOvxUwpq8,172745
|
16
|
+
google/genai/caches.py,sha256=q8N3YIpgJYWrLWSy-zUZ6w9CPRjH113E8ff4MyykYA8,66169
|
17
|
+
google/genai/chats.py,sha256=0QdOUeWEYDQgAWBy1f7a3z3yY9S8tXSowUzNrzazzj4,16651
|
18
|
+
google/genai/client.py,sha256=wXnfZBSv9p-yKtX_gabUrfBXoYHuqHhzK_VgwRttMgY,10777
|
19
|
+
google/genai/errors.py,sha256=IdSymOuUJDprfPRBhBtFDkc_XX81UvgNbWrOLR8L2GU,5582
|
20
|
+
google/genai/files.py,sha256=MCcHRXiMFKjbnt78yVPejszEgGz_MHRXfJyDi5-07Gs,39655
|
21
|
+
google/genai/live.py,sha256=zkKlSAi378DiAL9iRug8c8zOfqG1BK45u1ttfxrrZqU,39393
|
22
|
+
google/genai/live_music.py,sha256=3GG9nsto8Vhkohcs-4CPMS4DFp1ZtMuLYzHfvEPYAeg,6971
|
23
|
+
google/genai/models.py,sha256=DQx31b43CxVg2YCWHVGGKBzcuB-AfBApmPm9zPVLq6o,239567
|
24
|
+
google/genai/operations.py,sha256=99zs__fTWsyQu7rMGmBI1_4tuAJxLR0g3yp7ymsUsBA,19609
|
25
|
+
google/genai/pagers.py,sha256=nyVYxp92rS-UaewO_oBgP593knofeLU6yOn6RolNoGQ,6797
|
26
|
+
google/genai/py.typed,sha256=RsMFoLwBkAvY05t6izop4UHZtqOPLiKp3GkIEizzmQY,40
|
27
|
+
google/genai/tokens.py,sha256=QGW1jI0Y5wXqiaad0-N6Utgh9sK4TK0todHf5h0GLeI,12490
|
28
|
+
google/genai/tunings.py,sha256=fSiD4RQZI8YsFaPbBoXOIoSDA0BIuJwGg2Ac_uy5_kM,49596
|
29
|
+
google/genai/types.py,sha256=z5NTdkK2-UNZ54VK7fFTmvf1tCJhf_aSQ0d6C-c70mU,470375
|
30
|
+
google/genai/version.py,sha256=Bxlj38TRVWAtzVotucCfIgyEBiHiLWfid2FNcMmGuP4,627
|
31
|
+
google_genai-1.25.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
32
|
+
google_genai-1.25.0.dist-info/METADATA,sha256=X94rtkQYckaADmyC8ULKYLSm2gq3m4shZAYT_tHx3Yk,41566
|
33
|
+
google_genai-1.25.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
34
|
+
google_genai-1.25.0.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
|
35
|
+
google_genai-1.25.0.dist-info/RECORD,,
|
@@ -1,35 +0,0 @@
|
|
1
|
-
google/genai/__init__.py,sha256=SYTxz3Ho06pP2TBlvDU0FkUJz8ytbR3MgEpS9HvVYq4,709
|
2
|
-
google/genai/_adapters.py,sha256=Kok38miNYJff2n--l0zEK_hbq0y2rWOH7k75J7SMYbQ,1744
|
3
|
-
google/genai/_api_client.py,sha256=bbuu6LUCEf6MH-DzhEg-w7iv84SqRy5vIluXDKOn1UU,52447
|
4
|
-
google/genai/_api_module.py,sha256=lj8eUWx8_LBGBz-49qz6_ywWm3GYp3d8Bg5JoOHbtbI,902
|
5
|
-
google/genai/_automatic_function_calling_util.py,sha256=IJkPq2fT9pYxYm5Pbu5-e0nBoZKoZla7yT4_txWRKLs,10324
|
6
|
-
google/genai/_base_url.py,sha256=E5H4dew14Y16qfnB3XRnjSCi19cJVlkaMNoM_8ip-PM,1597
|
7
|
-
google/genai/_common.py,sha256=CuG7wvroFu9kV0Im-asXJGmfbaFCAjCocZyRxYDss5g,19849
|
8
|
-
google/genai/_extra_utils.py,sha256=GoIh_SxB5nf_0sjErYkjm8wdg93sfemLKrU_5QhlcBo,20562
|
9
|
-
google/genai/_live_converters.py,sha256=lbpN5E8DjL74a2XLcgND4pzs3bHDeVpUtPDN8s7IZCU,108613
|
10
|
-
google/genai/_mcp_utils.py,sha256=khECx-DMuHemKzOQQ3msWp7FivPeEOnl3n1lvWc_b5o,3833
|
11
|
-
google/genai/_replay_api_client.py,sha256=0IXroewCZbyZ01qN3ZQwW5OUZRMzCrf2-3nyfTerqNY,21363
|
12
|
-
google/genai/_test_api_client.py,sha256=4ruFIy5_1qcbKqqIBu3HSQbpSOBrxiecBtDZaTGFR1s,4797
|
13
|
-
google/genai/_tokens_converters.py,sha256=LxLZGgSWn6VC2-1R-4ArcuaPK45svg5P-bpC1LjBb3w,48901
|
14
|
-
google/genai/_transformers.py,sha256=Nd_h_zYVOkWN1XTSnM9r3IR7R_qg3tPe2mE9jozaX-Q,36935
|
15
|
-
google/genai/batches.py,sha256=ZpF3qgJUkPcpWjbaJtESiQq5qiZ0obsJl77yCtgZknA,170525
|
16
|
-
google/genai/caches.py,sha256=Ckqqi0osoxNmkqYGvBGpvrZUx19D6hmuwS9UXcnGWmk,65911
|
17
|
-
google/genai/chats.py,sha256=0QdOUeWEYDQgAWBy1f7a3z3yY9S8tXSowUzNrzazzj4,16651
|
18
|
-
google/genai/client.py,sha256=wXnfZBSv9p-yKtX_gabUrfBXoYHuqHhzK_VgwRttMgY,10777
|
19
|
-
google/genai/errors.py,sha256=UebysH1cDeIdtp1O06CW7lQjnNrWtuqZTeVgEJylX48,5589
|
20
|
-
google/genai/files.py,sha256=MCcHRXiMFKjbnt78yVPejszEgGz_MHRXfJyDi5-07Gs,39655
|
21
|
-
google/genai/live.py,sha256=8Vts1bX8ZWOa0PiS3zmYhG1QMhLtBPC_ATLTSAIrazs,38945
|
22
|
-
google/genai/live_music.py,sha256=3GG9nsto8Vhkohcs-4CPMS4DFp1ZtMuLYzHfvEPYAeg,6971
|
23
|
-
google/genai/models.py,sha256=7gBXwg6_RdW_HRD_iRFIAdqu0bkUkW0fAp_PMEPVwoU,239309
|
24
|
-
google/genai/operations.py,sha256=99zs__fTWsyQu7rMGmBI1_4tuAJxLR0g3yp7ymsUsBA,19609
|
25
|
-
google/genai/pagers.py,sha256=nyVYxp92rS-UaewO_oBgP593knofeLU6yOn6RolNoGQ,6797
|
26
|
-
google/genai/py.typed,sha256=RsMFoLwBkAvY05t6izop4UHZtqOPLiKp3GkIEizzmQY,40
|
27
|
-
google/genai/tokens.py,sha256=oew9I0fGuGLlXMdCn2Ot9Lv_herHMnvZOYjjdOz2CAM,12324
|
28
|
-
google/genai/tunings.py,sha256=u6Hcfkc-nUYB_spSfY98h7EIiSz0dH3wVH0b2feMh1M,49072
|
29
|
-
google/genai/types.py,sha256=LGLNmXkmnCLU-narShhG_1rtglfARNm6pvvZOiO5_lA,460023
|
30
|
-
google/genai/version.py,sha256=Snuhu088Fxuibck04VaPaZ69LvJ5pKNdicb9oZYwcrY,627
|
31
|
-
google_genai-1.23.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
32
|
-
google_genai-1.23.0.dist-info/METADATA,sha256=Yylx0cTXrq87K2-VIbM9e1RT80LHMcvUC5ZB8Y0YTqc,38902
|
33
|
-
google_genai-1.23.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
34
|
-
google_genai-1.23.0.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
|
35
|
-
google_genai-1.23.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|