google-genai 1.41.0__py3-none-any.whl → 1.43.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 +2 -1
- google/genai/_common.py +213 -77
- google/genai/_live_converters.py +717 -3098
- google/genai/_replay_api_client.py +9 -5
- google/genai/_tokens_converters.py +23 -434
- google/genai/_transformers.py +42 -12
- google/genai/batches.py +125 -1054
- google/genai/caches.py +69 -847
- google/genai/errors.py +9 -2
- google/genai/files.py +12 -171
- google/genai/live.py +10 -11
- google/genai/live_music.py +24 -27
- google/genai/models.py +333 -1828
- google/genai/operations.py +6 -32
- google/genai/tokens.py +2 -12
- google/genai/tunings.py +18 -197
- google/genai/types.py +154 -3
- google/genai/version.py +1 -1
- {google_genai-1.41.0.dist-info → google_genai-1.43.0.dist-info}/METADATA +40 -38
- google_genai-1.43.0.dist-info/RECORD +39 -0
- google_genai-1.41.0.dist-info/RECORD +0 -39
- {google_genai-1.41.0.dist-info → google_genai-1.43.0.dist-info}/WHEEL +0 -0
- {google_genai-1.41.0.dist-info → google_genai-1.43.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.41.0.dist-info → google_genai-1.43.0.dist-info}/top_level.txt +0 -0
@@ -138,7 +138,7 @@ def _redact_request_url(url: str) -> str:
|
|
138
138
|
result,
|
139
139
|
)
|
140
140
|
result = re.sub(
|
141
|
-
r'
|
141
|
+
r'.*generativelanguage.*.googleapis.com/[^/]+',
|
142
142
|
'{MLDEV_URL_PREFIX}',
|
143
143
|
result,
|
144
144
|
)
|
@@ -395,6 +395,8 @@ class ReplayApiClient(BaseApiClient):
|
|
395
395
|
http_request: HttpRequest,
|
396
396
|
interaction: ReplayInteraction,
|
397
397
|
) -> None:
|
398
|
+
_debug_print(f'http_request.url: {http_request.url}')
|
399
|
+
_debug_print(f'interaction.request.url: {interaction.request.url}')
|
398
400
|
assert http_request.url == interaction.request.url
|
399
401
|
assert http_request.headers == interaction.request.headers, (
|
400
402
|
'Request headers mismatch:\n'
|
@@ -467,7 +469,9 @@ class ReplayApiClient(BaseApiClient):
|
|
467
469
|
|
468
470
|
if isinstance(response_model, list):
|
469
471
|
response_model = response_model[0]
|
470
|
-
|
472
|
+
_debug_print(
|
473
|
+
f'response_model: {response_model.model_dump(exclude_none=True)}'
|
474
|
+
)
|
471
475
|
actual = response_model.model_dump(exclude_none=True, mode='json')
|
472
476
|
expected = interaction.response.sdk_response_segments[
|
473
477
|
self._sdk_response_index
|
@@ -480,8 +484,8 @@ class ReplayApiClient(BaseApiClient):
|
|
480
484
|
):
|
481
485
|
if 'body' in expected['sdk_http_response']:
|
482
486
|
raw_body = expected['sdk_http_response']['body']
|
483
|
-
|
484
|
-
|
487
|
+
_debug_print(f'raw_body length: {len(raw_body)}')
|
488
|
+
_debug_print(f'raw_body: {raw_body}')
|
485
489
|
if isinstance(raw_body, str) and raw_body != '':
|
486
490
|
raw_body = json.loads(raw_body)
|
487
491
|
raw_body = json.dumps(raw_body)
|
@@ -491,7 +495,7 @@ class ReplayApiClient(BaseApiClient):
|
|
491
495
|
actual == expected
|
492
496
|
), f'SDK response mismatch:\nActual: {actual}\nExpected: {expected}'
|
493
497
|
else:
|
494
|
-
|
498
|
+
_debug_print(f'Expected SDK response mismatch:\nActual: {actual}\nExpected: {expected}')
|
495
499
|
self._sdk_response_index += 1
|
496
500
|
|
497
501
|
def _request(
|
@@ -23,72 +23,6 @@ from ._common import get_value_by_path as getv
|
|
23
23
|
from ._common import set_value_by_path as setv
|
24
24
|
|
25
25
|
|
26
|
-
def _AudioTranscriptionConfig_to_mldev(
|
27
|
-
from_object: Union[dict[str, Any], object],
|
28
|
-
parent_object: Optional[dict[str, Any]] = None,
|
29
|
-
) -> dict[str, Any]:
|
30
|
-
to_object: dict[str, Any] = {}
|
31
|
-
|
32
|
-
return to_object
|
33
|
-
|
34
|
-
|
35
|
-
def _AuthToken_from_mldev(
|
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, ['name']) is not None:
|
41
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
42
|
-
|
43
|
-
return to_object
|
44
|
-
|
45
|
-
|
46
|
-
def _AuthToken_from_vertex(
|
47
|
-
from_object: Union[dict[str, Any], object],
|
48
|
-
parent_object: Optional[dict[str, Any]] = None,
|
49
|
-
) -> dict[str, Any]:
|
50
|
-
to_object: dict[str, Any] = {}
|
51
|
-
|
52
|
-
return to_object
|
53
|
-
|
54
|
-
|
55
|
-
def _AutomaticActivityDetection_to_mldev(
|
56
|
-
from_object: Union[dict[str, Any], object],
|
57
|
-
parent_object: Optional[dict[str, Any]] = None,
|
58
|
-
) -> dict[str, Any]:
|
59
|
-
to_object: dict[str, Any] = {}
|
60
|
-
if getv(from_object, ['disabled']) is not None:
|
61
|
-
setv(to_object, ['disabled'], getv(from_object, ['disabled']))
|
62
|
-
|
63
|
-
if getv(from_object, ['start_of_speech_sensitivity']) is not None:
|
64
|
-
setv(
|
65
|
-
to_object,
|
66
|
-
['startOfSpeechSensitivity'],
|
67
|
-
getv(from_object, ['start_of_speech_sensitivity']),
|
68
|
-
)
|
69
|
-
|
70
|
-
if getv(from_object, ['end_of_speech_sensitivity']) is not None:
|
71
|
-
setv(
|
72
|
-
to_object,
|
73
|
-
['endOfSpeechSensitivity'],
|
74
|
-
getv(from_object, ['end_of_speech_sensitivity']),
|
75
|
-
)
|
76
|
-
|
77
|
-
if getv(from_object, ['prefix_padding_ms']) is not None:
|
78
|
-
setv(
|
79
|
-
to_object, ['prefixPaddingMs'], getv(from_object, ['prefix_padding_ms'])
|
80
|
-
)
|
81
|
-
|
82
|
-
if getv(from_object, ['silence_duration_ms']) is not None:
|
83
|
-
setv(
|
84
|
-
to_object,
|
85
|
-
['silenceDurationMs'],
|
86
|
-
getv(from_object, ['silence_duration_ms']),
|
87
|
-
)
|
88
|
-
|
89
|
-
return to_object
|
90
|
-
|
91
|
-
|
92
26
|
def _Blob_to_mldev(
|
93
27
|
from_object: Union[dict[str, Any], object],
|
94
28
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -106,24 +40,6 @@ def _Blob_to_mldev(
|
|
106
40
|
return to_object
|
107
41
|
|
108
42
|
|
109
|
-
def _ComputerUse_to_mldev(
|
110
|
-
from_object: Union[dict[str, Any], object],
|
111
|
-
parent_object: Optional[dict[str, Any]] = None,
|
112
|
-
) -> dict[str, Any]:
|
113
|
-
to_object: dict[str, Any] = {}
|
114
|
-
if getv(from_object, ['environment']) is not None:
|
115
|
-
setv(to_object, ['environment'], getv(from_object, ['environment']))
|
116
|
-
|
117
|
-
if getv(from_object, ['excluded_predefined_functions']) is not None:
|
118
|
-
setv(
|
119
|
-
to_object,
|
120
|
-
['excludedPredefinedFunctions'],
|
121
|
-
getv(from_object, ['excluded_predefined_functions']),
|
122
|
-
)
|
123
|
-
|
124
|
-
return to_object
|
125
|
-
|
126
|
-
|
127
43
|
def _Content_to_mldev(
|
128
44
|
from_object: Union[dict[str, Any], object],
|
129
45
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -145,26 +61,6 @@ def _Content_to_mldev(
|
|
145
61
|
return to_object
|
146
62
|
|
147
63
|
|
148
|
-
def _ContextWindowCompressionConfig_to_mldev(
|
149
|
-
from_object: Union[dict[str, Any], object],
|
150
|
-
parent_object: Optional[dict[str, Any]] = None,
|
151
|
-
) -> dict[str, Any]:
|
152
|
-
to_object: dict[str, Any] = {}
|
153
|
-
if getv(from_object, ['trigger_tokens']) is not None:
|
154
|
-
setv(to_object, ['triggerTokens'], getv(from_object, ['trigger_tokens']))
|
155
|
-
|
156
|
-
if getv(from_object, ['sliding_window']) is not None:
|
157
|
-
setv(
|
158
|
-
to_object,
|
159
|
-
['slidingWindow'],
|
160
|
-
_SlidingWindow_to_mldev(
|
161
|
-
getv(from_object, ['sliding_window']), to_object
|
162
|
-
),
|
163
|
-
)
|
164
|
-
|
165
|
-
return to_object
|
166
|
-
|
167
|
-
|
168
64
|
def _CreateAuthTokenConfig_to_mldev(
|
169
65
|
api_client: BaseApiClient,
|
170
66
|
from_object: Union[dict[str, Any], object],
|
@@ -235,24 +131,6 @@ def _CreateAuthTokenParameters_to_vertex(
|
|
235
131
|
return to_object
|
236
132
|
|
237
133
|
|
238
|
-
def _DynamicRetrievalConfig_to_mldev(
|
239
|
-
from_object: Union[dict[str, Any], object],
|
240
|
-
parent_object: Optional[dict[str, Any]] = None,
|
241
|
-
) -> dict[str, Any]:
|
242
|
-
to_object: dict[str, Any] = {}
|
243
|
-
if getv(from_object, ['mode']) is not None:
|
244
|
-
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
245
|
-
|
246
|
-
if getv(from_object, ['dynamic_threshold']) is not None:
|
247
|
-
setv(
|
248
|
-
to_object,
|
249
|
-
['dynamicThreshold'],
|
250
|
-
getv(from_object, ['dynamic_threshold']),
|
251
|
-
)
|
252
|
-
|
253
|
-
return to_object
|
254
|
-
|
255
|
-
|
256
134
|
def _FileData_to_mldev(
|
257
135
|
from_object: Union[dict[str, Any], object],
|
258
136
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -270,73 +148,16 @@ def _FileData_to_mldev(
|
|
270
148
|
return to_object
|
271
149
|
|
272
150
|
|
273
|
-
def
|
151
|
+
def _GoogleMaps_to_mldev(
|
274
152
|
from_object: Union[dict[str, Any], object],
|
275
153
|
parent_object: Optional[dict[str, Any]] = None,
|
276
154
|
) -> dict[str, Any]:
|
277
155
|
to_object: dict[str, Any] = {}
|
278
|
-
if getv(from_object, ['
|
279
|
-
|
280
|
-
|
281
|
-
if getv(from_object, ['args']) is not None:
|
282
|
-
setv(to_object, ['args'], getv(from_object, ['args']))
|
156
|
+
if getv(from_object, ['auth_config']) is not None:
|
157
|
+
raise ValueError('auth_config parameter is not supported in Gemini API.')
|
283
158
|
|
284
|
-
if getv(from_object, ['
|
285
|
-
setv(to_object, ['
|
286
|
-
|
287
|
-
return to_object
|
288
|
-
|
289
|
-
|
290
|
-
def _FunctionDeclaration_to_mldev(
|
291
|
-
from_object: Union[dict[str, Any], object],
|
292
|
-
parent_object: Optional[dict[str, Any]] = None,
|
293
|
-
) -> dict[str, Any]:
|
294
|
-
to_object: dict[str, Any] = {}
|
295
|
-
if getv(from_object, ['behavior']) is not None:
|
296
|
-
setv(to_object, ['behavior'], getv(from_object, ['behavior']))
|
297
|
-
|
298
|
-
if getv(from_object, ['description']) is not None:
|
299
|
-
setv(to_object, ['description'], getv(from_object, ['description']))
|
300
|
-
|
301
|
-
if getv(from_object, ['name']) is not None:
|
302
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
303
|
-
|
304
|
-
if getv(from_object, ['parameters']) is not None:
|
305
|
-
setv(to_object, ['parameters'], getv(from_object, ['parameters']))
|
306
|
-
|
307
|
-
if getv(from_object, ['parameters_json_schema']) is not None:
|
308
|
-
setv(
|
309
|
-
to_object,
|
310
|
-
['parametersJsonSchema'],
|
311
|
-
getv(from_object, ['parameters_json_schema']),
|
312
|
-
)
|
313
|
-
|
314
|
-
if getv(from_object, ['response']) is not None:
|
315
|
-
setv(to_object, ['response'], getv(from_object, ['response']))
|
316
|
-
|
317
|
-
if getv(from_object, ['response_json_schema']) is not None:
|
318
|
-
setv(
|
319
|
-
to_object,
|
320
|
-
['responseJsonSchema'],
|
321
|
-
getv(from_object, ['response_json_schema']),
|
322
|
-
)
|
323
|
-
|
324
|
-
return to_object
|
325
|
-
|
326
|
-
|
327
|
-
def _GoogleSearchRetrieval_to_mldev(
|
328
|
-
from_object: Union[dict[str, Any], object],
|
329
|
-
parent_object: Optional[dict[str, Any]] = None,
|
330
|
-
) -> dict[str, Any]:
|
331
|
-
to_object: dict[str, Any] = {}
|
332
|
-
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
333
|
-
setv(
|
334
|
-
to_object,
|
335
|
-
['dynamicRetrievalConfig'],
|
336
|
-
_DynamicRetrievalConfig_to_mldev(
|
337
|
-
getv(from_object, ['dynamic_retrieval_config']), to_object
|
338
|
-
),
|
339
|
-
)
|
159
|
+
if getv(from_object, ['enable_widget']) is not None:
|
160
|
+
setv(to_object, ['enableWidget'], getv(from_object, ['enable_widget']))
|
340
161
|
|
341
162
|
return to_object
|
342
163
|
|
@@ -348,9 +169,7 @@ def _GoogleSearch_to_mldev(
|
|
348
169
|
to_object: dict[str, Any] = {}
|
349
170
|
if getv(from_object, ['time_range_filter']) is not None:
|
350
171
|
setv(
|
351
|
-
to_object,
|
352
|
-
['timeRangeFilter'],
|
353
|
-
_Interval_to_mldev(getv(from_object, ['time_range_filter']), to_object),
|
172
|
+
to_object, ['timeRangeFilter'], getv(from_object, ['time_range_filter'])
|
354
173
|
)
|
355
174
|
|
356
175
|
if getv(from_object, ['exclude_domains']) is not None:
|
@@ -361,20 +180,6 @@ def _GoogleSearch_to_mldev(
|
|
361
180
|
return to_object
|
362
181
|
|
363
182
|
|
364
|
-
def _Interval_to_mldev(
|
365
|
-
from_object: Union[dict[str, Any], object],
|
366
|
-
parent_object: Optional[dict[str, Any]] = None,
|
367
|
-
) -> dict[str, Any]:
|
368
|
-
to_object: dict[str, Any] = {}
|
369
|
-
if getv(from_object, ['start_time']) is not None:
|
370
|
-
setv(to_object, ['startTime'], getv(from_object, ['start_time']))
|
371
|
-
|
372
|
-
if getv(from_object, ['end_time']) is not None:
|
373
|
-
setv(to_object, ['endTime'], getv(from_object, ['end_time']))
|
374
|
-
|
375
|
-
return to_object
|
376
|
-
|
377
|
-
|
378
183
|
def _LiveConnectConfig_to_mldev(
|
379
184
|
api_client: BaseApiClient,
|
380
185
|
from_object: Union[dict[str, Any], object],
|
@@ -442,19 +247,14 @@ def _LiveConnectConfig_to_mldev(
|
|
442
247
|
setv(
|
443
248
|
parent_object,
|
444
249
|
['setup', 'generationConfig', 'speechConfig'],
|
445
|
-
|
446
|
-
t.t_live_speech_config(getv(from_object, ['speech_config'])),
|
447
|
-
to_object,
|
448
|
-
),
|
250
|
+
t.t_live_speech_config(getv(from_object, ['speech_config'])),
|
449
251
|
)
|
450
252
|
|
451
253
|
if getv(from_object, ['thinking_config']) is not None:
|
452
254
|
setv(
|
453
255
|
parent_object,
|
454
256
|
['setup', 'generationConfig', 'thinkingConfig'],
|
455
|
-
|
456
|
-
getv(from_object, ['thinking_config']), to_object
|
457
|
-
),
|
257
|
+
getv(from_object, ['thinking_config']),
|
458
258
|
)
|
459
259
|
|
460
260
|
if getv(from_object, ['enable_affective_dialog']) is not None:
|
@@ -496,45 +296,35 @@ def _LiveConnectConfig_to_mldev(
|
|
496
296
|
setv(
|
497
297
|
parent_object,
|
498
298
|
['setup', 'inputAudioTranscription'],
|
499
|
-
|
500
|
-
getv(from_object, ['input_audio_transcription']), to_object
|
501
|
-
),
|
299
|
+
getv(from_object, ['input_audio_transcription']),
|
502
300
|
)
|
503
301
|
|
504
302
|
if getv(from_object, ['output_audio_transcription']) is not None:
|
505
303
|
setv(
|
506
304
|
parent_object,
|
507
305
|
['setup', 'outputAudioTranscription'],
|
508
|
-
|
509
|
-
getv(from_object, ['output_audio_transcription']), to_object
|
510
|
-
),
|
306
|
+
getv(from_object, ['output_audio_transcription']),
|
511
307
|
)
|
512
308
|
|
513
309
|
if getv(from_object, ['realtime_input_config']) is not None:
|
514
310
|
setv(
|
515
311
|
parent_object,
|
516
312
|
['setup', 'realtimeInputConfig'],
|
517
|
-
|
518
|
-
getv(from_object, ['realtime_input_config']), to_object
|
519
|
-
),
|
313
|
+
getv(from_object, ['realtime_input_config']),
|
520
314
|
)
|
521
315
|
|
522
316
|
if getv(from_object, ['context_window_compression']) is not None:
|
523
317
|
setv(
|
524
318
|
parent_object,
|
525
319
|
['setup', 'contextWindowCompression'],
|
526
|
-
|
527
|
-
getv(from_object, ['context_window_compression']), to_object
|
528
|
-
),
|
320
|
+
getv(from_object, ['context_window_compression']),
|
529
321
|
)
|
530
322
|
|
531
323
|
if getv(from_object, ['proactivity']) is not None:
|
532
324
|
setv(
|
533
325
|
parent_object,
|
534
326
|
['setup', 'proactivity'],
|
535
|
-
|
536
|
-
getv(from_object, ['proactivity']), to_object
|
537
|
-
),
|
327
|
+
getv(from_object, ['proactivity']),
|
538
328
|
)
|
539
329
|
|
540
330
|
return to_object
|
@@ -565,37 +355,13 @@ def _LiveConnectConstraints_to_mldev(
|
|
565
355
|
return to_object
|
566
356
|
|
567
357
|
|
568
|
-
def _MultiSpeakerVoiceConfig_to_mldev(
|
569
|
-
from_object: Union[dict[str, Any], object],
|
570
|
-
parent_object: Optional[dict[str, Any]] = None,
|
571
|
-
) -> dict[str, Any]:
|
572
|
-
to_object: dict[str, Any] = {}
|
573
|
-
if getv(from_object, ['speaker_voice_configs']) is not None:
|
574
|
-
setv(
|
575
|
-
to_object,
|
576
|
-
['speakerVoiceConfigs'],
|
577
|
-
[
|
578
|
-
_SpeakerVoiceConfig_to_mldev(item, to_object)
|
579
|
-
for item in getv(from_object, ['speaker_voice_configs'])
|
580
|
-
],
|
581
|
-
)
|
582
|
-
|
583
|
-
return to_object
|
584
|
-
|
585
|
-
|
586
358
|
def _Part_to_mldev(
|
587
359
|
from_object: Union[dict[str, Any], object],
|
588
360
|
parent_object: Optional[dict[str, Any]] = None,
|
589
361
|
) -> dict[str, Any]:
|
590
362
|
to_object: dict[str, Any] = {}
|
591
363
|
if getv(from_object, ['video_metadata']) is not None:
|
592
|
-
setv(
|
593
|
-
to_object,
|
594
|
-
['videoMetadata'],
|
595
|
-
_VideoMetadata_to_mldev(
|
596
|
-
getv(from_object, ['video_metadata']), to_object
|
597
|
-
),
|
598
|
-
)
|
364
|
+
setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
|
599
365
|
|
600
366
|
if getv(from_object, ['thought']) is not None:
|
601
367
|
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
@@ -622,11 +388,7 @@ def _Part_to_mldev(
|
|
622
388
|
)
|
623
389
|
|
624
390
|
if getv(from_object, ['function_call']) is not None:
|
625
|
-
setv(
|
626
|
-
to_object,
|
627
|
-
['functionCall'],
|
628
|
-
_FunctionCall_to_mldev(getv(from_object, ['function_call']), to_object),
|
629
|
-
)
|
391
|
+
setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
|
630
392
|
|
631
393
|
if getv(from_object, ['code_execution_result']) is not None:
|
632
394
|
setv(
|
@@ -651,55 +413,6 @@ def _Part_to_mldev(
|
|
651
413
|
return to_object
|
652
414
|
|
653
415
|
|
654
|
-
def _PrebuiltVoiceConfig_to_mldev(
|
655
|
-
from_object: Union[dict[str, Any], object],
|
656
|
-
parent_object: Optional[dict[str, Any]] = None,
|
657
|
-
) -> dict[str, Any]:
|
658
|
-
to_object: dict[str, Any] = {}
|
659
|
-
if getv(from_object, ['voice_name']) is not None:
|
660
|
-
setv(to_object, ['voiceName'], getv(from_object, ['voice_name']))
|
661
|
-
|
662
|
-
return to_object
|
663
|
-
|
664
|
-
|
665
|
-
def _ProactivityConfig_to_mldev(
|
666
|
-
from_object: Union[dict[str, Any], object],
|
667
|
-
parent_object: Optional[dict[str, Any]] = None,
|
668
|
-
) -> dict[str, Any]:
|
669
|
-
to_object: dict[str, Any] = {}
|
670
|
-
if getv(from_object, ['proactive_audio']) is not None:
|
671
|
-
setv(to_object, ['proactiveAudio'], getv(from_object, ['proactive_audio']))
|
672
|
-
|
673
|
-
return to_object
|
674
|
-
|
675
|
-
|
676
|
-
def _RealtimeInputConfig_to_mldev(
|
677
|
-
from_object: Union[dict[str, Any], object],
|
678
|
-
parent_object: Optional[dict[str, Any]] = None,
|
679
|
-
) -> dict[str, Any]:
|
680
|
-
to_object: dict[str, Any] = {}
|
681
|
-
if getv(from_object, ['automatic_activity_detection']) is not None:
|
682
|
-
setv(
|
683
|
-
to_object,
|
684
|
-
['automaticActivityDetection'],
|
685
|
-
_AutomaticActivityDetection_to_mldev(
|
686
|
-
getv(from_object, ['automatic_activity_detection']), to_object
|
687
|
-
),
|
688
|
-
)
|
689
|
-
|
690
|
-
if getv(from_object, ['activity_handling']) is not None:
|
691
|
-
setv(
|
692
|
-
to_object,
|
693
|
-
['activityHandling'],
|
694
|
-
getv(from_object, ['activity_handling']),
|
695
|
-
)
|
696
|
-
|
697
|
-
if getv(from_object, ['turn_coverage']) is not None:
|
698
|
-
setv(to_object, ['turnCoverage'], getv(from_object, ['turn_coverage']))
|
699
|
-
|
700
|
-
return to_object
|
701
|
-
|
702
|
-
|
703
416
|
def _SessionResumptionConfig_to_mldev(
|
704
417
|
from_object: Union[dict[str, Any], object],
|
705
418
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -714,78 +427,6 @@ def _SessionResumptionConfig_to_mldev(
|
|
714
427
|
return to_object
|
715
428
|
|
716
429
|
|
717
|
-
def _SlidingWindow_to_mldev(
|
718
|
-
from_object: Union[dict[str, Any], object],
|
719
|
-
parent_object: Optional[dict[str, Any]] = None,
|
720
|
-
) -> dict[str, Any]:
|
721
|
-
to_object: dict[str, Any] = {}
|
722
|
-
if getv(from_object, ['target_tokens']) is not None:
|
723
|
-
setv(to_object, ['targetTokens'], getv(from_object, ['target_tokens']))
|
724
|
-
|
725
|
-
return to_object
|
726
|
-
|
727
|
-
|
728
|
-
def _SpeakerVoiceConfig_to_mldev(
|
729
|
-
from_object: Union[dict[str, Any], object],
|
730
|
-
parent_object: Optional[dict[str, Any]] = None,
|
731
|
-
) -> dict[str, Any]:
|
732
|
-
to_object: dict[str, Any] = {}
|
733
|
-
if getv(from_object, ['speaker']) is not None:
|
734
|
-
setv(to_object, ['speaker'], getv(from_object, ['speaker']))
|
735
|
-
|
736
|
-
if getv(from_object, ['voice_config']) is not None:
|
737
|
-
setv(
|
738
|
-
to_object,
|
739
|
-
['voiceConfig'],
|
740
|
-
_VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
|
741
|
-
)
|
742
|
-
|
743
|
-
return to_object
|
744
|
-
|
745
|
-
|
746
|
-
def _SpeechConfig_to_mldev(
|
747
|
-
from_object: Union[dict[str, Any], object],
|
748
|
-
parent_object: Optional[dict[str, Any]] = None,
|
749
|
-
) -> dict[str, Any]:
|
750
|
-
to_object: dict[str, Any] = {}
|
751
|
-
if getv(from_object, ['voice_config']) is not None:
|
752
|
-
setv(
|
753
|
-
to_object,
|
754
|
-
['voiceConfig'],
|
755
|
-
_VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
|
756
|
-
)
|
757
|
-
|
758
|
-
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
759
|
-
setv(
|
760
|
-
to_object,
|
761
|
-
['multiSpeakerVoiceConfig'],
|
762
|
-
_MultiSpeakerVoiceConfig_to_mldev(
|
763
|
-
getv(from_object, ['multi_speaker_voice_config']), to_object
|
764
|
-
),
|
765
|
-
)
|
766
|
-
|
767
|
-
if getv(from_object, ['language_code']) is not None:
|
768
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
769
|
-
|
770
|
-
return to_object
|
771
|
-
|
772
|
-
|
773
|
-
def _ThinkingConfig_to_mldev(
|
774
|
-
from_object: Union[dict[str, Any], object],
|
775
|
-
parent_object: Optional[dict[str, Any]] = None,
|
776
|
-
) -> dict[str, Any]:
|
777
|
-
to_object: dict[str, Any] = {}
|
778
|
-
if getv(from_object, ['include_thoughts']) is not None:
|
779
|
-
setv(
|
780
|
-
to_object, ['includeThoughts'], getv(from_object, ['include_thoughts'])
|
781
|
-
)
|
782
|
-
|
783
|
-
if getv(from_object, ['thinking_budget']) is not None:
|
784
|
-
setv(to_object, ['thinkingBudget'], getv(from_object, ['thinking_budget']))
|
785
|
-
|
786
|
-
return to_object
|
787
|
-
|
788
|
-
|
789
430
|
def _Tool_to_mldev(
|
790
431
|
from_object: Union[dict[str, Any], object],
|
791
432
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -795,10 +436,7 @@ def _Tool_to_mldev(
|
|
795
436
|
setv(
|
796
437
|
to_object,
|
797
438
|
['functionDeclarations'],
|
798
|
-
[
|
799
|
-
_FunctionDeclaration_to_mldev(item, to_object)
|
800
|
-
for item in getv(from_object, ['function_declarations'])
|
801
|
-
],
|
439
|
+
[item for item in getv(from_object, ['function_declarations'])],
|
802
440
|
)
|
803
441
|
|
804
442
|
if getv(from_object, ['retrieval']) is not None:
|
@@ -815,9 +453,7 @@ def _Tool_to_mldev(
|
|
815
453
|
setv(
|
816
454
|
to_object,
|
817
455
|
['googleSearchRetrieval'],
|
818
|
-
|
819
|
-
getv(from_object, ['google_search_retrieval']), to_object
|
820
|
-
),
|
456
|
+
getv(from_object, ['google_search_retrieval']),
|
821
457
|
)
|
822
458
|
|
823
459
|
if getv(from_object, ['enterprise_web_search']) is not None:
|
@@ -826,66 +462,19 @@ def _Tool_to_mldev(
|
|
826
462
|
)
|
827
463
|
|
828
464
|
if getv(from_object, ['google_maps']) is not None:
|
829
|
-
raise ValueError('google_maps parameter is not supported in Gemini API.')
|
830
|
-
|
831
|
-
if getv(from_object, ['url_context']) is not None:
|
832
465
|
setv(
|
833
466
|
to_object,
|
834
|
-
['
|
835
|
-
|
467
|
+
['googleMaps'],
|
468
|
+
_GoogleMaps_to_mldev(getv(from_object, ['google_maps']), to_object),
|
836
469
|
)
|
837
470
|
|
471
|
+
if getv(from_object, ['url_context']) is not None:
|
472
|
+
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
473
|
+
|
838
474
|
if getv(from_object, ['computer_use']) is not None:
|
839
|
-
setv(
|
840
|
-
to_object,
|
841
|
-
['computerUse'],
|
842
|
-
_ComputerUse_to_mldev(getv(from_object, ['computer_use']), to_object),
|
843
|
-
)
|
475
|
+
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
844
476
|
|
845
477
|
if getv(from_object, ['code_execution']) is not None:
|
846
478
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
847
479
|
|
848
480
|
return to_object
|
849
|
-
|
850
|
-
|
851
|
-
def _UrlContext_to_mldev(
|
852
|
-
from_object: Union[dict[str, Any], object],
|
853
|
-
parent_object: Optional[dict[str, Any]] = None,
|
854
|
-
) -> dict[str, Any]:
|
855
|
-
to_object: dict[str, Any] = {}
|
856
|
-
|
857
|
-
return to_object
|
858
|
-
|
859
|
-
|
860
|
-
def _VideoMetadata_to_mldev(
|
861
|
-
from_object: Union[dict[str, Any], object],
|
862
|
-
parent_object: Optional[dict[str, Any]] = None,
|
863
|
-
) -> dict[str, Any]:
|
864
|
-
to_object: dict[str, Any] = {}
|
865
|
-
if getv(from_object, ['fps']) is not None:
|
866
|
-
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
867
|
-
|
868
|
-
if getv(from_object, ['end_offset']) is not None:
|
869
|
-
setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
|
870
|
-
|
871
|
-
if getv(from_object, ['start_offset']) is not None:
|
872
|
-
setv(to_object, ['startOffset'], getv(from_object, ['start_offset']))
|
873
|
-
|
874
|
-
return to_object
|
875
|
-
|
876
|
-
|
877
|
-
def _VoiceConfig_to_mldev(
|
878
|
-
from_object: Union[dict[str, Any], object],
|
879
|
-
parent_object: Optional[dict[str, Any]] = None,
|
880
|
-
) -> dict[str, Any]:
|
881
|
-
to_object: dict[str, Any] = {}
|
882
|
-
if getv(from_object, ['prebuilt_voice_config']) is not None:
|
883
|
-
setv(
|
884
|
-
to_object,
|
885
|
-
['prebuiltVoiceConfig'],
|
886
|
-
_PrebuiltVoiceConfig_to_mldev(
|
887
|
-
getv(from_object, ['prebuilt_voice_config']), to_object
|
888
|
-
),
|
889
|
-
)
|
890
|
-
|
891
|
-
return to_object
|