google-genai 1.46.0__py3-none-any.whl → 1.48.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 +38 -15
- google/genai/_extra_utils.py +40 -3
- google/genai/_live_converters.py +66 -61
- google/genai/_tokens_converters.py +52 -47
- google/genai/_transformers.py +10 -1
- google/genai/batches.py +62 -57
- google/genai/caches.py +63 -58
- google/genai/client.py +4 -1
- google/genai/live.py +28 -18
- google/genai/models.py +205 -77
- google/genai/tunings.py +269 -94
- google/genai/types.py +1441 -1012
- google/genai/version.py +1 -1
- {google_genai-1.46.0.dist-info → google_genai-1.48.0.dist-info}/METADATA +152 -163
- {google_genai-1.46.0.dist-info → google_genai-1.48.0.dist-info}/RECORD +18 -18
- {google_genai-1.46.0.dist-info → google_genai-1.48.0.dist-info}/WHEEL +0 -0
- {google_genai-1.46.0.dist-info → google_genai-1.48.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.46.0.dist-info → google_genai-1.48.0.dist-info}/top_level.txt +0 -0
google/genai/batches.py
CHANGED
|
@@ -336,12 +336,12 @@ def _Blob_to_mldev(
|
|
|
336
336
|
parent_object: Optional[dict[str, Any]] = None,
|
|
337
337
|
) -> dict[str, Any]:
|
|
338
338
|
to_object: dict[str, Any] = {}
|
|
339
|
-
if getv(from_object, ['display_name']) is not None:
|
|
340
|
-
raise ValueError('display_name parameter is not supported in Gemini API.')
|
|
341
|
-
|
|
342
339
|
if getv(from_object, ['data']) is not None:
|
|
343
340
|
setv(to_object, ['data'], getv(from_object, ['data']))
|
|
344
341
|
|
|
342
|
+
if getv(from_object, ['display_name']) is not None:
|
|
343
|
+
raise ValueError('display_name parameter is not supported in Gemini API.')
|
|
344
|
+
|
|
345
345
|
if getv(from_object, ['mime_type']) is not None:
|
|
346
346
|
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
|
347
347
|
|
|
@@ -403,13 +403,6 @@ def _Candidate_from_mldev(
|
|
|
403
403
|
if getv(from_object, ['finishReason']) is not None:
|
|
404
404
|
setv(to_object, ['finish_reason'], getv(from_object, ['finishReason']))
|
|
405
405
|
|
|
406
|
-
if getv(from_object, ['urlContextMetadata']) is not None:
|
|
407
|
-
setv(
|
|
408
|
-
to_object,
|
|
409
|
-
['url_context_metadata'],
|
|
410
|
-
getv(from_object, ['urlContextMetadata']),
|
|
411
|
-
)
|
|
412
|
-
|
|
413
406
|
if getv(from_object, ['avgLogprobs']) is not None:
|
|
414
407
|
setv(to_object, ['avg_logprobs'], getv(from_object, ['avgLogprobs']))
|
|
415
408
|
|
|
@@ -433,6 +426,13 @@ def _Candidate_from_mldev(
|
|
|
433
426
|
[item for item in getv(from_object, ['safetyRatings'])],
|
|
434
427
|
)
|
|
435
428
|
|
|
429
|
+
if getv(from_object, ['urlContextMetadata']) is not None:
|
|
430
|
+
setv(
|
|
431
|
+
to_object,
|
|
432
|
+
['url_context_metadata'],
|
|
433
|
+
getv(from_object, ['urlContextMetadata']),
|
|
434
|
+
)
|
|
435
|
+
|
|
436
436
|
return to_object
|
|
437
437
|
|
|
438
438
|
|
|
@@ -1035,16 +1035,21 @@ def _GoogleSearch_to_mldev(
|
|
|
1035
1035
|
parent_object: Optional[dict[str, Any]] = None,
|
|
1036
1036
|
) -> dict[str, Any]:
|
|
1037
1037
|
to_object: dict[str, Any] = {}
|
|
1038
|
-
if getv(from_object, ['time_range_filter']) is not None:
|
|
1039
|
-
setv(
|
|
1040
|
-
to_object, ['timeRangeFilter'], getv(from_object, ['time_range_filter'])
|
|
1041
|
-
)
|
|
1042
|
-
|
|
1043
1038
|
if getv(from_object, ['exclude_domains']) is not None:
|
|
1044
1039
|
raise ValueError(
|
|
1045
1040
|
'exclude_domains parameter is not supported in Gemini API.'
|
|
1046
1041
|
)
|
|
1047
1042
|
|
|
1043
|
+
if getv(from_object, ['blocking_confidence']) is not None:
|
|
1044
|
+
raise ValueError(
|
|
1045
|
+
'blocking_confidence parameter is not supported in Gemini API.'
|
|
1046
|
+
)
|
|
1047
|
+
|
|
1048
|
+
if getv(from_object, ['time_range_filter']) is not None:
|
|
1049
|
+
setv(
|
|
1050
|
+
to_object, ['timeRangeFilter'], getv(from_object, ['time_range_filter'])
|
|
1051
|
+
)
|
|
1052
|
+
|
|
1048
1053
|
return to_object
|
|
1049
1054
|
|
|
1050
1055
|
|
|
@@ -1235,19 +1240,19 @@ def _Part_to_mldev(
|
|
|
1235
1240
|
parent_object: Optional[dict[str, Any]] = None,
|
|
1236
1241
|
) -> dict[str, Any]:
|
|
1237
1242
|
to_object: dict[str, Any] = {}
|
|
1238
|
-
if getv(from_object, ['
|
|
1239
|
-
setv(to_object, ['
|
|
1240
|
-
|
|
1241
|
-
if getv(from_object, ['thought']) is not None:
|
|
1242
|
-
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
|
1243
|
+
if getv(from_object, ['function_call']) is not None:
|
|
1244
|
+
setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
|
|
1243
1245
|
|
|
1244
|
-
if getv(from_object, ['
|
|
1246
|
+
if getv(from_object, ['code_execution_result']) is not None:
|
|
1245
1247
|
setv(
|
|
1246
1248
|
to_object,
|
|
1247
|
-
['
|
|
1248
|
-
|
|
1249
|
+
['codeExecutionResult'],
|
|
1250
|
+
getv(from_object, ['code_execution_result']),
|
|
1249
1251
|
)
|
|
1250
1252
|
|
|
1253
|
+
if getv(from_object, ['executable_code']) is not None:
|
|
1254
|
+
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
|
1255
|
+
|
|
1251
1256
|
if getv(from_object, ['file_data']) is not None:
|
|
1252
1257
|
setv(
|
|
1253
1258
|
to_object,
|
|
@@ -1255,35 +1260,35 @@ def _Part_to_mldev(
|
|
|
1255
1260
|
_FileData_to_mldev(getv(from_object, ['file_data']), to_object),
|
|
1256
1261
|
)
|
|
1257
1262
|
|
|
1258
|
-
if getv(from_object, ['
|
|
1263
|
+
if getv(from_object, ['function_response']) is not None:
|
|
1259
1264
|
setv(
|
|
1260
1265
|
to_object,
|
|
1261
|
-
['
|
|
1262
|
-
getv(from_object, ['
|
|
1266
|
+
['functionResponse'],
|
|
1267
|
+
getv(from_object, ['function_response']),
|
|
1263
1268
|
)
|
|
1264
1269
|
|
|
1265
|
-
if getv(from_object, ['
|
|
1266
|
-
setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
|
|
1267
|
-
|
|
1268
|
-
if getv(from_object, ['code_execution_result']) is not None:
|
|
1270
|
+
if getv(from_object, ['inline_data']) is not None:
|
|
1269
1271
|
setv(
|
|
1270
1272
|
to_object,
|
|
1271
|
-
['
|
|
1272
|
-
getv(from_object, ['
|
|
1273
|
+
['inlineData'],
|
|
1274
|
+
_Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
|
|
1273
1275
|
)
|
|
1274
1276
|
|
|
1275
|
-
if getv(from_object, ['
|
|
1276
|
-
setv(to_object, ['
|
|
1277
|
+
if getv(from_object, ['text']) is not None:
|
|
1278
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
|
1277
1279
|
|
|
1278
|
-
if getv(from_object, ['
|
|
1280
|
+
if getv(from_object, ['thought']) is not None:
|
|
1281
|
+
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
|
1282
|
+
|
|
1283
|
+
if getv(from_object, ['thought_signature']) is not None:
|
|
1279
1284
|
setv(
|
|
1280
1285
|
to_object,
|
|
1281
|
-
['
|
|
1282
|
-
getv(from_object, ['
|
|
1286
|
+
['thoughtSignature'],
|
|
1287
|
+
getv(from_object, ['thought_signature']),
|
|
1283
1288
|
)
|
|
1284
1289
|
|
|
1285
|
-
if getv(from_object, ['
|
|
1286
|
-
setv(to_object, ['
|
|
1290
|
+
if getv(from_object, ['video_metadata']) is not None:
|
|
1291
|
+
setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
|
|
1287
1292
|
|
|
1288
1293
|
return to_object
|
|
1289
1294
|
|
|
@@ -1293,12 +1298,12 @@ def _SafetySetting_to_mldev(
|
|
|
1293
1298
|
parent_object: Optional[dict[str, Any]] = None,
|
|
1294
1299
|
) -> dict[str, Any]:
|
|
1295
1300
|
to_object: dict[str, Any] = {}
|
|
1296
|
-
if getv(from_object, ['method']) is not None:
|
|
1297
|
-
raise ValueError('method parameter is not supported in Gemini API.')
|
|
1298
|
-
|
|
1299
1301
|
if getv(from_object, ['category']) is not None:
|
|
1300
1302
|
setv(to_object, ['category'], getv(from_object, ['category']))
|
|
1301
1303
|
|
|
1304
|
+
if getv(from_object, ['method']) is not None:
|
|
1305
|
+
raise ValueError('method parameter is not supported in Gemini API.')
|
|
1306
|
+
|
|
1302
1307
|
if getv(from_object, ['threshold']) is not None:
|
|
1303
1308
|
setv(to_object, ['threshold'], getv(from_object, ['threshold']))
|
|
1304
1309
|
|
|
@@ -1320,13 +1325,6 @@ def _Tool_to_mldev(
|
|
|
1320
1325
|
if getv(from_object, ['retrieval']) is not None:
|
|
1321
1326
|
raise ValueError('retrieval parameter is not supported in Gemini API.')
|
|
1322
1327
|
|
|
1323
|
-
if getv(from_object, ['google_search']) is not None:
|
|
1324
|
-
setv(
|
|
1325
|
-
to_object,
|
|
1326
|
-
['googleSearch'],
|
|
1327
|
-
_GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
|
|
1328
|
-
)
|
|
1329
|
-
|
|
1330
1328
|
if getv(from_object, ['google_search_retrieval']) is not None:
|
|
1331
1329
|
setv(
|
|
1332
1330
|
to_object,
|
|
@@ -1334,11 +1332,6 @@ def _Tool_to_mldev(
|
|
|
1334
1332
|
getv(from_object, ['google_search_retrieval']),
|
|
1335
1333
|
)
|
|
1336
1334
|
|
|
1337
|
-
if getv(from_object, ['enterprise_web_search']) is not None:
|
|
1338
|
-
raise ValueError(
|
|
1339
|
-
'enterprise_web_search parameter is not supported in Gemini API.'
|
|
1340
|
-
)
|
|
1341
|
-
|
|
1342
1335
|
if getv(from_object, ['google_maps']) is not None:
|
|
1343
1336
|
setv(
|
|
1344
1337
|
to_object,
|
|
@@ -1346,15 +1339,27 @@ def _Tool_to_mldev(
|
|
|
1346
1339
|
_GoogleMaps_to_mldev(getv(from_object, ['google_maps']), to_object),
|
|
1347
1340
|
)
|
|
1348
1341
|
|
|
1349
|
-
if getv(from_object, ['url_context']) is not None:
|
|
1350
|
-
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
|
1351
|
-
|
|
1352
1342
|
if getv(from_object, ['computer_use']) is not None:
|
|
1353
1343
|
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
|
1354
1344
|
|
|
1355
1345
|
if getv(from_object, ['code_execution']) is not None:
|
|
1356
1346
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
|
1357
1347
|
|
|
1348
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
|
1349
|
+
raise ValueError(
|
|
1350
|
+
'enterprise_web_search parameter is not supported in Gemini API.'
|
|
1351
|
+
)
|
|
1352
|
+
|
|
1353
|
+
if getv(from_object, ['google_search']) is not None:
|
|
1354
|
+
setv(
|
|
1355
|
+
to_object,
|
|
1356
|
+
['googleSearch'],
|
|
1357
|
+
_GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
|
|
1358
|
+
)
|
|
1359
|
+
|
|
1360
|
+
if getv(from_object, ['url_context']) is not None:
|
|
1361
|
+
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
|
1362
|
+
|
|
1358
1363
|
return to_object
|
|
1359
1364
|
|
|
1360
1365
|
|
google/genai/caches.py
CHANGED
|
@@ -38,12 +38,12 @@ def _Blob_to_mldev(
|
|
|
38
38
|
parent_object: Optional[dict[str, Any]] = None,
|
|
39
39
|
) -> dict[str, Any]:
|
|
40
40
|
to_object: dict[str, Any] = {}
|
|
41
|
-
if getv(from_object, ['display_name']) is not None:
|
|
42
|
-
raise ValueError('display_name parameter is not supported in Gemini API.')
|
|
43
|
-
|
|
44
41
|
if getv(from_object, ['data']) is not None:
|
|
45
42
|
setv(to_object, ['data'], getv(from_object, ['data']))
|
|
46
43
|
|
|
44
|
+
if getv(from_object, ['display_name']) is not None:
|
|
45
|
+
raise ValueError('display_name parameter is not supported in Gemini API.')
|
|
46
|
+
|
|
47
47
|
if getv(from_object, ['mime_type']) is not None:
|
|
48
48
|
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
|
49
49
|
|
|
@@ -381,16 +381,21 @@ def _GoogleSearch_to_mldev(
|
|
|
381
381
|
parent_object: Optional[dict[str, Any]] = None,
|
|
382
382
|
) -> dict[str, Any]:
|
|
383
383
|
to_object: dict[str, Any] = {}
|
|
384
|
-
if getv(from_object, ['time_range_filter']) is not None:
|
|
385
|
-
setv(
|
|
386
|
-
to_object, ['timeRangeFilter'], getv(from_object, ['time_range_filter'])
|
|
387
|
-
)
|
|
388
|
-
|
|
389
384
|
if getv(from_object, ['exclude_domains']) is not None:
|
|
390
385
|
raise ValueError(
|
|
391
386
|
'exclude_domains parameter is not supported in Gemini API.'
|
|
392
387
|
)
|
|
393
388
|
|
|
389
|
+
if getv(from_object, ['blocking_confidence']) is not None:
|
|
390
|
+
raise ValueError(
|
|
391
|
+
'blocking_confidence parameter is not supported in Gemini API.'
|
|
392
|
+
)
|
|
393
|
+
|
|
394
|
+
if getv(from_object, ['time_range_filter']) is not None:
|
|
395
|
+
setv(
|
|
396
|
+
to_object, ['timeRangeFilter'], getv(from_object, ['time_range_filter'])
|
|
397
|
+
)
|
|
398
|
+
|
|
394
399
|
return to_object
|
|
395
400
|
|
|
396
401
|
|
|
@@ -511,19 +516,19 @@ def _Part_to_mldev(
|
|
|
511
516
|
parent_object: Optional[dict[str, Any]] = None,
|
|
512
517
|
) -> dict[str, Any]:
|
|
513
518
|
to_object: dict[str, Any] = {}
|
|
514
|
-
if getv(from_object, ['
|
|
515
|
-
setv(to_object, ['
|
|
516
|
-
|
|
517
|
-
if getv(from_object, ['thought']) is not None:
|
|
518
|
-
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
|
519
|
+
if getv(from_object, ['function_call']) is not None:
|
|
520
|
+
setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
|
|
519
521
|
|
|
520
|
-
if getv(from_object, ['
|
|
522
|
+
if getv(from_object, ['code_execution_result']) is not None:
|
|
521
523
|
setv(
|
|
522
524
|
to_object,
|
|
523
|
-
['
|
|
524
|
-
|
|
525
|
+
['codeExecutionResult'],
|
|
526
|
+
getv(from_object, ['code_execution_result']),
|
|
525
527
|
)
|
|
526
528
|
|
|
529
|
+
if getv(from_object, ['executable_code']) is not None:
|
|
530
|
+
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
|
531
|
+
|
|
527
532
|
if getv(from_object, ['file_data']) is not None:
|
|
528
533
|
setv(
|
|
529
534
|
to_object,
|
|
@@ -531,35 +536,35 @@ def _Part_to_mldev(
|
|
|
531
536
|
_FileData_to_mldev(getv(from_object, ['file_data']), to_object),
|
|
532
537
|
)
|
|
533
538
|
|
|
534
|
-
if getv(from_object, ['
|
|
539
|
+
if getv(from_object, ['function_response']) is not None:
|
|
535
540
|
setv(
|
|
536
541
|
to_object,
|
|
537
|
-
['
|
|
538
|
-
getv(from_object, ['
|
|
542
|
+
['functionResponse'],
|
|
543
|
+
getv(from_object, ['function_response']),
|
|
539
544
|
)
|
|
540
545
|
|
|
541
|
-
if getv(from_object, ['
|
|
542
|
-
setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
|
|
543
|
-
|
|
544
|
-
if getv(from_object, ['code_execution_result']) is not None:
|
|
546
|
+
if getv(from_object, ['inline_data']) is not None:
|
|
545
547
|
setv(
|
|
546
548
|
to_object,
|
|
547
|
-
['
|
|
548
|
-
getv(from_object, ['
|
|
549
|
+
['inlineData'],
|
|
550
|
+
_Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
|
|
549
551
|
)
|
|
550
552
|
|
|
551
|
-
if getv(from_object, ['
|
|
552
|
-
setv(to_object, ['
|
|
553
|
+
if getv(from_object, ['text']) is not None:
|
|
554
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
|
553
555
|
|
|
554
|
-
if getv(from_object, ['
|
|
556
|
+
if getv(from_object, ['thought']) is not None:
|
|
557
|
+
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
|
558
|
+
|
|
559
|
+
if getv(from_object, ['thought_signature']) is not None:
|
|
555
560
|
setv(
|
|
556
561
|
to_object,
|
|
557
|
-
['
|
|
558
|
-
getv(from_object, ['
|
|
562
|
+
['thoughtSignature'],
|
|
563
|
+
getv(from_object, ['thought_signature']),
|
|
559
564
|
)
|
|
560
565
|
|
|
561
|
-
if getv(from_object, ['
|
|
562
|
-
setv(to_object, ['
|
|
566
|
+
if getv(from_object, ['video_metadata']) is not None:
|
|
567
|
+
setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
|
|
563
568
|
|
|
564
569
|
return to_object
|
|
565
570
|
|
|
@@ -579,13 +584,6 @@ def _Tool_to_mldev(
|
|
|
579
584
|
if getv(from_object, ['retrieval']) is not None:
|
|
580
585
|
raise ValueError('retrieval parameter is not supported in Gemini API.')
|
|
581
586
|
|
|
582
|
-
if getv(from_object, ['google_search']) is not None:
|
|
583
|
-
setv(
|
|
584
|
-
to_object,
|
|
585
|
-
['googleSearch'],
|
|
586
|
-
_GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
|
|
587
|
-
)
|
|
588
|
-
|
|
589
587
|
if getv(from_object, ['google_search_retrieval']) is not None:
|
|
590
588
|
setv(
|
|
591
589
|
to_object,
|
|
@@ -593,11 +591,6 @@ def _Tool_to_mldev(
|
|
|
593
591
|
getv(from_object, ['google_search_retrieval']),
|
|
594
592
|
)
|
|
595
593
|
|
|
596
|
-
if getv(from_object, ['enterprise_web_search']) is not None:
|
|
597
|
-
raise ValueError(
|
|
598
|
-
'enterprise_web_search parameter is not supported in Gemini API.'
|
|
599
|
-
)
|
|
600
|
-
|
|
601
594
|
if getv(from_object, ['google_maps']) is not None:
|
|
602
595
|
setv(
|
|
603
596
|
to_object,
|
|
@@ -605,15 +598,27 @@ def _Tool_to_mldev(
|
|
|
605
598
|
_GoogleMaps_to_mldev(getv(from_object, ['google_maps']), to_object),
|
|
606
599
|
)
|
|
607
600
|
|
|
608
|
-
if getv(from_object, ['url_context']) is not None:
|
|
609
|
-
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
|
610
|
-
|
|
611
601
|
if getv(from_object, ['computer_use']) is not None:
|
|
612
602
|
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
|
613
603
|
|
|
614
604
|
if getv(from_object, ['code_execution']) is not None:
|
|
615
605
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
|
616
606
|
|
|
607
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
|
608
|
+
raise ValueError(
|
|
609
|
+
'enterprise_web_search parameter is not supported in Gemini API.'
|
|
610
|
+
)
|
|
611
|
+
|
|
612
|
+
if getv(from_object, ['google_search']) is not None:
|
|
613
|
+
setv(
|
|
614
|
+
to_object,
|
|
615
|
+
['googleSearch'],
|
|
616
|
+
_GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
|
|
617
|
+
)
|
|
618
|
+
|
|
619
|
+
if getv(from_object, ['url_context']) is not None:
|
|
620
|
+
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
|
621
|
+
|
|
617
622
|
return to_object
|
|
618
623
|
|
|
619
624
|
|
|
@@ -635,9 +640,6 @@ def _Tool_to_vertex(
|
|
|
635
640
|
if getv(from_object, ['retrieval']) is not None:
|
|
636
641
|
setv(to_object, ['retrieval'], getv(from_object, ['retrieval']))
|
|
637
642
|
|
|
638
|
-
if getv(from_object, ['google_search']) is not None:
|
|
639
|
-
setv(to_object, ['googleSearch'], getv(from_object, ['google_search']))
|
|
640
|
-
|
|
641
643
|
if getv(from_object, ['google_search_retrieval']) is not None:
|
|
642
644
|
setv(
|
|
643
645
|
to_object,
|
|
@@ -645,6 +647,15 @@ def _Tool_to_vertex(
|
|
|
645
647
|
getv(from_object, ['google_search_retrieval']),
|
|
646
648
|
)
|
|
647
649
|
|
|
650
|
+
if getv(from_object, ['google_maps']) is not None:
|
|
651
|
+
setv(to_object, ['googleMaps'], getv(from_object, ['google_maps']))
|
|
652
|
+
|
|
653
|
+
if getv(from_object, ['computer_use']) is not None:
|
|
654
|
+
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
|
655
|
+
|
|
656
|
+
if getv(from_object, ['code_execution']) is not None:
|
|
657
|
+
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
|
658
|
+
|
|
648
659
|
if getv(from_object, ['enterprise_web_search']) is not None:
|
|
649
660
|
setv(
|
|
650
661
|
to_object,
|
|
@@ -652,18 +663,12 @@ def _Tool_to_vertex(
|
|
|
652
663
|
getv(from_object, ['enterprise_web_search']),
|
|
653
664
|
)
|
|
654
665
|
|
|
655
|
-
if getv(from_object, ['
|
|
656
|
-
setv(to_object, ['
|
|
666
|
+
if getv(from_object, ['google_search']) is not None:
|
|
667
|
+
setv(to_object, ['googleSearch'], getv(from_object, ['google_search']))
|
|
657
668
|
|
|
658
669
|
if getv(from_object, ['url_context']) is not None:
|
|
659
670
|
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
|
660
671
|
|
|
661
|
-
if getv(from_object, ['computer_use']) is not None:
|
|
662
|
-
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
|
663
|
-
|
|
664
|
-
if getv(from_object, ['code_execution']) is not None:
|
|
665
|
-
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
|
666
|
-
|
|
667
672
|
return to_object
|
|
668
673
|
|
|
669
674
|
|
google/genai/client.py
CHANGED
google/genai/live.py
CHANGED
|
@@ -998,25 +998,7 @@ class AsyncLive(_api_module.BaseModule):
|
|
|
998
998
|
|
|
999
999
|
request = json.dumps(request_dict)
|
|
1000
1000
|
else:
|
|
1001
|
-
if not self._api_client._credentials:
|
|
1002
|
-
# Get bearer token through Application Default Credentials.
|
|
1003
|
-
creds, _ = google.auth.default( # type: ignore
|
|
1004
|
-
scopes=['https://www.googleapis.com/auth/cloud-platform']
|
|
1005
|
-
)
|
|
1006
|
-
else:
|
|
1007
|
-
creds = self._api_client._credentials
|
|
1008
|
-
# creds.valid is False, and creds.token is None
|
|
1009
|
-
# Need to refresh credentials to populate those
|
|
1010
|
-
if not (creds.token and creds.valid):
|
|
1011
|
-
auth_req = google.auth.transport.requests.Request() # type: ignore
|
|
1012
|
-
creds.refresh(auth_req)
|
|
1013
|
-
bearer_token = creds.token
|
|
1014
|
-
original_headers = self._api_client._http_options.headers
|
|
1015
|
-
headers = original_headers.copy() if original_headers is not None else {}
|
|
1016
|
-
if not headers.get('Authorization'):
|
|
1017
|
-
headers['Authorization'] = f'Bearer {bearer_token}'
|
|
1018
1001
|
version = self._api_client._http_options.api_version
|
|
1019
|
-
|
|
1020
1002
|
has_sufficient_auth = (
|
|
1021
1003
|
self._api_client.project and self._api_client.location
|
|
1022
1004
|
)
|
|
@@ -1026,8 +1008,36 @@ class AsyncLive(_api_module.BaseModule):
|
|
|
1026
1008
|
uri = self._api_client.custom_base_url
|
|
1027
1009
|
# Keep the model as is.
|
|
1028
1010
|
transformed_model = model
|
|
1011
|
+
# Do not get credentials for custom url.
|
|
1012
|
+
original_headers = self._api_client._http_options.headers
|
|
1013
|
+
headers = (
|
|
1014
|
+
original_headers.copy() if original_headers is not None else {}
|
|
1015
|
+
)
|
|
1016
|
+
|
|
1029
1017
|
else:
|
|
1030
1018
|
uri = f'{base_url}/ws/google.cloud.aiplatform.{version}.LlmBidiService/BidiGenerateContent'
|
|
1019
|
+
|
|
1020
|
+
if not self._api_client._credentials:
|
|
1021
|
+
# Get bearer token through Application Default Credentials.
|
|
1022
|
+
creds, _ = google.auth.default( # type: ignore
|
|
1023
|
+
scopes=['https://www.googleapis.com/auth/cloud-platform']
|
|
1024
|
+
)
|
|
1025
|
+
else:
|
|
1026
|
+
creds = self._api_client._credentials
|
|
1027
|
+
# creds.valid is False, and creds.token is None
|
|
1028
|
+
# Need to refresh credentials to populate those
|
|
1029
|
+
if not (creds.token and creds.valid):
|
|
1030
|
+
auth_req = google.auth.transport.requests.Request() # type: ignore
|
|
1031
|
+
creds.refresh(auth_req)
|
|
1032
|
+
bearer_token = creds.token
|
|
1033
|
+
|
|
1034
|
+
original_headers = self._api_client._http_options.headers
|
|
1035
|
+
headers = (
|
|
1036
|
+
original_headers.copy() if original_headers is not None else {}
|
|
1037
|
+
)
|
|
1038
|
+
if not headers.get('Authorization'):
|
|
1039
|
+
headers['Authorization'] = f'Bearer {bearer_token}'
|
|
1040
|
+
|
|
1031
1041
|
location = self._api_client.location
|
|
1032
1042
|
project = self._api_client.project
|
|
1033
1043
|
if transformed_model.startswith('publishers/') and project and location:
|