google-genai 1.33.0__py3-none-any.whl → 1.53.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 +361 -208
- google/genai/_common.py +260 -69
- google/genai/_extra_utils.py +142 -12
- google/genai/_live_converters.py +691 -2746
- google/genai/_local_tokenizer_loader.py +0 -9
- google/genai/_operations_converters.py +186 -99
- google/genai/_replay_api_client.py +48 -51
- google/genai/_tokens_converters.py +169 -489
- google/genai/_transformers.py +193 -90
- google/genai/batches.py +1014 -1307
- google/genai/caches.py +458 -1107
- google/genai/client.py +101 -0
- google/genai/documents.py +532 -0
- google/genai/errors.py +58 -4
- google/genai/file_search_stores.py +1296 -0
- google/genai/files.py +108 -358
- google/genai/live.py +90 -32
- google/genai/live_music.py +24 -27
- google/genai/local_tokenizer.py +36 -3
- google/genai/models.py +2308 -3375
- google/genai/operations.py +129 -21
- google/genai/pagers.py +7 -1
- google/genai/tokens.py +2 -12
- google/genai/tunings.py +770 -436
- google/genai/types.py +4341 -1218
- google/genai/version.py +1 -1
- {google_genai-1.33.0.dist-info → google_genai-1.53.0.dist-info}/METADATA +359 -201
- google_genai-1.53.0.dist-info/RECORD +41 -0
- google_genai-1.33.0.dist-info/RECORD +0 -39
- {google_genai-1.33.0.dist-info → google_genai-1.53.0.dist-info}/WHEEL +0 -0
- {google_genai-1.33.0.dist-info → google_genai-1.53.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.33.0.dist-info → google_genai-1.53.0.dist-info}/top_level.txt +0 -0
|
@@ -23,212 +23,23 @@ 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 _PrebuiltVoiceConfig_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
|
-
if getv(from_object, ['voice_name']) is not None:
|
|
32
|
-
setv(to_object, ['voiceName'], getv(from_object, ['voice_name']))
|
|
33
|
-
|
|
34
|
-
return to_object
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def _VoiceConfig_to_mldev(
|
|
38
|
-
from_object: Union[dict[str, Any], object],
|
|
39
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
40
|
-
) -> dict[str, Any]:
|
|
41
|
-
to_object: dict[str, Any] = {}
|
|
42
|
-
if getv(from_object, ['prebuilt_voice_config']) is not None:
|
|
43
|
-
setv(
|
|
44
|
-
to_object,
|
|
45
|
-
['prebuiltVoiceConfig'],
|
|
46
|
-
_PrebuiltVoiceConfig_to_mldev(
|
|
47
|
-
getv(from_object, ['prebuilt_voice_config']), to_object
|
|
48
|
-
),
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
return to_object
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def _SpeakerVoiceConfig_to_mldev(
|
|
55
|
-
from_object: Union[dict[str, Any], object],
|
|
56
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
57
|
-
) -> dict[str, Any]:
|
|
58
|
-
to_object: dict[str, Any] = {}
|
|
59
|
-
if getv(from_object, ['speaker']) is not None:
|
|
60
|
-
setv(to_object, ['speaker'], getv(from_object, ['speaker']))
|
|
61
|
-
|
|
62
|
-
if getv(from_object, ['voice_config']) is not None:
|
|
63
|
-
setv(
|
|
64
|
-
to_object,
|
|
65
|
-
['voiceConfig'],
|
|
66
|
-
_VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
return to_object
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
def _MultiSpeakerVoiceConfig_to_mldev(
|
|
73
|
-
from_object: Union[dict[str, Any], object],
|
|
74
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
75
|
-
) -> dict[str, Any]:
|
|
76
|
-
to_object: dict[str, Any] = {}
|
|
77
|
-
if getv(from_object, ['speaker_voice_configs']) is not None:
|
|
78
|
-
setv(
|
|
79
|
-
to_object,
|
|
80
|
-
['speakerVoiceConfigs'],
|
|
81
|
-
[
|
|
82
|
-
_SpeakerVoiceConfig_to_mldev(item, to_object)
|
|
83
|
-
for item in getv(from_object, ['speaker_voice_configs'])
|
|
84
|
-
],
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
return to_object
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
def _SpeechConfig_to_mldev(
|
|
91
|
-
from_object: Union[dict[str, Any], object],
|
|
92
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
93
|
-
) -> dict[str, Any]:
|
|
94
|
-
to_object: dict[str, Any] = {}
|
|
95
|
-
if getv(from_object, ['voice_config']) is not None:
|
|
96
|
-
setv(
|
|
97
|
-
to_object,
|
|
98
|
-
['voiceConfig'],
|
|
99
|
-
_VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
|
103
|
-
setv(
|
|
104
|
-
to_object,
|
|
105
|
-
['multiSpeakerVoiceConfig'],
|
|
106
|
-
_MultiSpeakerVoiceConfig_to_mldev(
|
|
107
|
-
getv(from_object, ['multi_speaker_voice_config']), to_object
|
|
108
|
-
),
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
if getv(from_object, ['language_code']) is not None:
|
|
112
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
|
113
|
-
|
|
114
|
-
return to_object
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
def _VideoMetadata_to_mldev(
|
|
118
|
-
from_object: Union[dict[str, Any], object],
|
|
119
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
120
|
-
) -> dict[str, Any]:
|
|
121
|
-
to_object: dict[str, Any] = {}
|
|
122
|
-
if getv(from_object, ['fps']) is not None:
|
|
123
|
-
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
|
124
|
-
|
|
125
|
-
if getv(from_object, ['end_offset']) is not None:
|
|
126
|
-
setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
|
|
127
|
-
|
|
128
|
-
if getv(from_object, ['start_offset']) is not None:
|
|
129
|
-
setv(to_object, ['startOffset'], getv(from_object, ['start_offset']))
|
|
130
|
-
|
|
131
|
-
return to_object
|
|
132
|
-
|
|
133
|
-
|
|
134
26
|
def _Blob_to_mldev(
|
|
135
27
|
from_object: Union[dict[str, Any], object],
|
|
136
28
|
parent_object: Optional[dict[str, Any]] = None,
|
|
137
29
|
) -> dict[str, Any]:
|
|
138
30
|
to_object: dict[str, Any] = {}
|
|
139
|
-
if getv(from_object, ['display_name']) is not None:
|
|
140
|
-
raise ValueError('display_name parameter is not supported in Gemini API.')
|
|
141
|
-
|
|
142
31
|
if getv(from_object, ['data']) is not None:
|
|
143
32
|
setv(to_object, ['data'], getv(from_object, ['data']))
|
|
144
33
|
|
|
145
|
-
if getv(from_object, ['mime_type']) is not None:
|
|
146
|
-
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
|
147
|
-
|
|
148
|
-
return to_object
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
def _FileData_to_mldev(
|
|
152
|
-
from_object: Union[dict[str, Any], object],
|
|
153
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
154
|
-
) -> dict[str, Any]:
|
|
155
|
-
to_object: dict[str, Any] = {}
|
|
156
34
|
if getv(from_object, ['display_name']) is not None:
|
|
157
35
|
raise ValueError('display_name parameter is not supported in Gemini API.')
|
|
158
36
|
|
|
159
|
-
if getv(from_object, ['file_uri']) is not None:
|
|
160
|
-
setv(to_object, ['fileUri'], getv(from_object, ['file_uri']))
|
|
161
|
-
|
|
162
37
|
if getv(from_object, ['mime_type']) is not None:
|
|
163
38
|
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
|
164
39
|
|
|
165
40
|
return to_object
|
|
166
41
|
|
|
167
42
|
|
|
168
|
-
def _Part_to_mldev(
|
|
169
|
-
from_object: Union[dict[str, Any], object],
|
|
170
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
171
|
-
) -> dict[str, Any]:
|
|
172
|
-
to_object: dict[str, Any] = {}
|
|
173
|
-
if getv(from_object, ['video_metadata']) is not None:
|
|
174
|
-
setv(
|
|
175
|
-
to_object,
|
|
176
|
-
['videoMetadata'],
|
|
177
|
-
_VideoMetadata_to_mldev(
|
|
178
|
-
getv(from_object, ['video_metadata']), to_object
|
|
179
|
-
),
|
|
180
|
-
)
|
|
181
|
-
|
|
182
|
-
if getv(from_object, ['thought']) is not None:
|
|
183
|
-
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
|
184
|
-
|
|
185
|
-
if getv(from_object, ['inline_data']) is not None:
|
|
186
|
-
setv(
|
|
187
|
-
to_object,
|
|
188
|
-
['inlineData'],
|
|
189
|
-
_Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
|
|
190
|
-
)
|
|
191
|
-
|
|
192
|
-
if getv(from_object, ['file_data']) is not None:
|
|
193
|
-
setv(
|
|
194
|
-
to_object,
|
|
195
|
-
['fileData'],
|
|
196
|
-
_FileData_to_mldev(getv(from_object, ['file_data']), to_object),
|
|
197
|
-
)
|
|
198
|
-
|
|
199
|
-
if getv(from_object, ['thought_signature']) is not None:
|
|
200
|
-
setv(
|
|
201
|
-
to_object,
|
|
202
|
-
['thoughtSignature'],
|
|
203
|
-
getv(from_object, ['thought_signature']),
|
|
204
|
-
)
|
|
205
|
-
|
|
206
|
-
if getv(from_object, ['code_execution_result']) is not None:
|
|
207
|
-
setv(
|
|
208
|
-
to_object,
|
|
209
|
-
['codeExecutionResult'],
|
|
210
|
-
getv(from_object, ['code_execution_result']),
|
|
211
|
-
)
|
|
212
|
-
|
|
213
|
-
if getv(from_object, ['executable_code']) is not None:
|
|
214
|
-
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
|
215
|
-
|
|
216
|
-
if getv(from_object, ['function_call']) is not None:
|
|
217
|
-
setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
|
|
218
|
-
|
|
219
|
-
if getv(from_object, ['function_response']) is not None:
|
|
220
|
-
setv(
|
|
221
|
-
to_object,
|
|
222
|
-
['functionResponse'],
|
|
223
|
-
getv(from_object, ['function_response']),
|
|
224
|
-
)
|
|
225
|
-
|
|
226
|
-
if getv(from_object, ['text']) is not None:
|
|
227
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
|
228
|
-
|
|
229
|
-
return to_object
|
|
230
|
-
|
|
231
|
-
|
|
232
43
|
def _Content_to_mldev(
|
|
233
44
|
from_object: Union[dict[str, Any], object],
|
|
234
45
|
parent_object: Optional[dict[str, Any]] = None,
|
|
@@ -250,325 +61,153 @@ def _Content_to_mldev(
|
|
|
250
61
|
return to_object
|
|
251
62
|
|
|
252
63
|
|
|
253
|
-
def
|
|
64
|
+
def _CreateAuthTokenConfig_to_mldev(
|
|
65
|
+
api_client: BaseApiClient,
|
|
254
66
|
from_object: Union[dict[str, Any], object],
|
|
255
67
|
parent_object: Optional[dict[str, Any]] = None,
|
|
256
68
|
) -> dict[str, Any]:
|
|
257
69
|
to_object: dict[str, Any] = {}
|
|
258
|
-
if getv(from_object, ['behavior']) is not None:
|
|
259
|
-
setv(to_object, ['behavior'], getv(from_object, ['behavior']))
|
|
260
70
|
|
|
261
|
-
if getv(from_object, ['
|
|
262
|
-
setv(
|
|
263
|
-
|
|
264
|
-
if getv(from_object, ['name']) is not None:
|
|
265
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
|
266
|
-
|
|
267
|
-
if getv(from_object, ['parameters']) is not None:
|
|
268
|
-
setv(to_object, ['parameters'], getv(from_object, ['parameters']))
|
|
269
|
-
|
|
270
|
-
if getv(from_object, ['parameters_json_schema']) is not None:
|
|
271
|
-
setv(
|
|
272
|
-
to_object,
|
|
273
|
-
['parametersJsonSchema'],
|
|
274
|
-
getv(from_object, ['parameters_json_schema']),
|
|
275
|
-
)
|
|
276
|
-
|
|
277
|
-
if getv(from_object, ['response']) is not None:
|
|
278
|
-
setv(to_object, ['response'], getv(from_object, ['response']))
|
|
71
|
+
if getv(from_object, ['expire_time']) is not None:
|
|
72
|
+
setv(parent_object, ['expireTime'], getv(from_object, ['expire_time']))
|
|
279
73
|
|
|
280
|
-
if getv(from_object, ['
|
|
74
|
+
if getv(from_object, ['new_session_expire_time']) is not None:
|
|
281
75
|
setv(
|
|
282
|
-
|
|
283
|
-
['
|
|
284
|
-
getv(from_object, ['
|
|
76
|
+
parent_object,
|
|
77
|
+
['newSessionExpireTime'],
|
|
78
|
+
getv(from_object, ['new_session_expire_time']),
|
|
285
79
|
)
|
|
286
80
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
def _Interval_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, ['start_time']) is not None:
|
|
296
|
-
setv(to_object, ['startTime'], getv(from_object, ['start_time']))
|
|
297
|
-
|
|
298
|
-
if getv(from_object, ['end_time']) is not None:
|
|
299
|
-
setv(to_object, ['endTime'], getv(from_object, ['end_time']))
|
|
300
|
-
|
|
301
|
-
return to_object
|
|
302
|
-
|
|
81
|
+
if getv(from_object, ['uses']) is not None:
|
|
82
|
+
setv(parent_object, ['uses'], getv(from_object, ['uses']))
|
|
303
83
|
|
|
304
|
-
|
|
305
|
-
from_object: Union[dict[str, Any], object],
|
|
306
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
307
|
-
) -> dict[str, Any]:
|
|
308
|
-
to_object: dict[str, Any] = {}
|
|
309
|
-
if getv(from_object, ['time_range_filter']) is not None:
|
|
84
|
+
if getv(from_object, ['live_connect_constraints']) is not None:
|
|
310
85
|
setv(
|
|
311
|
-
|
|
312
|
-
['
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
'exclude_domains parameter is not supported in Gemini API.'
|
|
86
|
+
parent_object,
|
|
87
|
+
['bidiGenerateContentSetup'],
|
|
88
|
+
_LiveConnectConstraints_to_mldev(
|
|
89
|
+
api_client,
|
|
90
|
+
getv(from_object, ['live_connect_constraints']),
|
|
91
|
+
to_object,
|
|
92
|
+
),
|
|
319
93
|
)
|
|
320
94
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
def _DynamicRetrievalConfig_to_mldev(
|
|
325
|
-
from_object: Union[dict[str, Any], object],
|
|
326
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
327
|
-
) -> dict[str, Any]:
|
|
328
|
-
to_object: dict[str, Any] = {}
|
|
329
|
-
if getv(from_object, ['mode']) is not None:
|
|
330
|
-
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
|
331
|
-
|
|
332
|
-
if getv(from_object, ['dynamic_threshold']) is not None:
|
|
95
|
+
if getv(from_object, ['lock_additional_fields']) is not None:
|
|
333
96
|
setv(
|
|
334
|
-
|
|
335
|
-
['
|
|
336
|
-
getv(from_object, ['
|
|
97
|
+
parent_object,
|
|
98
|
+
['fieldMask'],
|
|
99
|
+
getv(from_object, ['lock_additional_fields']),
|
|
337
100
|
)
|
|
338
101
|
|
|
339
102
|
return to_object
|
|
340
103
|
|
|
341
104
|
|
|
342
|
-
def
|
|
105
|
+
def _CreateAuthTokenParameters_to_mldev(
|
|
106
|
+
api_client: BaseApiClient,
|
|
343
107
|
from_object: Union[dict[str, Any], object],
|
|
344
108
|
parent_object: Optional[dict[str, Any]] = None,
|
|
345
109
|
) -> dict[str, Any]:
|
|
346
110
|
to_object: dict[str, Any] = {}
|
|
347
|
-
if getv(from_object, ['
|
|
111
|
+
if getv(from_object, ['config']) is not None:
|
|
348
112
|
setv(
|
|
349
113
|
to_object,
|
|
350
|
-
['
|
|
351
|
-
|
|
352
|
-
getv(from_object, ['
|
|
114
|
+
['config'],
|
|
115
|
+
_CreateAuthTokenConfig_to_mldev(
|
|
116
|
+
api_client, getv(from_object, ['config']), to_object
|
|
353
117
|
),
|
|
354
118
|
)
|
|
355
119
|
|
|
356
120
|
return to_object
|
|
357
121
|
|
|
358
122
|
|
|
359
|
-
def
|
|
360
|
-
from_object: Union[dict[str, Any], object],
|
|
361
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
362
|
-
) -> dict[str, Any]:
|
|
363
|
-
to_object: dict[str, Any] = {}
|
|
364
|
-
|
|
365
|
-
return to_object
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
def _ToolComputerUse_to_mldev(
|
|
123
|
+
def _CreateAuthTokenParameters_to_vertex(
|
|
369
124
|
from_object: Union[dict[str, Any], object],
|
|
370
125
|
parent_object: Optional[dict[str, Any]] = None,
|
|
371
126
|
) -> dict[str, Any]:
|
|
372
127
|
to_object: dict[str, Any] = {}
|
|
373
|
-
if getv(from_object, ['
|
|
374
|
-
|
|
128
|
+
if getv(from_object, ['config']) is not None:
|
|
129
|
+
raise ValueError('config parameter is not supported in Vertex AI.')
|
|
375
130
|
|
|
376
131
|
return to_object
|
|
377
132
|
|
|
378
133
|
|
|
379
|
-
def
|
|
134
|
+
def _FileData_to_mldev(
|
|
380
135
|
from_object: Union[dict[str, Any], object],
|
|
381
136
|
parent_object: Optional[dict[str, Any]] = None,
|
|
382
137
|
) -> dict[str, Any]:
|
|
383
138
|
to_object: dict[str, Any] = {}
|
|
384
|
-
if getv(from_object, ['
|
|
385
|
-
|
|
386
|
-
to_object,
|
|
387
|
-
['functionDeclarations'],
|
|
388
|
-
[
|
|
389
|
-
_FunctionDeclaration_to_mldev(item, to_object)
|
|
390
|
-
for item in getv(from_object, ['function_declarations'])
|
|
391
|
-
],
|
|
392
|
-
)
|
|
393
|
-
|
|
394
|
-
if getv(from_object, ['retrieval']) is not None:
|
|
395
|
-
raise ValueError('retrieval parameter is not supported in Gemini API.')
|
|
396
|
-
|
|
397
|
-
if getv(from_object, ['google_search']) is not None:
|
|
398
|
-
setv(
|
|
399
|
-
to_object,
|
|
400
|
-
['googleSearch'],
|
|
401
|
-
_GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
|
|
402
|
-
)
|
|
403
|
-
|
|
404
|
-
if getv(from_object, ['google_search_retrieval']) is not None:
|
|
405
|
-
setv(
|
|
406
|
-
to_object,
|
|
407
|
-
['googleSearchRetrieval'],
|
|
408
|
-
_GoogleSearchRetrieval_to_mldev(
|
|
409
|
-
getv(from_object, ['google_search_retrieval']), to_object
|
|
410
|
-
),
|
|
411
|
-
)
|
|
412
|
-
|
|
413
|
-
if getv(from_object, ['enterprise_web_search']) is not None:
|
|
414
|
-
raise ValueError(
|
|
415
|
-
'enterprise_web_search parameter is not supported in Gemini API.'
|
|
416
|
-
)
|
|
417
|
-
|
|
418
|
-
if getv(from_object, ['google_maps']) is not None:
|
|
419
|
-
raise ValueError('google_maps parameter is not supported in Gemini API.')
|
|
420
|
-
|
|
421
|
-
if getv(from_object, ['url_context']) is not None:
|
|
422
|
-
setv(
|
|
423
|
-
to_object,
|
|
424
|
-
['urlContext'],
|
|
425
|
-
_UrlContext_to_mldev(getv(from_object, ['url_context']), to_object),
|
|
426
|
-
)
|
|
139
|
+
if getv(from_object, ['display_name']) is not None:
|
|
140
|
+
raise ValueError('display_name parameter is not supported in Gemini API.')
|
|
427
141
|
|
|
428
|
-
if getv(from_object, ['
|
|
429
|
-
setv(
|
|
430
|
-
to_object,
|
|
431
|
-
['computerUse'],
|
|
432
|
-
_ToolComputerUse_to_mldev(
|
|
433
|
-
getv(from_object, ['computer_use']), to_object
|
|
434
|
-
),
|
|
435
|
-
)
|
|
142
|
+
if getv(from_object, ['file_uri']) is not None:
|
|
143
|
+
setv(to_object, ['fileUri'], getv(from_object, ['file_uri']))
|
|
436
144
|
|
|
437
|
-
if getv(from_object, ['
|
|
438
|
-
setv(to_object, ['
|
|
145
|
+
if getv(from_object, ['mime_type']) is not None:
|
|
146
|
+
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
|
439
147
|
|
|
440
148
|
return to_object
|
|
441
149
|
|
|
442
150
|
|
|
443
|
-
def
|
|
151
|
+
def _FunctionCall_to_mldev(
|
|
444
152
|
from_object: Union[dict[str, Any], object],
|
|
445
153
|
parent_object: Optional[dict[str, Any]] = None,
|
|
446
154
|
) -> dict[str, Any]:
|
|
447
155
|
to_object: dict[str, Any] = {}
|
|
448
|
-
if getv(from_object, ['
|
|
449
|
-
setv(to_object, ['
|
|
156
|
+
if getv(from_object, ['id']) is not None:
|
|
157
|
+
setv(to_object, ['id'], getv(from_object, ['id']))
|
|
450
158
|
|
|
451
|
-
if getv(from_object, ['
|
|
452
|
-
|
|
159
|
+
if getv(from_object, ['args']) is not None:
|
|
160
|
+
setv(to_object, ['args'], getv(from_object, ['args']))
|
|
453
161
|
|
|
454
|
-
|
|
162
|
+
if getv(from_object, ['name']) is not None:
|
|
163
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
|
455
164
|
|
|
165
|
+
if getv(from_object, ['partial_args']) is not None:
|
|
166
|
+
raise ValueError('partial_args parameter is not supported in Gemini API.')
|
|
456
167
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
460
|
-
) -> dict[str, Any]:
|
|
461
|
-
to_object: dict[str, Any] = {}
|
|
168
|
+
if getv(from_object, ['will_continue']) is not None:
|
|
169
|
+
raise ValueError('will_continue parameter is not supported in Gemini API.')
|
|
462
170
|
|
|
463
171
|
return to_object
|
|
464
172
|
|
|
465
173
|
|
|
466
|
-
def
|
|
174
|
+
def _GoogleMaps_to_mldev(
|
|
467
175
|
from_object: Union[dict[str, Any], object],
|
|
468
176
|
parent_object: Optional[dict[str, Any]] = None,
|
|
469
177
|
) -> dict[str, Any]:
|
|
470
178
|
to_object: dict[str, Any] = {}
|
|
471
|
-
if getv(from_object, ['
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
if getv(from_object, ['start_of_speech_sensitivity']) is not None:
|
|
475
|
-
setv(
|
|
476
|
-
to_object,
|
|
477
|
-
['startOfSpeechSensitivity'],
|
|
478
|
-
getv(from_object, ['start_of_speech_sensitivity']),
|
|
479
|
-
)
|
|
480
|
-
|
|
481
|
-
if getv(from_object, ['end_of_speech_sensitivity']) is not None:
|
|
482
|
-
setv(
|
|
483
|
-
to_object,
|
|
484
|
-
['endOfSpeechSensitivity'],
|
|
485
|
-
getv(from_object, ['end_of_speech_sensitivity']),
|
|
486
|
-
)
|
|
179
|
+
if getv(from_object, ['auth_config']) is not None:
|
|
180
|
+
raise ValueError('auth_config parameter is not supported in Gemini API.')
|
|
487
181
|
|
|
488
|
-
if getv(from_object, ['
|
|
489
|
-
setv(
|
|
490
|
-
to_object, ['prefixPaddingMs'], getv(from_object, ['prefix_padding_ms'])
|
|
491
|
-
)
|
|
492
|
-
|
|
493
|
-
if getv(from_object, ['silence_duration_ms']) is not None:
|
|
494
|
-
setv(
|
|
495
|
-
to_object,
|
|
496
|
-
['silenceDurationMs'],
|
|
497
|
-
getv(from_object, ['silence_duration_ms']),
|
|
498
|
-
)
|
|
182
|
+
if getv(from_object, ['enable_widget']) is not None:
|
|
183
|
+
setv(to_object, ['enableWidget'], getv(from_object, ['enable_widget']))
|
|
499
184
|
|
|
500
185
|
return to_object
|
|
501
186
|
|
|
502
187
|
|
|
503
|
-
def
|
|
188
|
+
def _GoogleSearch_to_mldev(
|
|
504
189
|
from_object: Union[dict[str, Any], object],
|
|
505
190
|
parent_object: Optional[dict[str, Any]] = None,
|
|
506
191
|
) -> dict[str, Any]:
|
|
507
192
|
to_object: dict[str, Any] = {}
|
|
508
|
-
if getv(from_object, ['
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
['automaticActivityDetection'],
|
|
512
|
-
_AutomaticActivityDetection_to_mldev(
|
|
513
|
-
getv(from_object, ['automatic_activity_detection']), to_object
|
|
514
|
-
),
|
|
193
|
+
if getv(from_object, ['exclude_domains']) is not None:
|
|
194
|
+
raise ValueError(
|
|
195
|
+
'exclude_domains parameter is not supported in Gemini API.'
|
|
515
196
|
)
|
|
516
197
|
|
|
517
|
-
if getv(from_object, ['
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
['activityHandling'],
|
|
521
|
-
getv(from_object, ['activity_handling']),
|
|
198
|
+
if getv(from_object, ['blocking_confidence']) is not None:
|
|
199
|
+
raise ValueError(
|
|
200
|
+
'blocking_confidence parameter is not supported in Gemini API.'
|
|
522
201
|
)
|
|
523
202
|
|
|
524
|
-
if getv(from_object, ['
|
|
525
|
-
setv(to_object, ['turnCoverage'], getv(from_object, ['turn_coverage']))
|
|
526
|
-
|
|
527
|
-
return to_object
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
def _SlidingWindow_to_mldev(
|
|
531
|
-
from_object: Union[dict[str, Any], object],
|
|
532
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
533
|
-
) -> dict[str, Any]:
|
|
534
|
-
to_object: dict[str, Any] = {}
|
|
535
|
-
if getv(from_object, ['target_tokens']) is not None:
|
|
536
|
-
setv(to_object, ['targetTokens'], getv(from_object, ['target_tokens']))
|
|
537
|
-
|
|
538
|
-
return to_object
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
def _ContextWindowCompressionConfig_to_mldev(
|
|
542
|
-
from_object: Union[dict[str, Any], object],
|
|
543
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
544
|
-
) -> dict[str, Any]:
|
|
545
|
-
to_object: dict[str, Any] = {}
|
|
546
|
-
if getv(from_object, ['trigger_tokens']) is not None:
|
|
547
|
-
setv(to_object, ['triggerTokens'], getv(from_object, ['trigger_tokens']))
|
|
548
|
-
|
|
549
|
-
if getv(from_object, ['sliding_window']) is not None:
|
|
203
|
+
if getv(from_object, ['time_range_filter']) is not None:
|
|
550
204
|
setv(
|
|
551
|
-
to_object,
|
|
552
|
-
['slidingWindow'],
|
|
553
|
-
_SlidingWindow_to_mldev(
|
|
554
|
-
getv(from_object, ['sliding_window']), to_object
|
|
555
|
-
),
|
|
205
|
+
to_object, ['timeRangeFilter'], getv(from_object, ['time_range_filter'])
|
|
556
206
|
)
|
|
557
207
|
|
|
558
208
|
return to_object
|
|
559
209
|
|
|
560
210
|
|
|
561
|
-
def _ProactivityConfig_to_mldev(
|
|
562
|
-
from_object: Union[dict[str, Any], object],
|
|
563
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
564
|
-
) -> dict[str, Any]:
|
|
565
|
-
to_object: dict[str, Any] = {}
|
|
566
|
-
if getv(from_object, ['proactive_audio']) is not None:
|
|
567
|
-
setv(to_object, ['proactiveAudio'], getv(from_object, ['proactive_audio']))
|
|
568
|
-
|
|
569
|
-
return to_object
|
|
570
|
-
|
|
571
|
-
|
|
572
211
|
def _LiveConnectConfig_to_mldev(
|
|
573
212
|
api_client: BaseApiClient,
|
|
574
213
|
from_object: Union[dict[str, Any], object],
|
|
@@ -636,10 +275,14 @@ def _LiveConnectConfig_to_mldev(
|
|
|
636
275
|
setv(
|
|
637
276
|
parent_object,
|
|
638
277
|
['setup', 'generationConfig', 'speechConfig'],
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
278
|
+
t.t_live_speech_config(getv(from_object, ['speech_config'])),
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
if getv(from_object, ['thinking_config']) is not None:
|
|
282
|
+
setv(
|
|
283
|
+
parent_object,
|
|
284
|
+
['setup', 'generationConfig', 'thinkingConfig'],
|
|
285
|
+
getv(from_object, ['thinking_config']),
|
|
643
286
|
)
|
|
644
287
|
|
|
645
288
|
if getv(from_object, ['enable_affective_dialog']) is not None:
|
|
@@ -681,45 +324,35 @@ def _LiveConnectConfig_to_mldev(
|
|
|
681
324
|
setv(
|
|
682
325
|
parent_object,
|
|
683
326
|
['setup', 'inputAudioTranscription'],
|
|
684
|
-
|
|
685
|
-
getv(from_object, ['input_audio_transcription']), to_object
|
|
686
|
-
),
|
|
327
|
+
getv(from_object, ['input_audio_transcription']),
|
|
687
328
|
)
|
|
688
329
|
|
|
689
330
|
if getv(from_object, ['output_audio_transcription']) is not None:
|
|
690
331
|
setv(
|
|
691
332
|
parent_object,
|
|
692
333
|
['setup', 'outputAudioTranscription'],
|
|
693
|
-
|
|
694
|
-
getv(from_object, ['output_audio_transcription']), to_object
|
|
695
|
-
),
|
|
334
|
+
getv(from_object, ['output_audio_transcription']),
|
|
696
335
|
)
|
|
697
336
|
|
|
698
337
|
if getv(from_object, ['realtime_input_config']) is not None:
|
|
699
338
|
setv(
|
|
700
339
|
parent_object,
|
|
701
340
|
['setup', 'realtimeInputConfig'],
|
|
702
|
-
|
|
703
|
-
getv(from_object, ['realtime_input_config']), to_object
|
|
704
|
-
),
|
|
341
|
+
getv(from_object, ['realtime_input_config']),
|
|
705
342
|
)
|
|
706
343
|
|
|
707
344
|
if getv(from_object, ['context_window_compression']) is not None:
|
|
708
345
|
setv(
|
|
709
346
|
parent_object,
|
|
710
347
|
['setup', 'contextWindowCompression'],
|
|
711
|
-
|
|
712
|
-
getv(from_object, ['context_window_compression']), to_object
|
|
713
|
-
),
|
|
348
|
+
getv(from_object, ['context_window_compression']),
|
|
714
349
|
)
|
|
715
350
|
|
|
716
351
|
if getv(from_object, ['proactivity']) is not None:
|
|
717
352
|
setv(
|
|
718
353
|
parent_object,
|
|
719
354
|
['setup', 'proactivity'],
|
|
720
|
-
|
|
721
|
-
getv(from_object, ['proactivity']), to_object
|
|
722
|
-
),
|
|
355
|
+
getv(from_object, ['proactivity']),
|
|
723
356
|
)
|
|
724
357
|
|
|
725
358
|
return to_object
|
|
@@ -750,91 +383,138 @@ def _LiveConnectConstraints_to_mldev(
|
|
|
750
383
|
return to_object
|
|
751
384
|
|
|
752
385
|
|
|
753
|
-
def
|
|
754
|
-
api_client: BaseApiClient,
|
|
386
|
+
def _Part_to_mldev(
|
|
755
387
|
from_object: Union[dict[str, Any], object],
|
|
756
388
|
parent_object: Optional[dict[str, Any]] = None,
|
|
757
389
|
) -> dict[str, Any]:
|
|
758
390
|
to_object: dict[str, Any] = {}
|
|
391
|
+
if getv(from_object, ['media_resolution']) is not None:
|
|
392
|
+
setv(
|
|
393
|
+
to_object, ['mediaResolution'], getv(from_object, ['media_resolution'])
|
|
394
|
+
)
|
|
759
395
|
|
|
760
|
-
if getv(from_object, ['
|
|
761
|
-
setv(
|
|
396
|
+
if getv(from_object, ['code_execution_result']) is not None:
|
|
397
|
+
setv(
|
|
398
|
+
to_object,
|
|
399
|
+
['codeExecutionResult'],
|
|
400
|
+
getv(from_object, ['code_execution_result']),
|
|
401
|
+
)
|
|
762
402
|
|
|
763
|
-
if getv(from_object, ['
|
|
403
|
+
if getv(from_object, ['executable_code']) is not None:
|
|
404
|
+
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
|
405
|
+
|
|
406
|
+
if getv(from_object, ['file_data']) is not None:
|
|
764
407
|
setv(
|
|
765
|
-
|
|
766
|
-
['
|
|
767
|
-
getv(from_object, ['
|
|
408
|
+
to_object,
|
|
409
|
+
['fileData'],
|
|
410
|
+
_FileData_to_mldev(getv(from_object, ['file_data']), to_object),
|
|
768
411
|
)
|
|
769
412
|
|
|
770
|
-
if getv(from_object, ['
|
|
771
|
-
setv(
|
|
413
|
+
if getv(from_object, ['function_call']) is not None:
|
|
414
|
+
setv(
|
|
415
|
+
to_object,
|
|
416
|
+
['functionCall'],
|
|
417
|
+
_FunctionCall_to_mldev(getv(from_object, ['function_call']), to_object),
|
|
418
|
+
)
|
|
772
419
|
|
|
773
|
-
if getv(from_object, ['
|
|
420
|
+
if getv(from_object, ['function_response']) is not None:
|
|
774
421
|
setv(
|
|
775
|
-
|
|
776
|
-
['
|
|
777
|
-
|
|
778
|
-
api_client,
|
|
779
|
-
getv(from_object, ['live_connect_constraints']),
|
|
780
|
-
to_object,
|
|
781
|
-
),
|
|
422
|
+
to_object,
|
|
423
|
+
['functionResponse'],
|
|
424
|
+
getv(from_object, ['function_response']),
|
|
782
425
|
)
|
|
783
426
|
|
|
784
|
-
if getv(from_object, ['
|
|
427
|
+
if getv(from_object, ['inline_data']) is not None:
|
|
785
428
|
setv(
|
|
786
|
-
|
|
787
|
-
['
|
|
788
|
-
getv(from_object, ['
|
|
429
|
+
to_object,
|
|
430
|
+
['inlineData'],
|
|
431
|
+
_Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
|
|
789
432
|
)
|
|
790
433
|
|
|
791
|
-
|
|
434
|
+
if getv(from_object, ['text']) is not None:
|
|
435
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
|
792
436
|
|
|
437
|
+
if getv(from_object, ['thought']) is not None:
|
|
438
|
+
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
|
793
439
|
|
|
794
|
-
|
|
795
|
-
api_client: BaseApiClient,
|
|
796
|
-
from_object: Union[dict[str, Any], object],
|
|
797
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
798
|
-
) -> dict[str, Any]:
|
|
799
|
-
to_object: dict[str, Any] = {}
|
|
800
|
-
if getv(from_object, ['config']) is not None:
|
|
440
|
+
if getv(from_object, ['thought_signature']) is not None:
|
|
801
441
|
setv(
|
|
802
442
|
to_object,
|
|
803
|
-
['
|
|
804
|
-
|
|
805
|
-
api_client, getv(from_object, ['config']), to_object
|
|
806
|
-
),
|
|
443
|
+
['thoughtSignature'],
|
|
444
|
+
getv(from_object, ['thought_signature']),
|
|
807
445
|
)
|
|
808
446
|
|
|
447
|
+
if getv(from_object, ['video_metadata']) is not None:
|
|
448
|
+
setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
|
|
449
|
+
|
|
809
450
|
return to_object
|
|
810
451
|
|
|
811
452
|
|
|
812
|
-
def
|
|
453
|
+
def _SessionResumptionConfig_to_mldev(
|
|
813
454
|
from_object: Union[dict[str, Any], object],
|
|
814
455
|
parent_object: Optional[dict[str, Any]] = None,
|
|
815
456
|
) -> dict[str, Any]:
|
|
816
457
|
to_object: dict[str, Any] = {}
|
|
817
|
-
if getv(from_object, ['
|
|
818
|
-
|
|
458
|
+
if getv(from_object, ['handle']) is not None:
|
|
459
|
+
setv(to_object, ['handle'], getv(from_object, ['handle']))
|
|
460
|
+
|
|
461
|
+
if getv(from_object, ['transparent']) is not None:
|
|
462
|
+
raise ValueError('transparent parameter is not supported in Gemini API.')
|
|
819
463
|
|
|
820
464
|
return to_object
|
|
821
465
|
|
|
822
466
|
|
|
823
|
-
def
|
|
467
|
+
def _Tool_to_mldev(
|
|
824
468
|
from_object: Union[dict[str, Any], object],
|
|
825
469
|
parent_object: Optional[dict[str, Any]] = None,
|
|
826
470
|
) -> dict[str, Any]:
|
|
827
471
|
to_object: dict[str, Any] = {}
|
|
828
|
-
if getv(from_object, ['
|
|
829
|
-
setv(
|
|
472
|
+
if getv(from_object, ['function_declarations']) is not None:
|
|
473
|
+
setv(
|
|
474
|
+
to_object,
|
|
475
|
+
['functionDeclarations'],
|
|
476
|
+
[item for item in getv(from_object, ['function_declarations'])],
|
|
477
|
+
)
|
|
830
478
|
|
|
831
|
-
|
|
479
|
+
if getv(from_object, ['retrieval']) is not None:
|
|
480
|
+
raise ValueError('retrieval parameter is not supported in Gemini API.')
|
|
481
|
+
|
|
482
|
+
if getv(from_object, ['google_search_retrieval']) is not None:
|
|
483
|
+
setv(
|
|
484
|
+
to_object,
|
|
485
|
+
['googleSearchRetrieval'],
|
|
486
|
+
getv(from_object, ['google_search_retrieval']),
|
|
487
|
+
)
|
|
832
488
|
|
|
489
|
+
if getv(from_object, ['computer_use']) is not None:
|
|
490
|
+
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
|
833
491
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
492
|
+
if getv(from_object, ['file_search']) is not None:
|
|
493
|
+
setv(to_object, ['fileSearch'], getv(from_object, ['file_search']))
|
|
494
|
+
|
|
495
|
+
if getv(from_object, ['code_execution']) is not None:
|
|
496
|
+
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
|
497
|
+
|
|
498
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
|
499
|
+
raise ValueError(
|
|
500
|
+
'enterprise_web_search parameter is not supported in Gemini API.'
|
|
501
|
+
)
|
|
502
|
+
|
|
503
|
+
if getv(from_object, ['google_maps']) is not None:
|
|
504
|
+
setv(
|
|
505
|
+
to_object,
|
|
506
|
+
['googleMaps'],
|
|
507
|
+
_GoogleMaps_to_mldev(getv(from_object, ['google_maps']), to_object),
|
|
508
|
+
)
|
|
509
|
+
|
|
510
|
+
if getv(from_object, ['google_search']) is not None:
|
|
511
|
+
setv(
|
|
512
|
+
to_object,
|
|
513
|
+
['googleSearch'],
|
|
514
|
+
_GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
|
|
515
|
+
)
|
|
516
|
+
|
|
517
|
+
if getv(from_object, ['url_context']) is not None:
|
|
518
|
+
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
|
839
519
|
|
|
840
520
|
return to_object
|