google-genai 1.13.0__py3-none-any.whl → 1.15.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 +80 -34
- google/genai/_automatic_function_calling_util.py +1 -1
- google/genai/_live_converters.py +334 -14
- google/genai/caches.py +304 -6
- google/genai/models.py +415 -12
- google/genai/tunings.py +53 -0
- google/genai/types.py +622 -118
- google/genai/version.py +1 -1
- {google_genai-1.13.0.dist-info → google_genai-1.15.0.dist-info}/METADATA +106 -19
- {google_genai-1.13.0.dist-info → google_genai-1.15.0.dist-info}/RECORD +13 -13
- {google_genai-1.13.0.dist-info → google_genai-1.15.0.dist-info}/WHEEL +1 -1
- {google_genai-1.13.0.dist-info → google_genai-1.15.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.13.0.dist-info → google_genai-1.15.0.dist-info}/top_level.txt +0 -0
google/genai/models.py
CHANGED
@@ -31,6 +31,24 @@ from .pagers import AsyncPager, Pager
|
|
31
31
|
logger = logging.getLogger('google_genai.models')
|
32
32
|
|
33
33
|
|
34
|
+
def _Blob_to_mldev(
|
35
|
+
api_client: BaseApiClient,
|
36
|
+
from_object: Union[dict[str, Any], object],
|
37
|
+
parent_object: Optional[dict[str, Any]] = None,
|
38
|
+
) -> dict[str, Any]:
|
39
|
+
to_object: dict[str, Any] = {}
|
40
|
+
if getv(from_object, ['display_name']) is not None:
|
41
|
+
raise ValueError('display_name parameter is not supported in Gemini API.')
|
42
|
+
|
43
|
+
if getv(from_object, ['data']) is not None:
|
44
|
+
setv(to_object, ['data'], getv(from_object, ['data']))
|
45
|
+
|
46
|
+
if getv(from_object, ['mime_type']) is not None:
|
47
|
+
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
48
|
+
|
49
|
+
return to_object
|
50
|
+
|
51
|
+
|
34
52
|
def _Part_to_mldev(
|
35
53
|
api_client: BaseApiClient,
|
36
54
|
from_object: Union[dict[str, Any], object],
|
@@ -43,6 +61,15 @@ def _Part_to_mldev(
|
|
43
61
|
if getv(from_object, ['thought']) is not None:
|
44
62
|
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
45
63
|
|
64
|
+
if getv(from_object, ['inline_data']) is not None:
|
65
|
+
setv(
|
66
|
+
to_object,
|
67
|
+
['inlineData'],
|
68
|
+
_Blob_to_mldev(
|
69
|
+
api_client, getv(from_object, ['inline_data']), to_object
|
70
|
+
),
|
71
|
+
)
|
72
|
+
|
46
73
|
if getv(from_object, ['code_execution_result']) is not None:
|
47
74
|
setv(
|
48
75
|
to_object,
|
@@ -66,9 +93,6 @@ def _Part_to_mldev(
|
|
66
93
|
getv(from_object, ['function_response']),
|
67
94
|
)
|
68
95
|
|
69
|
-
if getv(from_object, ['inline_data']) is not None:
|
70
|
-
setv(to_object, ['inlineData'], getv(from_object, ['inline_data']))
|
71
|
-
|
72
96
|
if getv(from_object, ['text']) is not None:
|
73
97
|
setv(to_object, ['text'], getv(from_object, ['text']))
|
74
98
|
|
@@ -178,6 +202,75 @@ def _GoogleSearchRetrieval_to_mldev(
|
|
178
202
|
return to_object
|
179
203
|
|
180
204
|
|
205
|
+
def _EnterpriseWebSearch_to_mldev(
|
206
|
+
api_client: BaseApiClient,
|
207
|
+
from_object: Union[dict[str, Any], object],
|
208
|
+
parent_object: Optional[dict[str, Any]] = None,
|
209
|
+
) -> dict[str, Any]:
|
210
|
+
to_object: dict[str, Any] = {}
|
211
|
+
|
212
|
+
return to_object
|
213
|
+
|
214
|
+
|
215
|
+
def _ApiKeyConfig_to_mldev(
|
216
|
+
api_client: BaseApiClient,
|
217
|
+
from_object: Union[dict[str, Any], object],
|
218
|
+
parent_object: Optional[dict[str, Any]] = None,
|
219
|
+
) -> dict[str, Any]:
|
220
|
+
to_object: dict[str, Any] = {}
|
221
|
+
if getv(from_object, ['api_key_string']) is not None:
|
222
|
+
raise ValueError('api_key_string parameter is not supported in Gemini API.')
|
223
|
+
|
224
|
+
return to_object
|
225
|
+
|
226
|
+
|
227
|
+
def _AuthConfig_to_mldev(
|
228
|
+
api_client: BaseApiClient,
|
229
|
+
from_object: Union[dict[str, Any], object],
|
230
|
+
parent_object: Optional[dict[str, Any]] = None,
|
231
|
+
) -> dict[str, Any]:
|
232
|
+
to_object: dict[str, Any] = {}
|
233
|
+
if getv(from_object, ['api_key_config']) is not None:
|
234
|
+
raise ValueError('api_key_config parameter is not supported in Gemini API.')
|
235
|
+
|
236
|
+
if getv(from_object, ['auth_type']) is not None:
|
237
|
+
setv(to_object, ['authType'], getv(from_object, ['auth_type']))
|
238
|
+
|
239
|
+
if getv(from_object, ['google_service_account_config']) is not None:
|
240
|
+
setv(
|
241
|
+
to_object,
|
242
|
+
['googleServiceAccountConfig'],
|
243
|
+
getv(from_object, ['google_service_account_config']),
|
244
|
+
)
|
245
|
+
|
246
|
+
if getv(from_object, ['http_basic_auth_config']) is not None:
|
247
|
+
setv(
|
248
|
+
to_object,
|
249
|
+
['httpBasicAuthConfig'],
|
250
|
+
getv(from_object, ['http_basic_auth_config']),
|
251
|
+
)
|
252
|
+
|
253
|
+
if getv(from_object, ['oauth_config']) is not None:
|
254
|
+
setv(to_object, ['oauthConfig'], getv(from_object, ['oauth_config']))
|
255
|
+
|
256
|
+
if getv(from_object, ['oidc_config']) is not None:
|
257
|
+
setv(to_object, ['oidcConfig'], getv(from_object, ['oidc_config']))
|
258
|
+
|
259
|
+
return to_object
|
260
|
+
|
261
|
+
|
262
|
+
def _GoogleMaps_to_mldev(
|
263
|
+
api_client: BaseApiClient,
|
264
|
+
from_object: Union[dict[str, Any], object],
|
265
|
+
parent_object: Optional[dict[str, Any]] = None,
|
266
|
+
) -> dict[str, Any]:
|
267
|
+
to_object: dict[str, Any] = {}
|
268
|
+
if getv(from_object, ['auth_config']) is not None:
|
269
|
+
raise ValueError('auth_config parameter is not supported in Gemini API.')
|
270
|
+
|
271
|
+
return to_object
|
272
|
+
|
273
|
+
|
181
274
|
def _Tool_to_mldev(
|
182
275
|
api_client: BaseApiClient,
|
183
276
|
from_object: Union[dict[str, Any], object],
|
@@ -207,6 +300,14 @@ def _Tool_to_mldev(
|
|
207
300
|
),
|
208
301
|
)
|
209
302
|
|
303
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
304
|
+
raise ValueError(
|
305
|
+
'enterprise_web_search parameter is not supported in Gemini API.'
|
306
|
+
)
|
307
|
+
|
308
|
+
if getv(from_object, ['google_maps']) is not None:
|
309
|
+
raise ValueError('google_maps parameter is not supported in Gemini API.')
|
310
|
+
|
210
311
|
if getv(from_object, ['code_execution']) is not None:
|
211
312
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
212
313
|
|
@@ -239,6 +340,33 @@ def _FunctionCallingConfig_to_mldev(
|
|
239
340
|
return to_object
|
240
341
|
|
241
342
|
|
343
|
+
def _LatLng_to_mldev(
|
344
|
+
api_client: BaseApiClient,
|
345
|
+
from_object: Union[dict[str, Any], object],
|
346
|
+
parent_object: Optional[dict[str, Any]] = None,
|
347
|
+
) -> dict[str, Any]:
|
348
|
+
to_object: dict[str, Any] = {}
|
349
|
+
if getv(from_object, ['latitude']) is not None:
|
350
|
+
raise ValueError('latitude parameter is not supported in Gemini API.')
|
351
|
+
|
352
|
+
if getv(from_object, ['longitude']) is not None:
|
353
|
+
raise ValueError('longitude parameter is not supported in Gemini API.')
|
354
|
+
|
355
|
+
return to_object
|
356
|
+
|
357
|
+
|
358
|
+
def _RetrievalConfig_to_mldev(
|
359
|
+
api_client: BaseApiClient,
|
360
|
+
from_object: Union[dict[str, Any], object],
|
361
|
+
parent_object: Optional[dict[str, Any]] = None,
|
362
|
+
) -> dict[str, Any]:
|
363
|
+
to_object: dict[str, Any] = {}
|
364
|
+
if getv(from_object, ['lat_lng']) is not None:
|
365
|
+
raise ValueError('lat_lng parameter is not supported in Gemini API.')
|
366
|
+
|
367
|
+
return to_object
|
368
|
+
|
369
|
+
|
242
370
|
def _ToolConfig_to_mldev(
|
243
371
|
api_client: BaseApiClient,
|
244
372
|
from_object: Union[dict[str, Any], object],
|
@@ -256,6 +384,11 @@ def _ToolConfig_to_mldev(
|
|
256
384
|
),
|
257
385
|
)
|
258
386
|
|
387
|
+
if getv(from_object, ['retrieval_config']) is not None:
|
388
|
+
raise ValueError(
|
389
|
+
'retrieval_config parameter is not supported in Gemini API.'
|
390
|
+
)
|
391
|
+
|
259
392
|
return to_object
|
260
393
|
|
261
394
|
|
@@ -813,6 +946,13 @@ def _UpdateModelConfig_to_mldev(
|
|
813
946
|
if getv(from_object, ['description']) is not None:
|
814
947
|
setv(parent_object, ['description'], getv(from_object, ['description']))
|
815
948
|
|
949
|
+
if getv(from_object, ['default_checkpoint_id']) is not None:
|
950
|
+
setv(
|
951
|
+
parent_object,
|
952
|
+
['defaultCheckpointId'],
|
953
|
+
getv(from_object, ['default_checkpoint_id']),
|
954
|
+
)
|
955
|
+
|
816
956
|
return to_object
|
817
957
|
|
818
958
|
|
@@ -1040,6 +1180,24 @@ def _GenerateVideosParameters_to_mldev(
|
|
1040
1180
|
return to_object
|
1041
1181
|
|
1042
1182
|
|
1183
|
+
def _Blob_to_vertex(
|
1184
|
+
api_client: BaseApiClient,
|
1185
|
+
from_object: Union[dict[str, Any], object],
|
1186
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1187
|
+
) -> dict[str, Any]:
|
1188
|
+
to_object: dict[str, Any] = {}
|
1189
|
+
if getv(from_object, ['display_name']) is not None:
|
1190
|
+
setv(to_object, ['displayName'], getv(from_object, ['display_name']))
|
1191
|
+
|
1192
|
+
if getv(from_object, ['data']) is not None:
|
1193
|
+
setv(to_object, ['data'], getv(from_object, ['data']))
|
1194
|
+
|
1195
|
+
if getv(from_object, ['mime_type']) is not None:
|
1196
|
+
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
1197
|
+
|
1198
|
+
return to_object
|
1199
|
+
|
1200
|
+
|
1043
1201
|
def _Part_to_vertex(
|
1044
1202
|
api_client: BaseApiClient,
|
1045
1203
|
from_object: Union[dict[str, Any], object],
|
@@ -1052,6 +1210,15 @@ def _Part_to_vertex(
|
|
1052
1210
|
if getv(from_object, ['thought']) is not None:
|
1053
1211
|
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
1054
1212
|
|
1213
|
+
if getv(from_object, ['inline_data']) is not None:
|
1214
|
+
setv(
|
1215
|
+
to_object,
|
1216
|
+
['inlineData'],
|
1217
|
+
_Blob_to_vertex(
|
1218
|
+
api_client, getv(from_object, ['inline_data']), to_object
|
1219
|
+
),
|
1220
|
+
)
|
1221
|
+
|
1055
1222
|
if getv(from_object, ['code_execution_result']) is not None:
|
1056
1223
|
setv(
|
1057
1224
|
to_object,
|
@@ -1075,9 +1242,6 @@ def _Part_to_vertex(
|
|
1075
1242
|
getv(from_object, ['function_response']),
|
1076
1243
|
)
|
1077
1244
|
|
1078
|
-
if getv(from_object, ['inline_data']) is not None:
|
1079
|
-
setv(to_object, ['inlineData'], getv(from_object, ['inline_data']))
|
1080
|
-
|
1081
1245
|
if getv(from_object, ['text']) is not None:
|
1082
1246
|
setv(to_object, ['text'], getv(from_object, ['text']))
|
1083
1247
|
|
@@ -1189,6 +1353,87 @@ def _GoogleSearchRetrieval_to_vertex(
|
|
1189
1353
|
return to_object
|
1190
1354
|
|
1191
1355
|
|
1356
|
+
def _EnterpriseWebSearch_to_vertex(
|
1357
|
+
api_client: BaseApiClient,
|
1358
|
+
from_object: Union[dict[str, Any], object],
|
1359
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1360
|
+
) -> dict[str, Any]:
|
1361
|
+
to_object: dict[str, Any] = {}
|
1362
|
+
|
1363
|
+
return to_object
|
1364
|
+
|
1365
|
+
|
1366
|
+
def _ApiKeyConfig_to_vertex(
|
1367
|
+
api_client: BaseApiClient,
|
1368
|
+
from_object: Union[dict[str, Any], object],
|
1369
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1370
|
+
) -> dict[str, Any]:
|
1371
|
+
to_object: dict[str, Any] = {}
|
1372
|
+
if getv(from_object, ['api_key_string']) is not None:
|
1373
|
+
setv(to_object, ['apiKeyString'], getv(from_object, ['api_key_string']))
|
1374
|
+
|
1375
|
+
return to_object
|
1376
|
+
|
1377
|
+
|
1378
|
+
def _AuthConfig_to_vertex(
|
1379
|
+
api_client: BaseApiClient,
|
1380
|
+
from_object: Union[dict[str, Any], object],
|
1381
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1382
|
+
) -> dict[str, Any]:
|
1383
|
+
to_object: dict[str, Any] = {}
|
1384
|
+
if getv(from_object, ['api_key_config']) is not None:
|
1385
|
+
setv(
|
1386
|
+
to_object,
|
1387
|
+
['apiKeyConfig'],
|
1388
|
+
_ApiKeyConfig_to_vertex(
|
1389
|
+
api_client, getv(from_object, ['api_key_config']), to_object
|
1390
|
+
),
|
1391
|
+
)
|
1392
|
+
|
1393
|
+
if getv(from_object, ['auth_type']) is not None:
|
1394
|
+
setv(to_object, ['authType'], getv(from_object, ['auth_type']))
|
1395
|
+
|
1396
|
+
if getv(from_object, ['google_service_account_config']) is not None:
|
1397
|
+
setv(
|
1398
|
+
to_object,
|
1399
|
+
['googleServiceAccountConfig'],
|
1400
|
+
getv(from_object, ['google_service_account_config']),
|
1401
|
+
)
|
1402
|
+
|
1403
|
+
if getv(from_object, ['http_basic_auth_config']) is not None:
|
1404
|
+
setv(
|
1405
|
+
to_object,
|
1406
|
+
['httpBasicAuthConfig'],
|
1407
|
+
getv(from_object, ['http_basic_auth_config']),
|
1408
|
+
)
|
1409
|
+
|
1410
|
+
if getv(from_object, ['oauth_config']) is not None:
|
1411
|
+
setv(to_object, ['oauthConfig'], getv(from_object, ['oauth_config']))
|
1412
|
+
|
1413
|
+
if getv(from_object, ['oidc_config']) is not None:
|
1414
|
+
setv(to_object, ['oidcConfig'], getv(from_object, ['oidc_config']))
|
1415
|
+
|
1416
|
+
return to_object
|
1417
|
+
|
1418
|
+
|
1419
|
+
def _GoogleMaps_to_vertex(
|
1420
|
+
api_client: BaseApiClient,
|
1421
|
+
from_object: Union[dict[str, Any], object],
|
1422
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1423
|
+
) -> dict[str, Any]:
|
1424
|
+
to_object: dict[str, Any] = {}
|
1425
|
+
if getv(from_object, ['auth_config']) is not None:
|
1426
|
+
setv(
|
1427
|
+
to_object,
|
1428
|
+
['authConfig'],
|
1429
|
+
_AuthConfig_to_vertex(
|
1430
|
+
api_client, getv(from_object, ['auth_config']), to_object
|
1431
|
+
),
|
1432
|
+
)
|
1433
|
+
|
1434
|
+
return to_object
|
1435
|
+
|
1436
|
+
|
1192
1437
|
def _Tool_to_vertex(
|
1193
1438
|
api_client: BaseApiClient,
|
1194
1439
|
from_object: Union[dict[str, Any], object],
|
@@ -1218,6 +1463,24 @@ def _Tool_to_vertex(
|
|
1218
1463
|
),
|
1219
1464
|
)
|
1220
1465
|
|
1466
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
1467
|
+
setv(
|
1468
|
+
to_object,
|
1469
|
+
['enterpriseWebSearch'],
|
1470
|
+
_EnterpriseWebSearch_to_vertex(
|
1471
|
+
api_client, getv(from_object, ['enterprise_web_search']), to_object
|
1472
|
+
),
|
1473
|
+
)
|
1474
|
+
|
1475
|
+
if getv(from_object, ['google_maps']) is not None:
|
1476
|
+
setv(
|
1477
|
+
to_object,
|
1478
|
+
['googleMaps'],
|
1479
|
+
_GoogleMaps_to_vertex(
|
1480
|
+
api_client, getv(from_object, ['google_maps']), to_object
|
1481
|
+
),
|
1482
|
+
)
|
1483
|
+
|
1221
1484
|
if getv(from_object, ['code_execution']) is not None:
|
1222
1485
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
1223
1486
|
|
@@ -1250,6 +1513,39 @@ def _FunctionCallingConfig_to_vertex(
|
|
1250
1513
|
return to_object
|
1251
1514
|
|
1252
1515
|
|
1516
|
+
def _LatLng_to_vertex(
|
1517
|
+
api_client: BaseApiClient,
|
1518
|
+
from_object: Union[dict[str, Any], object],
|
1519
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1520
|
+
) -> dict[str, Any]:
|
1521
|
+
to_object: dict[str, Any] = {}
|
1522
|
+
if getv(from_object, ['latitude']) is not None:
|
1523
|
+
setv(to_object, ['latitude'], getv(from_object, ['latitude']))
|
1524
|
+
|
1525
|
+
if getv(from_object, ['longitude']) is not None:
|
1526
|
+
setv(to_object, ['longitude'], getv(from_object, ['longitude']))
|
1527
|
+
|
1528
|
+
return to_object
|
1529
|
+
|
1530
|
+
|
1531
|
+
def _RetrievalConfig_to_vertex(
|
1532
|
+
api_client: BaseApiClient,
|
1533
|
+
from_object: Union[dict[str, Any], object],
|
1534
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1535
|
+
) -> dict[str, Any]:
|
1536
|
+
to_object: dict[str, Any] = {}
|
1537
|
+
if getv(from_object, ['lat_lng']) is not None:
|
1538
|
+
setv(
|
1539
|
+
to_object,
|
1540
|
+
['latLng'],
|
1541
|
+
_LatLng_to_vertex(
|
1542
|
+
api_client, getv(from_object, ['lat_lng']), to_object
|
1543
|
+
),
|
1544
|
+
)
|
1545
|
+
|
1546
|
+
return to_object
|
1547
|
+
|
1548
|
+
|
1253
1549
|
def _ToolConfig_to_vertex(
|
1254
1550
|
api_client: BaseApiClient,
|
1255
1551
|
from_object: Union[dict[str, Any], object],
|
@@ -1267,6 +1563,15 @@ def _ToolConfig_to_vertex(
|
|
1267
1563
|
),
|
1268
1564
|
)
|
1269
1565
|
|
1566
|
+
if getv(from_object, ['retrieval_config']) is not None:
|
1567
|
+
setv(
|
1568
|
+
to_object,
|
1569
|
+
['retrievalConfig'],
|
1570
|
+
_RetrievalConfig_to_vertex(
|
1571
|
+
api_client, getv(from_object, ['retrieval_config']), to_object
|
1572
|
+
),
|
1573
|
+
)
|
1574
|
+
|
1270
1575
|
return to_object
|
1271
1576
|
|
1272
1577
|
|
@@ -2222,6 +2527,13 @@ def _UpdateModelConfig_to_vertex(
|
|
2222
2527
|
if getv(from_object, ['description']) is not None:
|
2223
2528
|
setv(parent_object, ['description'], getv(from_object, ['description']))
|
2224
2529
|
|
2530
|
+
if getv(from_object, ['default_checkpoint_id']) is not None:
|
2531
|
+
setv(
|
2532
|
+
parent_object,
|
2533
|
+
['defaultCheckpointId'],
|
2534
|
+
getv(from_object, ['default_checkpoint_id']),
|
2535
|
+
)
|
2536
|
+
|
2225
2537
|
return to_object
|
2226
2538
|
|
2227
2539
|
|
@@ -2509,6 +2821,22 @@ def _PersonGeneration_to_mldev_enum_validate(enum_value: Any) -> None:
|
|
2509
2821
|
raise ValueError(f'{enum_value} enum value is not supported in Gemini API.')
|
2510
2822
|
|
2511
2823
|
|
2824
|
+
def _Blob_from_mldev(
|
2825
|
+
api_client: BaseApiClient,
|
2826
|
+
from_object: Union[dict[str, Any], object],
|
2827
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2828
|
+
) -> dict[str, Any]:
|
2829
|
+
to_object: dict[str, Any] = {}
|
2830
|
+
|
2831
|
+
if getv(from_object, ['data']) is not None:
|
2832
|
+
setv(to_object, ['data'], getv(from_object, ['data']))
|
2833
|
+
|
2834
|
+
if getv(from_object, ['mimeType']) is not None:
|
2835
|
+
setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
|
2836
|
+
|
2837
|
+
return to_object
|
2838
|
+
|
2839
|
+
|
2512
2840
|
def _Part_from_mldev(
|
2513
2841
|
api_client: BaseApiClient,
|
2514
2842
|
from_object: Union[dict[str, Any], object],
|
@@ -2519,6 +2847,15 @@ def _Part_from_mldev(
|
|
2519
2847
|
if getv(from_object, ['thought']) is not None:
|
2520
2848
|
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
2521
2849
|
|
2850
|
+
if getv(from_object, ['inlineData']) is not None:
|
2851
|
+
setv(
|
2852
|
+
to_object,
|
2853
|
+
['inline_data'],
|
2854
|
+
_Blob_from_mldev(
|
2855
|
+
api_client, getv(from_object, ['inlineData']), to_object
|
2856
|
+
),
|
2857
|
+
)
|
2858
|
+
|
2522
2859
|
if getv(from_object, ['codeExecutionResult']) is not None:
|
2523
2860
|
setv(
|
2524
2861
|
to_object,
|
@@ -2542,9 +2879,6 @@ def _Part_from_mldev(
|
|
2542
2879
|
getv(from_object, ['functionResponse']),
|
2543
2880
|
)
|
2544
2881
|
|
2545
|
-
if getv(from_object, ['inlineData']) is not None:
|
2546
|
-
setv(to_object, ['inline_data'], getv(from_object, ['inlineData']))
|
2547
|
-
|
2548
2882
|
if getv(from_object, ['text']) is not None:
|
2549
2883
|
setv(to_object, ['text'], getv(from_object, ['text']))
|
2550
2884
|
|
@@ -2859,6 +3193,16 @@ def _TunedModelInfo_from_mldev(
|
|
2859
3193
|
return to_object
|
2860
3194
|
|
2861
3195
|
|
3196
|
+
def _Checkpoint_from_mldev(
|
3197
|
+
api_client: BaseApiClient,
|
3198
|
+
from_object: Union[dict[str, Any], object],
|
3199
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3200
|
+
) -> dict[str, Any]:
|
3201
|
+
to_object: dict[str, Any] = {}
|
3202
|
+
|
3203
|
+
return to_object
|
3204
|
+
|
3205
|
+
|
2862
3206
|
def _Model_from_mldev(
|
2863
3207
|
api_client: BaseApiClient,
|
2864
3208
|
from_object: Union[dict[str, Any], object],
|
@@ -3075,6 +3419,24 @@ def _GenerateVideosOperation_from_mldev(
|
|
3075
3419
|
return to_object
|
3076
3420
|
|
3077
3421
|
|
3422
|
+
def _Blob_from_vertex(
|
3423
|
+
api_client: BaseApiClient,
|
3424
|
+
from_object: Union[dict[str, Any], object],
|
3425
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3426
|
+
) -> dict[str, Any]:
|
3427
|
+
to_object: dict[str, Any] = {}
|
3428
|
+
if getv(from_object, ['displayName']) is not None:
|
3429
|
+
setv(to_object, ['display_name'], getv(from_object, ['displayName']))
|
3430
|
+
|
3431
|
+
if getv(from_object, ['data']) is not None:
|
3432
|
+
setv(to_object, ['data'], getv(from_object, ['data']))
|
3433
|
+
|
3434
|
+
if getv(from_object, ['mimeType']) is not None:
|
3435
|
+
setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
|
3436
|
+
|
3437
|
+
return to_object
|
3438
|
+
|
3439
|
+
|
3078
3440
|
def _Part_from_vertex(
|
3079
3441
|
api_client: BaseApiClient,
|
3080
3442
|
from_object: Union[dict[str, Any], object],
|
@@ -3087,6 +3449,15 @@ def _Part_from_vertex(
|
|
3087
3449
|
if getv(from_object, ['thought']) is not None:
|
3088
3450
|
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
3089
3451
|
|
3452
|
+
if getv(from_object, ['inlineData']) is not None:
|
3453
|
+
setv(
|
3454
|
+
to_object,
|
3455
|
+
['inline_data'],
|
3456
|
+
_Blob_from_vertex(
|
3457
|
+
api_client, getv(from_object, ['inlineData']), to_object
|
3458
|
+
),
|
3459
|
+
)
|
3460
|
+
|
3090
3461
|
if getv(from_object, ['codeExecutionResult']) is not None:
|
3091
3462
|
setv(
|
3092
3463
|
to_object,
|
@@ -3110,9 +3481,6 @@ def _Part_from_vertex(
|
|
3110
3481
|
getv(from_object, ['functionResponse']),
|
3111
3482
|
)
|
3112
3483
|
|
3113
|
-
if getv(from_object, ['inlineData']) is not None:
|
3114
|
-
setv(to_object, ['inline_data'], getv(from_object, ['inlineData']))
|
3115
|
-
|
3116
3484
|
if getv(from_object, ['text']) is not None:
|
3117
3485
|
setv(to_object, ['text'], getv(from_object, ['text']))
|
3118
3486
|
|
@@ -3510,6 +3878,24 @@ def _TunedModelInfo_from_vertex(
|
|
3510
3878
|
return to_object
|
3511
3879
|
|
3512
3880
|
|
3881
|
+
def _Checkpoint_from_vertex(
|
3882
|
+
api_client: BaseApiClient,
|
3883
|
+
from_object: Union[dict[str, Any], object],
|
3884
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3885
|
+
) -> dict[str, Any]:
|
3886
|
+
to_object: dict[str, Any] = {}
|
3887
|
+
if getv(from_object, ['checkpointId']) is not None:
|
3888
|
+
setv(to_object, ['checkpoint_id'], getv(from_object, ['checkpointId']))
|
3889
|
+
|
3890
|
+
if getv(from_object, ['epoch']) is not None:
|
3891
|
+
setv(to_object, ['epoch'], getv(from_object, ['epoch']))
|
3892
|
+
|
3893
|
+
if getv(from_object, ['step']) is not None:
|
3894
|
+
setv(to_object, ['step'], getv(from_object, ['step']))
|
3895
|
+
|
3896
|
+
return to_object
|
3897
|
+
|
3898
|
+
|
3513
3899
|
def _Model_from_vertex(
|
3514
3900
|
api_client: BaseApiClient,
|
3515
3901
|
from_object: Union[dict[str, Any], object],
|
@@ -3550,6 +3936,23 @@ def _Model_from_vertex(
|
|
3550
3936
|
),
|
3551
3937
|
)
|
3552
3938
|
|
3939
|
+
if getv(from_object, ['defaultCheckpointId']) is not None:
|
3940
|
+
setv(
|
3941
|
+
to_object,
|
3942
|
+
['default_checkpoint_id'],
|
3943
|
+
getv(from_object, ['defaultCheckpointId']),
|
3944
|
+
)
|
3945
|
+
|
3946
|
+
if getv(from_object, ['checkpoints']) is not None:
|
3947
|
+
setv(
|
3948
|
+
to_object,
|
3949
|
+
['checkpoints'],
|
3950
|
+
[
|
3951
|
+
_Checkpoint_from_vertex(api_client, item, to_object)
|
3952
|
+
for item in getv(from_object, ['checkpoints'])
|
3953
|
+
],
|
3954
|
+
)
|
3955
|
+
|
3553
3956
|
return to_object
|
3554
3957
|
|
3555
3958
|
|
google/genai/tunings.py
CHANGED
@@ -173,6 +173,11 @@ def _CreateTuningJobConfig_to_mldev(
|
|
173
173
|
getv(from_object, ['learning_rate_multiplier']),
|
174
174
|
)
|
175
175
|
|
176
|
+
if getv(from_object, ['export_last_checkpoint_only']) is not None:
|
177
|
+
raise ValueError(
|
178
|
+
'export_last_checkpoint_only parameter is not supported in Gemini API.'
|
179
|
+
)
|
180
|
+
|
176
181
|
if getv(from_object, ['adapter_size']) is not None:
|
177
182
|
raise ValueError('adapter_size parameter is not supported in Gemini API.')
|
178
183
|
|
@@ -367,6 +372,13 @@ def _CreateTuningJobConfig_to_vertex(
|
|
367
372
|
getv(from_object, ['learning_rate_multiplier']),
|
368
373
|
)
|
369
374
|
|
375
|
+
if getv(from_object, ['export_last_checkpoint_only']) is not None:
|
376
|
+
setv(
|
377
|
+
parent_object,
|
378
|
+
['supervisedTuningSpec', 'exportLastCheckpointOnly'],
|
379
|
+
getv(from_object, ['export_last_checkpoint_only']),
|
380
|
+
)
|
381
|
+
|
370
382
|
if getv(from_object, ['adapter_size']) is not None:
|
371
383
|
setv(
|
372
384
|
parent_object,
|
@@ -413,6 +425,16 @@ def _CreateTuningJobParameters_to_vertex(
|
|
413
425
|
return to_object
|
414
426
|
|
415
427
|
|
428
|
+
def _TunedModelCheckpoint_from_mldev(
|
429
|
+
api_client: BaseApiClient,
|
430
|
+
from_object: Union[dict[str, Any], object],
|
431
|
+
parent_object: Optional[dict[str, Any]] = None,
|
432
|
+
) -> dict[str, Any]:
|
433
|
+
to_object: dict[str, Any] = {}
|
434
|
+
|
435
|
+
return to_object
|
436
|
+
|
437
|
+
|
416
438
|
def _TunedModel_from_mldev(
|
417
439
|
api_client: BaseApiClient,
|
418
440
|
from_object: Union[dict[str, Any], object],
|
@@ -548,6 +570,27 @@ def _Operation_from_mldev(
|
|
548
570
|
return to_object
|
549
571
|
|
550
572
|
|
573
|
+
def _TunedModelCheckpoint_from_vertex(
|
574
|
+
api_client: BaseApiClient,
|
575
|
+
from_object: Union[dict[str, Any], object],
|
576
|
+
parent_object: Optional[dict[str, Any]] = None,
|
577
|
+
) -> dict[str, Any]:
|
578
|
+
to_object: dict[str, Any] = {}
|
579
|
+
if getv(from_object, ['checkpointId']) is not None:
|
580
|
+
setv(to_object, ['checkpoint_id'], getv(from_object, ['checkpointId']))
|
581
|
+
|
582
|
+
if getv(from_object, ['epoch']) is not None:
|
583
|
+
setv(to_object, ['epoch'], getv(from_object, ['epoch']))
|
584
|
+
|
585
|
+
if getv(from_object, ['step']) is not None:
|
586
|
+
setv(to_object, ['step'], getv(from_object, ['step']))
|
587
|
+
|
588
|
+
if getv(from_object, ['endpoint']) is not None:
|
589
|
+
setv(to_object, ['endpoint'], getv(from_object, ['endpoint']))
|
590
|
+
|
591
|
+
return to_object
|
592
|
+
|
593
|
+
|
551
594
|
def _TunedModel_from_vertex(
|
552
595
|
api_client: BaseApiClient,
|
553
596
|
from_object: Union[dict[str, Any], object],
|
@@ -560,6 +603,16 @@ def _TunedModel_from_vertex(
|
|
560
603
|
if getv(from_object, ['endpoint']) is not None:
|
561
604
|
setv(to_object, ['endpoint'], getv(from_object, ['endpoint']))
|
562
605
|
|
606
|
+
if getv(from_object, ['checkpoints']) is not None:
|
607
|
+
setv(
|
608
|
+
to_object,
|
609
|
+
['checkpoints'],
|
610
|
+
[
|
611
|
+
_TunedModelCheckpoint_from_vertex(api_client, item, to_object)
|
612
|
+
for item in getv(from_object, ['checkpoints'])
|
613
|
+
],
|
614
|
+
)
|
615
|
+
|
563
616
|
return to_object
|
564
617
|
|
565
618
|
|