google-genai 1.40.0__py3-none-any.whl → 1.42.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/_extra_utils.py +72 -1
- google/genai/_live_converters.py +729 -3078
- google/genai/_replay_api_client.py +8 -4
- google/genai/_tokens_converters.py +20 -424
- google/genai/_transformers.py +42 -12
- google/genai/batches.py +113 -1063
- google/genai/caches.py +67 -863
- google/genai/errors.py +9 -2
- google/genai/files.py +29 -268
- google/genai/live.py +10 -11
- google/genai/live_music.py +24 -27
- google/genai/models.py +322 -1835
- google/genai/operations.py +6 -32
- google/genai/tokens.py +2 -12
- google/genai/tunings.py +24 -197
- google/genai/types.py +187 -5
- google/genai/version.py +1 -1
- {google_genai-1.40.0.dist-info → google_genai-1.42.0.dist-info}/METADATA +40 -38
- google_genai-1.42.0.dist-info/RECORD +39 -0
- google_genai-1.40.0.dist-info/RECORD +0 -39
- {google_genai-1.40.0.dist-info → google_genai-1.42.0.dist-info}/WHEEL +0 -0
- {google_genai-1.40.0.dist-info → google_genai-1.42.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.40.0.dist-info → google_genai-1.42.0.dist-info}/top_level.txt +0 -0
@@ -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,77 +148,6 @@ def _FileData_to_mldev(
|
|
270
148
|
return to_object
|
271
149
|
|
272
150
|
|
273
|
-
def _FunctionCall_to_mldev(
|
274
|
-
from_object: Union[dict[str, Any], object],
|
275
|
-
parent_object: Optional[dict[str, Any]] = None,
|
276
|
-
) -> dict[str, Any]:
|
277
|
-
to_object: dict[str, Any] = {}
|
278
|
-
if getv(from_object, ['id']) is not None:
|
279
|
-
setv(to_object, ['id'], getv(from_object, ['id']))
|
280
|
-
|
281
|
-
if getv(from_object, ['args']) is not None:
|
282
|
-
setv(to_object, ['args'], getv(from_object, ['args']))
|
283
|
-
|
284
|
-
if getv(from_object, ['name']) is not None:
|
285
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
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
|
-
)
|
340
|
-
|
341
|
-
return to_object
|
342
|
-
|
343
|
-
|
344
151
|
def _GoogleSearch_to_mldev(
|
345
152
|
from_object: Union[dict[str, Any], object],
|
346
153
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -348,9 +155,7 @@ def _GoogleSearch_to_mldev(
|
|
348
155
|
to_object: dict[str, Any] = {}
|
349
156
|
if getv(from_object, ['time_range_filter']) is not None:
|
350
157
|
setv(
|
351
|
-
to_object,
|
352
|
-
['timeRangeFilter'],
|
353
|
-
_Interval_to_mldev(getv(from_object, ['time_range_filter']), to_object),
|
158
|
+
to_object, ['timeRangeFilter'], getv(from_object, ['time_range_filter'])
|
354
159
|
)
|
355
160
|
|
356
161
|
if getv(from_object, ['exclude_domains']) is not None:
|
@@ -361,20 +166,6 @@ def _GoogleSearch_to_mldev(
|
|
361
166
|
return to_object
|
362
167
|
|
363
168
|
|
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
169
|
def _LiveConnectConfig_to_mldev(
|
379
170
|
api_client: BaseApiClient,
|
380
171
|
from_object: Union[dict[str, Any], object],
|
@@ -442,10 +233,14 @@ def _LiveConnectConfig_to_mldev(
|
|
442
233
|
setv(
|
443
234
|
parent_object,
|
444
235
|
['setup', 'generationConfig', 'speechConfig'],
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
236
|
+
t.t_live_speech_config(getv(from_object, ['speech_config'])),
|
237
|
+
)
|
238
|
+
|
239
|
+
if getv(from_object, ['thinking_config']) is not None:
|
240
|
+
setv(
|
241
|
+
parent_object,
|
242
|
+
['setup', 'generationConfig', 'thinkingConfig'],
|
243
|
+
getv(from_object, ['thinking_config']),
|
449
244
|
)
|
450
245
|
|
451
246
|
if getv(from_object, ['enable_affective_dialog']) is not None:
|
@@ -487,45 +282,35 @@ def _LiveConnectConfig_to_mldev(
|
|
487
282
|
setv(
|
488
283
|
parent_object,
|
489
284
|
['setup', 'inputAudioTranscription'],
|
490
|
-
|
491
|
-
getv(from_object, ['input_audio_transcription']), to_object
|
492
|
-
),
|
285
|
+
getv(from_object, ['input_audio_transcription']),
|
493
286
|
)
|
494
287
|
|
495
288
|
if getv(from_object, ['output_audio_transcription']) is not None:
|
496
289
|
setv(
|
497
290
|
parent_object,
|
498
291
|
['setup', 'outputAudioTranscription'],
|
499
|
-
|
500
|
-
getv(from_object, ['output_audio_transcription']), to_object
|
501
|
-
),
|
292
|
+
getv(from_object, ['output_audio_transcription']),
|
502
293
|
)
|
503
294
|
|
504
295
|
if getv(from_object, ['realtime_input_config']) is not None:
|
505
296
|
setv(
|
506
297
|
parent_object,
|
507
298
|
['setup', 'realtimeInputConfig'],
|
508
|
-
|
509
|
-
getv(from_object, ['realtime_input_config']), to_object
|
510
|
-
),
|
299
|
+
getv(from_object, ['realtime_input_config']),
|
511
300
|
)
|
512
301
|
|
513
302
|
if getv(from_object, ['context_window_compression']) is not None:
|
514
303
|
setv(
|
515
304
|
parent_object,
|
516
305
|
['setup', 'contextWindowCompression'],
|
517
|
-
|
518
|
-
getv(from_object, ['context_window_compression']), to_object
|
519
|
-
),
|
306
|
+
getv(from_object, ['context_window_compression']),
|
520
307
|
)
|
521
308
|
|
522
309
|
if getv(from_object, ['proactivity']) is not None:
|
523
310
|
setv(
|
524
311
|
parent_object,
|
525
312
|
['setup', 'proactivity'],
|
526
|
-
|
527
|
-
getv(from_object, ['proactivity']), to_object
|
528
|
-
),
|
313
|
+
getv(from_object, ['proactivity']),
|
529
314
|
)
|
530
315
|
|
531
316
|
return to_object
|
@@ -556,37 +341,13 @@ def _LiveConnectConstraints_to_mldev(
|
|
556
341
|
return to_object
|
557
342
|
|
558
343
|
|
559
|
-
def _MultiSpeakerVoiceConfig_to_mldev(
|
560
|
-
from_object: Union[dict[str, Any], object],
|
561
|
-
parent_object: Optional[dict[str, Any]] = None,
|
562
|
-
) -> dict[str, Any]:
|
563
|
-
to_object: dict[str, Any] = {}
|
564
|
-
if getv(from_object, ['speaker_voice_configs']) is not None:
|
565
|
-
setv(
|
566
|
-
to_object,
|
567
|
-
['speakerVoiceConfigs'],
|
568
|
-
[
|
569
|
-
_SpeakerVoiceConfig_to_mldev(item, to_object)
|
570
|
-
for item in getv(from_object, ['speaker_voice_configs'])
|
571
|
-
],
|
572
|
-
)
|
573
|
-
|
574
|
-
return to_object
|
575
|
-
|
576
|
-
|
577
344
|
def _Part_to_mldev(
|
578
345
|
from_object: Union[dict[str, Any], object],
|
579
346
|
parent_object: Optional[dict[str, Any]] = None,
|
580
347
|
) -> dict[str, Any]:
|
581
348
|
to_object: dict[str, Any] = {}
|
582
349
|
if getv(from_object, ['video_metadata']) is not None:
|
583
|
-
setv(
|
584
|
-
to_object,
|
585
|
-
['videoMetadata'],
|
586
|
-
_VideoMetadata_to_mldev(
|
587
|
-
getv(from_object, ['video_metadata']), to_object
|
588
|
-
),
|
589
|
-
)
|
350
|
+
setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
|
590
351
|
|
591
352
|
if getv(from_object, ['thought']) is not None:
|
592
353
|
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
@@ -613,11 +374,7 @@ def _Part_to_mldev(
|
|
613
374
|
)
|
614
375
|
|
615
376
|
if getv(from_object, ['function_call']) is not None:
|
616
|
-
setv(
|
617
|
-
to_object,
|
618
|
-
['functionCall'],
|
619
|
-
_FunctionCall_to_mldev(getv(from_object, ['function_call']), to_object),
|
620
|
-
)
|
377
|
+
setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
|
621
378
|
|
622
379
|
if getv(from_object, ['code_execution_result']) is not None:
|
623
380
|
setv(
|
@@ -642,55 +399,6 @@ def _Part_to_mldev(
|
|
642
399
|
return to_object
|
643
400
|
|
644
401
|
|
645
|
-
def _PrebuiltVoiceConfig_to_mldev(
|
646
|
-
from_object: Union[dict[str, Any], object],
|
647
|
-
parent_object: Optional[dict[str, Any]] = None,
|
648
|
-
) -> dict[str, Any]:
|
649
|
-
to_object: dict[str, Any] = {}
|
650
|
-
if getv(from_object, ['voice_name']) is not None:
|
651
|
-
setv(to_object, ['voiceName'], getv(from_object, ['voice_name']))
|
652
|
-
|
653
|
-
return to_object
|
654
|
-
|
655
|
-
|
656
|
-
def _ProactivityConfig_to_mldev(
|
657
|
-
from_object: Union[dict[str, Any], object],
|
658
|
-
parent_object: Optional[dict[str, Any]] = None,
|
659
|
-
) -> dict[str, Any]:
|
660
|
-
to_object: dict[str, Any] = {}
|
661
|
-
if getv(from_object, ['proactive_audio']) is not None:
|
662
|
-
setv(to_object, ['proactiveAudio'], getv(from_object, ['proactive_audio']))
|
663
|
-
|
664
|
-
return to_object
|
665
|
-
|
666
|
-
|
667
|
-
def _RealtimeInputConfig_to_mldev(
|
668
|
-
from_object: Union[dict[str, Any], object],
|
669
|
-
parent_object: Optional[dict[str, Any]] = None,
|
670
|
-
) -> dict[str, Any]:
|
671
|
-
to_object: dict[str, Any] = {}
|
672
|
-
if getv(from_object, ['automatic_activity_detection']) is not None:
|
673
|
-
setv(
|
674
|
-
to_object,
|
675
|
-
['automaticActivityDetection'],
|
676
|
-
_AutomaticActivityDetection_to_mldev(
|
677
|
-
getv(from_object, ['automatic_activity_detection']), to_object
|
678
|
-
),
|
679
|
-
)
|
680
|
-
|
681
|
-
if getv(from_object, ['activity_handling']) is not None:
|
682
|
-
setv(
|
683
|
-
to_object,
|
684
|
-
['activityHandling'],
|
685
|
-
getv(from_object, ['activity_handling']),
|
686
|
-
)
|
687
|
-
|
688
|
-
if getv(from_object, ['turn_coverage']) is not None:
|
689
|
-
setv(to_object, ['turnCoverage'], getv(from_object, ['turn_coverage']))
|
690
|
-
|
691
|
-
return to_object
|
692
|
-
|
693
|
-
|
694
402
|
def _SessionResumptionConfig_to_mldev(
|
695
403
|
from_object: Union[dict[str, Any], object],
|
696
404
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -705,62 +413,6 @@ def _SessionResumptionConfig_to_mldev(
|
|
705
413
|
return to_object
|
706
414
|
|
707
415
|
|
708
|
-
def _SlidingWindow_to_mldev(
|
709
|
-
from_object: Union[dict[str, Any], object],
|
710
|
-
parent_object: Optional[dict[str, Any]] = None,
|
711
|
-
) -> dict[str, Any]:
|
712
|
-
to_object: dict[str, Any] = {}
|
713
|
-
if getv(from_object, ['target_tokens']) is not None:
|
714
|
-
setv(to_object, ['targetTokens'], getv(from_object, ['target_tokens']))
|
715
|
-
|
716
|
-
return to_object
|
717
|
-
|
718
|
-
|
719
|
-
def _SpeakerVoiceConfig_to_mldev(
|
720
|
-
from_object: Union[dict[str, Any], object],
|
721
|
-
parent_object: Optional[dict[str, Any]] = None,
|
722
|
-
) -> dict[str, Any]:
|
723
|
-
to_object: dict[str, Any] = {}
|
724
|
-
if getv(from_object, ['speaker']) is not None:
|
725
|
-
setv(to_object, ['speaker'], getv(from_object, ['speaker']))
|
726
|
-
|
727
|
-
if getv(from_object, ['voice_config']) is not None:
|
728
|
-
setv(
|
729
|
-
to_object,
|
730
|
-
['voiceConfig'],
|
731
|
-
_VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
|
732
|
-
)
|
733
|
-
|
734
|
-
return to_object
|
735
|
-
|
736
|
-
|
737
|
-
def _SpeechConfig_to_mldev(
|
738
|
-
from_object: Union[dict[str, Any], object],
|
739
|
-
parent_object: Optional[dict[str, Any]] = None,
|
740
|
-
) -> dict[str, Any]:
|
741
|
-
to_object: dict[str, Any] = {}
|
742
|
-
if getv(from_object, ['voice_config']) is not None:
|
743
|
-
setv(
|
744
|
-
to_object,
|
745
|
-
['voiceConfig'],
|
746
|
-
_VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
|
747
|
-
)
|
748
|
-
|
749
|
-
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
750
|
-
setv(
|
751
|
-
to_object,
|
752
|
-
['multiSpeakerVoiceConfig'],
|
753
|
-
_MultiSpeakerVoiceConfig_to_mldev(
|
754
|
-
getv(from_object, ['multi_speaker_voice_config']), to_object
|
755
|
-
),
|
756
|
-
)
|
757
|
-
|
758
|
-
if getv(from_object, ['language_code']) is not None:
|
759
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
760
|
-
|
761
|
-
return to_object
|
762
|
-
|
763
|
-
|
764
416
|
def _Tool_to_mldev(
|
765
417
|
from_object: Union[dict[str, Any], object],
|
766
418
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -770,10 +422,7 @@ def _Tool_to_mldev(
|
|
770
422
|
setv(
|
771
423
|
to_object,
|
772
424
|
['functionDeclarations'],
|
773
|
-
[
|
774
|
-
_FunctionDeclaration_to_mldev(item, to_object)
|
775
|
-
for item in getv(from_object, ['function_declarations'])
|
776
|
-
],
|
425
|
+
[item for item in getv(from_object, ['function_declarations'])],
|
777
426
|
)
|
778
427
|
|
779
428
|
if getv(from_object, ['retrieval']) is not None:
|
@@ -790,9 +439,7 @@ def _Tool_to_mldev(
|
|
790
439
|
setv(
|
791
440
|
to_object,
|
792
441
|
['googleSearchRetrieval'],
|
793
|
-
|
794
|
-
getv(from_object, ['google_search_retrieval']), to_object
|
795
|
-
),
|
442
|
+
getv(from_object, ['google_search_retrieval']),
|
796
443
|
)
|
797
444
|
|
798
445
|
if getv(from_object, ['enterprise_web_search']) is not None:
|
@@ -804,63 +451,12 @@ def _Tool_to_mldev(
|
|
804
451
|
raise ValueError('google_maps parameter is not supported in Gemini API.')
|
805
452
|
|
806
453
|
if getv(from_object, ['url_context']) is not None:
|
807
|
-
setv(
|
808
|
-
to_object,
|
809
|
-
['urlContext'],
|
810
|
-
_UrlContext_to_mldev(getv(from_object, ['url_context']), to_object),
|
811
|
-
)
|
454
|
+
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
812
455
|
|
813
456
|
if getv(from_object, ['computer_use']) is not None:
|
814
|
-
setv(
|
815
|
-
to_object,
|
816
|
-
['computerUse'],
|
817
|
-
_ComputerUse_to_mldev(getv(from_object, ['computer_use']), to_object),
|
818
|
-
)
|
457
|
+
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
819
458
|
|
820
459
|
if getv(from_object, ['code_execution']) is not None:
|
821
460
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
822
461
|
|
823
462
|
return to_object
|
824
|
-
|
825
|
-
|
826
|
-
def _UrlContext_to_mldev(
|
827
|
-
from_object: Union[dict[str, Any], object],
|
828
|
-
parent_object: Optional[dict[str, Any]] = None,
|
829
|
-
) -> dict[str, Any]:
|
830
|
-
to_object: dict[str, Any] = {}
|
831
|
-
|
832
|
-
return to_object
|
833
|
-
|
834
|
-
|
835
|
-
def _VideoMetadata_to_mldev(
|
836
|
-
from_object: Union[dict[str, Any], object],
|
837
|
-
parent_object: Optional[dict[str, Any]] = None,
|
838
|
-
) -> dict[str, Any]:
|
839
|
-
to_object: dict[str, Any] = {}
|
840
|
-
if getv(from_object, ['fps']) is not None:
|
841
|
-
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
842
|
-
|
843
|
-
if getv(from_object, ['end_offset']) is not None:
|
844
|
-
setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
|
845
|
-
|
846
|
-
if getv(from_object, ['start_offset']) is not None:
|
847
|
-
setv(to_object, ['startOffset'], getv(from_object, ['start_offset']))
|
848
|
-
|
849
|
-
return to_object
|
850
|
-
|
851
|
-
|
852
|
-
def _VoiceConfig_to_mldev(
|
853
|
-
from_object: Union[dict[str, Any], object],
|
854
|
-
parent_object: Optional[dict[str, Any]] = None,
|
855
|
-
) -> dict[str, Any]:
|
856
|
-
to_object: dict[str, Any] = {}
|
857
|
-
if getv(from_object, ['prebuilt_voice_config']) is not None:
|
858
|
-
setv(
|
859
|
-
to_object,
|
860
|
-
['prebuiltVoiceConfig'],
|
861
|
-
_PrebuiltVoiceConfig_to_mldev(
|
862
|
-
getv(from_object, ['prebuilt_voice_config']), to_object
|
863
|
-
),
|
864
|
-
)
|
865
|
-
|
866
|
-
return to_object
|