google-genai 1.45.0__py3-none-any.whl → 1.47.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 +47 -17
- google/genai/_extra_utils.py +4 -0
- google/genai/_live_converters.py +66 -61
- google/genai/_tokens_converters.py +47 -47
- google/genai/_transformers.py +10 -1
- google/genai/batches.py +57 -57
- google/genai/caches.py +58 -58
- google/genai/client.py +4 -1
- google/genai/live.py +28 -18
- google/genai/models.py +129 -74
- google/genai/tunings.py +269 -124
- google/genai/types.py +1425 -981
- google/genai/version.py +1 -1
- {google_genai-1.45.0.dist-info → google_genai-1.47.0.dist-info}/METADATA +168 -157
- {google_genai-1.45.0.dist-info → google_genai-1.47.0.dist-info}/RECORD +18 -18
- {google_genai-1.45.0.dist-info → google_genai-1.47.0.dist-info}/WHEEL +0 -0
- {google_genai-1.45.0.dist-info → google_genai-1.47.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.45.0.dist-info → google_genai-1.47.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,16 @@ 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, ['time_range_filter']) is not None:
|
|
1044
|
+
setv(
|
|
1045
|
+
to_object, ['timeRangeFilter'], getv(from_object, ['time_range_filter'])
|
|
1046
|
+
)
|
|
1047
|
+
|
|
1048
1048
|
return to_object
|
|
1049
1049
|
|
|
1050
1050
|
|
|
@@ -1235,19 +1235,19 @@ def _Part_to_mldev(
|
|
|
1235
1235
|
parent_object: Optional[dict[str, Any]] = None,
|
|
1236
1236
|
) -> dict[str, Any]:
|
|
1237
1237
|
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']))
|
|
1238
|
+
if getv(from_object, ['function_call']) is not None:
|
|
1239
|
+
setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
|
|
1243
1240
|
|
|
1244
|
-
if getv(from_object, ['
|
|
1241
|
+
if getv(from_object, ['code_execution_result']) is not None:
|
|
1245
1242
|
setv(
|
|
1246
1243
|
to_object,
|
|
1247
|
-
['
|
|
1248
|
-
|
|
1244
|
+
['codeExecutionResult'],
|
|
1245
|
+
getv(from_object, ['code_execution_result']),
|
|
1249
1246
|
)
|
|
1250
1247
|
|
|
1248
|
+
if getv(from_object, ['executable_code']) is not None:
|
|
1249
|
+
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
|
1250
|
+
|
|
1251
1251
|
if getv(from_object, ['file_data']) is not None:
|
|
1252
1252
|
setv(
|
|
1253
1253
|
to_object,
|
|
@@ -1255,35 +1255,35 @@ def _Part_to_mldev(
|
|
|
1255
1255
|
_FileData_to_mldev(getv(from_object, ['file_data']), to_object),
|
|
1256
1256
|
)
|
|
1257
1257
|
|
|
1258
|
-
if getv(from_object, ['
|
|
1258
|
+
if getv(from_object, ['function_response']) is not None:
|
|
1259
1259
|
setv(
|
|
1260
1260
|
to_object,
|
|
1261
|
-
['
|
|
1262
|
-
getv(from_object, ['
|
|
1261
|
+
['functionResponse'],
|
|
1262
|
+
getv(from_object, ['function_response']),
|
|
1263
1263
|
)
|
|
1264
1264
|
|
|
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:
|
|
1265
|
+
if getv(from_object, ['inline_data']) is not None:
|
|
1269
1266
|
setv(
|
|
1270
1267
|
to_object,
|
|
1271
|
-
['
|
|
1272
|
-
getv(from_object, ['
|
|
1268
|
+
['inlineData'],
|
|
1269
|
+
_Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
|
|
1273
1270
|
)
|
|
1274
1271
|
|
|
1275
|
-
if getv(from_object, ['
|
|
1276
|
-
setv(to_object, ['
|
|
1272
|
+
if getv(from_object, ['text']) is not None:
|
|
1273
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
|
1277
1274
|
|
|
1278
|
-
if getv(from_object, ['
|
|
1275
|
+
if getv(from_object, ['thought']) is not None:
|
|
1276
|
+
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
|
1277
|
+
|
|
1278
|
+
if getv(from_object, ['thought_signature']) is not None:
|
|
1279
1279
|
setv(
|
|
1280
1280
|
to_object,
|
|
1281
|
-
['
|
|
1282
|
-
getv(from_object, ['
|
|
1281
|
+
['thoughtSignature'],
|
|
1282
|
+
getv(from_object, ['thought_signature']),
|
|
1283
1283
|
)
|
|
1284
1284
|
|
|
1285
|
-
if getv(from_object, ['
|
|
1286
|
-
setv(to_object, ['
|
|
1285
|
+
if getv(from_object, ['video_metadata']) is not None:
|
|
1286
|
+
setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
|
|
1287
1287
|
|
|
1288
1288
|
return to_object
|
|
1289
1289
|
|
|
@@ -1293,12 +1293,12 @@ def _SafetySetting_to_mldev(
|
|
|
1293
1293
|
parent_object: Optional[dict[str, Any]] = None,
|
|
1294
1294
|
) -> dict[str, Any]:
|
|
1295
1295
|
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
1296
|
if getv(from_object, ['category']) is not None:
|
|
1300
1297
|
setv(to_object, ['category'], getv(from_object, ['category']))
|
|
1301
1298
|
|
|
1299
|
+
if getv(from_object, ['method']) is not None:
|
|
1300
|
+
raise ValueError('method parameter is not supported in Gemini API.')
|
|
1301
|
+
|
|
1302
1302
|
if getv(from_object, ['threshold']) is not None:
|
|
1303
1303
|
setv(to_object, ['threshold'], getv(from_object, ['threshold']))
|
|
1304
1304
|
|
|
@@ -1320,13 +1320,6 @@ def _Tool_to_mldev(
|
|
|
1320
1320
|
if getv(from_object, ['retrieval']) is not None:
|
|
1321
1321
|
raise ValueError('retrieval parameter is not supported in Gemini API.')
|
|
1322
1322
|
|
|
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
1323
|
if getv(from_object, ['google_search_retrieval']) is not None:
|
|
1331
1324
|
setv(
|
|
1332
1325
|
to_object,
|
|
@@ -1334,11 +1327,6 @@ def _Tool_to_mldev(
|
|
|
1334
1327
|
getv(from_object, ['google_search_retrieval']),
|
|
1335
1328
|
)
|
|
1336
1329
|
|
|
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
1330
|
if getv(from_object, ['google_maps']) is not None:
|
|
1343
1331
|
setv(
|
|
1344
1332
|
to_object,
|
|
@@ -1346,15 +1334,27 @@ def _Tool_to_mldev(
|
|
|
1346
1334
|
_GoogleMaps_to_mldev(getv(from_object, ['google_maps']), to_object),
|
|
1347
1335
|
)
|
|
1348
1336
|
|
|
1349
|
-
if getv(from_object, ['url_context']) is not None:
|
|
1350
|
-
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
|
1351
|
-
|
|
1352
1337
|
if getv(from_object, ['computer_use']) is not None:
|
|
1353
1338
|
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
|
1354
1339
|
|
|
1355
1340
|
if getv(from_object, ['code_execution']) is not None:
|
|
1356
1341
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
|
1357
1342
|
|
|
1343
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
|
1344
|
+
raise ValueError(
|
|
1345
|
+
'enterprise_web_search parameter is not supported in Gemini API.'
|
|
1346
|
+
)
|
|
1347
|
+
|
|
1348
|
+
if getv(from_object, ['google_search']) is not None:
|
|
1349
|
+
setv(
|
|
1350
|
+
to_object,
|
|
1351
|
+
['googleSearch'],
|
|
1352
|
+
_GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
|
|
1353
|
+
)
|
|
1354
|
+
|
|
1355
|
+
if getv(from_object, ['url_context']) is not None:
|
|
1356
|
+
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
|
1357
|
+
|
|
1358
1358
|
return to_object
|
|
1359
1359
|
|
|
1360
1360
|
|
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,16 @@ 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, ['time_range_filter']) is not None:
|
|
390
|
+
setv(
|
|
391
|
+
to_object, ['timeRangeFilter'], getv(from_object, ['time_range_filter'])
|
|
392
|
+
)
|
|
393
|
+
|
|
394
394
|
return to_object
|
|
395
395
|
|
|
396
396
|
|
|
@@ -511,19 +511,19 @@ def _Part_to_mldev(
|
|
|
511
511
|
parent_object: Optional[dict[str, Any]] = None,
|
|
512
512
|
) -> dict[str, Any]:
|
|
513
513
|
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']))
|
|
514
|
+
if getv(from_object, ['function_call']) is not None:
|
|
515
|
+
setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
|
|
519
516
|
|
|
520
|
-
if getv(from_object, ['
|
|
517
|
+
if getv(from_object, ['code_execution_result']) is not None:
|
|
521
518
|
setv(
|
|
522
519
|
to_object,
|
|
523
|
-
['
|
|
524
|
-
|
|
520
|
+
['codeExecutionResult'],
|
|
521
|
+
getv(from_object, ['code_execution_result']),
|
|
525
522
|
)
|
|
526
523
|
|
|
524
|
+
if getv(from_object, ['executable_code']) is not None:
|
|
525
|
+
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
|
526
|
+
|
|
527
527
|
if getv(from_object, ['file_data']) is not None:
|
|
528
528
|
setv(
|
|
529
529
|
to_object,
|
|
@@ -531,35 +531,35 @@ def _Part_to_mldev(
|
|
|
531
531
|
_FileData_to_mldev(getv(from_object, ['file_data']), to_object),
|
|
532
532
|
)
|
|
533
533
|
|
|
534
|
-
if getv(from_object, ['
|
|
534
|
+
if getv(from_object, ['function_response']) is not None:
|
|
535
535
|
setv(
|
|
536
536
|
to_object,
|
|
537
|
-
['
|
|
538
|
-
getv(from_object, ['
|
|
537
|
+
['functionResponse'],
|
|
538
|
+
getv(from_object, ['function_response']),
|
|
539
539
|
)
|
|
540
540
|
|
|
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:
|
|
541
|
+
if getv(from_object, ['inline_data']) is not None:
|
|
545
542
|
setv(
|
|
546
543
|
to_object,
|
|
547
|
-
['
|
|
548
|
-
getv(from_object, ['
|
|
544
|
+
['inlineData'],
|
|
545
|
+
_Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
|
|
549
546
|
)
|
|
550
547
|
|
|
551
|
-
if getv(from_object, ['
|
|
552
|
-
setv(to_object, ['
|
|
548
|
+
if getv(from_object, ['text']) is not None:
|
|
549
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
|
553
550
|
|
|
554
|
-
if getv(from_object, ['
|
|
551
|
+
if getv(from_object, ['thought']) is not None:
|
|
552
|
+
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
|
553
|
+
|
|
554
|
+
if getv(from_object, ['thought_signature']) is not None:
|
|
555
555
|
setv(
|
|
556
556
|
to_object,
|
|
557
|
-
['
|
|
558
|
-
getv(from_object, ['
|
|
557
|
+
['thoughtSignature'],
|
|
558
|
+
getv(from_object, ['thought_signature']),
|
|
559
559
|
)
|
|
560
560
|
|
|
561
|
-
if getv(from_object, ['
|
|
562
|
-
setv(to_object, ['
|
|
561
|
+
if getv(from_object, ['video_metadata']) is not None:
|
|
562
|
+
setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
|
|
563
563
|
|
|
564
564
|
return to_object
|
|
565
565
|
|
|
@@ -579,13 +579,6 @@ def _Tool_to_mldev(
|
|
|
579
579
|
if getv(from_object, ['retrieval']) is not None:
|
|
580
580
|
raise ValueError('retrieval parameter is not supported in Gemini API.')
|
|
581
581
|
|
|
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
582
|
if getv(from_object, ['google_search_retrieval']) is not None:
|
|
590
583
|
setv(
|
|
591
584
|
to_object,
|
|
@@ -593,11 +586,6 @@ def _Tool_to_mldev(
|
|
|
593
586
|
getv(from_object, ['google_search_retrieval']),
|
|
594
587
|
)
|
|
595
588
|
|
|
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
589
|
if getv(from_object, ['google_maps']) is not None:
|
|
602
590
|
setv(
|
|
603
591
|
to_object,
|
|
@@ -605,15 +593,27 @@ def _Tool_to_mldev(
|
|
|
605
593
|
_GoogleMaps_to_mldev(getv(from_object, ['google_maps']), to_object),
|
|
606
594
|
)
|
|
607
595
|
|
|
608
|
-
if getv(from_object, ['url_context']) is not None:
|
|
609
|
-
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
|
610
|
-
|
|
611
596
|
if getv(from_object, ['computer_use']) is not None:
|
|
612
597
|
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
|
613
598
|
|
|
614
599
|
if getv(from_object, ['code_execution']) is not None:
|
|
615
600
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
|
616
601
|
|
|
602
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
|
603
|
+
raise ValueError(
|
|
604
|
+
'enterprise_web_search parameter is not supported in Gemini API.'
|
|
605
|
+
)
|
|
606
|
+
|
|
607
|
+
if getv(from_object, ['google_search']) is not None:
|
|
608
|
+
setv(
|
|
609
|
+
to_object,
|
|
610
|
+
['googleSearch'],
|
|
611
|
+
_GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
|
|
612
|
+
)
|
|
613
|
+
|
|
614
|
+
if getv(from_object, ['url_context']) is not None:
|
|
615
|
+
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
|
616
|
+
|
|
617
617
|
return to_object
|
|
618
618
|
|
|
619
619
|
|
|
@@ -635,9 +635,6 @@ def _Tool_to_vertex(
|
|
|
635
635
|
if getv(from_object, ['retrieval']) is not None:
|
|
636
636
|
setv(to_object, ['retrieval'], getv(from_object, ['retrieval']))
|
|
637
637
|
|
|
638
|
-
if getv(from_object, ['google_search']) is not None:
|
|
639
|
-
setv(to_object, ['googleSearch'], getv(from_object, ['google_search']))
|
|
640
|
-
|
|
641
638
|
if getv(from_object, ['google_search_retrieval']) is not None:
|
|
642
639
|
setv(
|
|
643
640
|
to_object,
|
|
@@ -645,6 +642,15 @@ def _Tool_to_vertex(
|
|
|
645
642
|
getv(from_object, ['google_search_retrieval']),
|
|
646
643
|
)
|
|
647
644
|
|
|
645
|
+
if getv(from_object, ['google_maps']) is not None:
|
|
646
|
+
setv(to_object, ['googleMaps'], getv(from_object, ['google_maps']))
|
|
647
|
+
|
|
648
|
+
if getv(from_object, ['computer_use']) is not None:
|
|
649
|
+
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
|
650
|
+
|
|
651
|
+
if getv(from_object, ['code_execution']) is not None:
|
|
652
|
+
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
|
653
|
+
|
|
648
654
|
if getv(from_object, ['enterprise_web_search']) is not None:
|
|
649
655
|
setv(
|
|
650
656
|
to_object,
|
|
@@ -652,18 +658,12 @@ def _Tool_to_vertex(
|
|
|
652
658
|
getv(from_object, ['enterprise_web_search']),
|
|
653
659
|
)
|
|
654
660
|
|
|
655
|
-
if getv(from_object, ['
|
|
656
|
-
setv(to_object, ['
|
|
661
|
+
if getv(from_object, ['google_search']) is not None:
|
|
662
|
+
setv(to_object, ['googleSearch'], getv(from_object, ['google_search']))
|
|
657
663
|
|
|
658
664
|
if getv(from_object, ['url_context']) is not None:
|
|
659
665
|
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
|
660
666
|
|
|
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
667
|
return to_object
|
|
668
668
|
|
|
669
669
|
|
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:
|