google-genai 1.37.0__py3-none-any.whl → 1.39.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 +12 -0
- google/genai/_common.py +25 -10
- google/genai/_live_converters.py +2081 -1907
- google/genai/_operations_converters.py +108 -117
- google/genai/_replay_api_client.py +8 -4
- google/genai/_tokens_converters.py +465 -458
- google/genai/_transformers.py +44 -26
- google/genai/batches.py +1101 -1138
- google/genai/caches.py +747 -771
- google/genai/client.py +87 -0
- google/genai/files.py +110 -123
- google/genai/local_tokenizer.py +7 -2
- google/genai/models.py +2716 -2814
- google/genai/operations.py +10 -22
- google/genai/tunings.py +358 -391
- google/genai/types.py +222 -4
- google/genai/version.py +1 -1
- {google_genai-1.37.0.dist-info → google_genai-1.39.0.dist-info}/METADATA +82 -1
- google_genai-1.39.0.dist-info/RECORD +39 -0
- google_genai-1.37.0.dist-info/RECORD +0 -39
- {google_genai-1.37.0.dist-info → google_genai-1.39.0.dist-info}/WHEEL +0 -0
- {google_genai-1.37.0.dist-info → google_genai-1.39.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.37.0.dist-info → google_genai-1.39.0.dist-info}/top_level.txt +0 -0
@@ -23,127 +23,214 @@ 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
|
26
|
+
def _AudioTranscriptionConfig_to_mldev(
|
27
27
|
from_object: Union[dict[str, Any], object],
|
28
28
|
parent_object: Optional[dict[str, Any]] = None,
|
29
29
|
) -> dict[str, Any]:
|
30
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
31
|
|
34
32
|
return to_object
|
35
33
|
|
36
34
|
|
37
|
-
def
|
35
|
+
def _AuthToken_from_mldev(
|
38
36
|
from_object: Union[dict[str, Any], object],
|
39
37
|
parent_object: Optional[dict[str, Any]] = None,
|
40
38
|
) -> dict[str, Any]:
|
41
39
|
to_object: dict[str, Any] = {}
|
42
|
-
if getv(from_object, ['
|
43
|
-
setv(
|
44
|
-
to_object,
|
45
|
-
['prebuiltVoiceConfig'],
|
46
|
-
_PrebuiltVoiceConfig_to_mldev(
|
47
|
-
getv(from_object, ['prebuilt_voice_config']), to_object
|
48
|
-
),
|
49
|
-
)
|
40
|
+
if getv(from_object, ['name']) is not None:
|
41
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
50
42
|
|
51
43
|
return to_object
|
52
44
|
|
53
45
|
|
54
|
-
def
|
46
|
+
def _AuthToken_from_vertex(
|
55
47
|
from_object: Union[dict[str, Any], object],
|
56
48
|
parent_object: Optional[dict[str, Any]] = None,
|
57
49
|
) -> dict[str, Any]:
|
58
50
|
to_object: dict[str, Any] = {}
|
59
|
-
if getv(from_object, ['speaker']) is not None:
|
60
|
-
setv(to_object, ['speaker'], getv(from_object, ['speaker']))
|
61
51
|
|
62
|
-
|
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:
|
63
64
|
setv(
|
64
65
|
to_object,
|
65
|
-
['
|
66
|
-
|
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']),
|
67
87
|
)
|
68
88
|
|
69
89
|
return to_object
|
70
90
|
|
71
91
|
|
72
|
-
def
|
92
|
+
def _Blob_to_mldev(
|
73
93
|
from_object: Union[dict[str, Any], object],
|
74
94
|
parent_object: Optional[dict[str, Any]] = None,
|
75
95
|
) -> dict[str, Any]:
|
76
96
|
to_object: dict[str, Any] = {}
|
77
|
-
if getv(from_object, ['
|
97
|
+
if getv(from_object, ['display_name']) is not None:
|
98
|
+
raise ValueError('display_name parameter is not supported in Gemini API.')
|
99
|
+
|
100
|
+
if getv(from_object, ['data']) is not None:
|
101
|
+
setv(to_object, ['data'], getv(from_object, ['data']))
|
102
|
+
|
103
|
+
if getv(from_object, ['mime_type']) is not None:
|
104
|
+
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
105
|
+
|
106
|
+
return to_object
|
107
|
+
|
108
|
+
|
109
|
+
def _Content_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, ['parts']) is not None:
|
78
115
|
setv(
|
79
116
|
to_object,
|
80
|
-
['
|
117
|
+
['parts'],
|
81
118
|
[
|
82
|
-
|
83
|
-
for item in getv(from_object, ['
|
119
|
+
_Part_to_mldev(item, to_object)
|
120
|
+
for item in getv(from_object, ['parts'])
|
84
121
|
],
|
85
122
|
)
|
86
123
|
|
124
|
+
if getv(from_object, ['role']) is not None:
|
125
|
+
setv(to_object, ['role'], getv(from_object, ['role']))
|
126
|
+
|
87
127
|
return to_object
|
88
128
|
|
89
129
|
|
90
|
-
def
|
130
|
+
def _ContextWindowCompressionConfig_to_mldev(
|
91
131
|
from_object: Union[dict[str, Any], object],
|
92
132
|
parent_object: Optional[dict[str, Any]] = None,
|
93
133
|
) -> dict[str, Any]:
|
94
134
|
to_object: dict[str, Any] = {}
|
95
|
-
if getv(from_object, ['
|
135
|
+
if getv(from_object, ['trigger_tokens']) is not None:
|
136
|
+
setv(to_object, ['triggerTokens'], getv(from_object, ['trigger_tokens']))
|
137
|
+
|
138
|
+
if getv(from_object, ['sliding_window']) is not None:
|
96
139
|
setv(
|
97
140
|
to_object,
|
98
|
-
['
|
99
|
-
|
141
|
+
['slidingWindow'],
|
142
|
+
_SlidingWindow_to_mldev(
|
143
|
+
getv(from_object, ['sliding_window']), to_object
|
144
|
+
),
|
100
145
|
)
|
101
146
|
|
102
|
-
|
147
|
+
return to_object
|
148
|
+
|
149
|
+
|
150
|
+
def _CreateAuthTokenConfig_to_mldev(
|
151
|
+
api_client: BaseApiClient,
|
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
|
+
|
157
|
+
if getv(from_object, ['expire_time']) is not None:
|
158
|
+
setv(parent_object, ['expireTime'], getv(from_object, ['expire_time']))
|
159
|
+
|
160
|
+
if getv(from_object, ['new_session_expire_time']) is not None:
|
103
161
|
setv(
|
104
|
-
|
105
|
-
['
|
106
|
-
|
107
|
-
|
162
|
+
parent_object,
|
163
|
+
['newSessionExpireTime'],
|
164
|
+
getv(from_object, ['new_session_expire_time']),
|
165
|
+
)
|
166
|
+
|
167
|
+
if getv(from_object, ['uses']) is not None:
|
168
|
+
setv(parent_object, ['uses'], getv(from_object, ['uses']))
|
169
|
+
|
170
|
+
if getv(from_object, ['live_connect_constraints']) is not None:
|
171
|
+
setv(
|
172
|
+
parent_object,
|
173
|
+
['bidiGenerateContentSetup'],
|
174
|
+
_LiveConnectConstraints_to_mldev(
|
175
|
+
api_client,
|
176
|
+
getv(from_object, ['live_connect_constraints']),
|
177
|
+
to_object,
|
108
178
|
),
|
109
179
|
)
|
110
180
|
|
111
|
-
if getv(from_object, ['
|
112
|
-
setv(
|
181
|
+
if getv(from_object, ['lock_additional_fields']) is not None:
|
182
|
+
setv(
|
183
|
+
parent_object,
|
184
|
+
['fieldMask'],
|
185
|
+
getv(from_object, ['lock_additional_fields']),
|
186
|
+
)
|
113
187
|
|
114
188
|
return to_object
|
115
189
|
|
116
190
|
|
117
|
-
def
|
191
|
+
def _CreateAuthTokenParameters_to_mldev(
|
192
|
+
api_client: BaseApiClient,
|
118
193
|
from_object: Union[dict[str, Any], object],
|
119
194
|
parent_object: Optional[dict[str, Any]] = None,
|
120
195
|
) -> dict[str, Any]:
|
121
196
|
to_object: dict[str, Any] = {}
|
122
|
-
if getv(from_object, ['
|
123
|
-
setv(
|
197
|
+
if getv(from_object, ['config']) is not None:
|
198
|
+
setv(
|
199
|
+
to_object,
|
200
|
+
['config'],
|
201
|
+
_CreateAuthTokenConfig_to_mldev(
|
202
|
+
api_client, getv(from_object, ['config']), to_object
|
203
|
+
),
|
204
|
+
)
|
124
205
|
|
125
|
-
|
126
|
-
setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
|
206
|
+
return to_object
|
127
207
|
|
128
|
-
|
129
|
-
|
208
|
+
|
209
|
+
def _CreateAuthTokenParameters_to_vertex(
|
210
|
+
from_object: Union[dict[str, Any], object],
|
211
|
+
parent_object: Optional[dict[str, Any]] = None,
|
212
|
+
) -> dict[str, Any]:
|
213
|
+
to_object: dict[str, Any] = {}
|
214
|
+
if getv(from_object, ['config']) is not None:
|
215
|
+
raise ValueError('config parameter is not supported in Vertex AI.')
|
130
216
|
|
131
217
|
return to_object
|
132
218
|
|
133
219
|
|
134
|
-
def
|
220
|
+
def _DynamicRetrievalConfig_to_mldev(
|
135
221
|
from_object: Union[dict[str, Any], object],
|
136
222
|
parent_object: Optional[dict[str, Any]] = None,
|
137
223
|
) -> dict[str, Any]:
|
138
224
|
to_object: dict[str, Any] = {}
|
139
|
-
if getv(from_object, ['
|
140
|
-
|
141
|
-
|
142
|
-
if getv(from_object, ['data']) is not None:
|
143
|
-
setv(to_object, ['data'], getv(from_object, ['data']))
|
225
|
+
if getv(from_object, ['mode']) is not None:
|
226
|
+
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
144
227
|
|
145
|
-
if getv(from_object, ['
|
146
|
-
setv(
|
228
|
+
if getv(from_object, ['dynamic_threshold']) is not None:
|
229
|
+
setv(
|
230
|
+
to_object,
|
231
|
+
['dynamicThreshold'],
|
232
|
+
getv(from_object, ['dynamic_threshold']),
|
233
|
+
)
|
147
234
|
|
148
235
|
return to_object
|
149
236
|
|
@@ -182,127 +269,75 @@ def _FunctionCall_to_mldev(
|
|
182
269
|
return to_object
|
183
270
|
|
184
271
|
|
185
|
-
def
|
272
|
+
def _FunctionDeclaration_to_mldev(
|
186
273
|
from_object: Union[dict[str, Any], object],
|
187
274
|
parent_object: Optional[dict[str, Any]] = None,
|
188
275
|
) -> dict[str, Any]:
|
189
276
|
to_object: dict[str, Any] = {}
|
190
|
-
if getv(from_object, ['
|
191
|
-
setv(
|
192
|
-
to_object,
|
193
|
-
['videoMetadata'],
|
194
|
-
_VideoMetadata_to_mldev(
|
195
|
-
getv(from_object, ['video_metadata']), to_object
|
196
|
-
),
|
197
|
-
)
|
198
|
-
|
199
|
-
if getv(from_object, ['thought']) is not None:
|
200
|
-
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
201
|
-
|
202
|
-
if getv(from_object, ['inline_data']) is not None:
|
203
|
-
setv(
|
204
|
-
to_object,
|
205
|
-
['inlineData'],
|
206
|
-
_Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
|
207
|
-
)
|
277
|
+
if getv(from_object, ['behavior']) is not None:
|
278
|
+
setv(to_object, ['behavior'], getv(from_object, ['behavior']))
|
208
279
|
|
209
|
-
if getv(from_object, ['
|
210
|
-
setv(
|
211
|
-
to_object,
|
212
|
-
['fileData'],
|
213
|
-
_FileData_to_mldev(getv(from_object, ['file_data']), to_object),
|
214
|
-
)
|
280
|
+
if getv(from_object, ['description']) is not None:
|
281
|
+
setv(to_object, ['description'], getv(from_object, ['description']))
|
215
282
|
|
216
|
-
if getv(from_object, ['
|
217
|
-
setv(
|
218
|
-
to_object,
|
219
|
-
['thoughtSignature'],
|
220
|
-
getv(from_object, ['thought_signature']),
|
221
|
-
)
|
283
|
+
if getv(from_object, ['name']) is not None:
|
284
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
222
285
|
|
223
|
-
if getv(from_object, ['
|
224
|
-
setv(
|
225
|
-
to_object,
|
226
|
-
['functionCall'],
|
227
|
-
_FunctionCall_to_mldev(getv(from_object, ['function_call']), to_object),
|
228
|
-
)
|
286
|
+
if getv(from_object, ['parameters']) is not None:
|
287
|
+
setv(to_object, ['parameters'], getv(from_object, ['parameters']))
|
229
288
|
|
230
|
-
if getv(from_object, ['
|
289
|
+
if getv(from_object, ['parameters_json_schema']) is not None:
|
231
290
|
setv(
|
232
291
|
to_object,
|
233
|
-
['
|
234
|
-
getv(from_object, ['
|
292
|
+
['parametersJsonSchema'],
|
293
|
+
getv(from_object, ['parameters_json_schema']),
|
235
294
|
)
|
236
295
|
|
237
|
-
if getv(from_object, ['
|
238
|
-
setv(to_object, ['
|
296
|
+
if getv(from_object, ['response']) is not None:
|
297
|
+
setv(to_object, ['response'], getv(from_object, ['response']))
|
239
298
|
|
240
|
-
if getv(from_object, ['
|
299
|
+
if getv(from_object, ['response_json_schema']) is not None:
|
241
300
|
setv(
|
242
301
|
to_object,
|
243
|
-
['
|
244
|
-
getv(from_object, ['
|
302
|
+
['responseJsonSchema'],
|
303
|
+
getv(from_object, ['response_json_schema']),
|
245
304
|
)
|
246
305
|
|
247
|
-
if getv(from_object, ['text']) is not None:
|
248
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
249
|
-
|
250
306
|
return to_object
|
251
307
|
|
252
308
|
|
253
|
-
def
|
309
|
+
def _GoogleSearchRetrieval_to_mldev(
|
254
310
|
from_object: Union[dict[str, Any], object],
|
255
311
|
parent_object: Optional[dict[str, Any]] = None,
|
256
312
|
) -> dict[str, Any]:
|
257
313
|
to_object: dict[str, Any] = {}
|
258
|
-
if getv(from_object, ['
|
314
|
+
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
259
315
|
setv(
|
260
316
|
to_object,
|
261
|
-
['
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
],
|
317
|
+
['dynamicRetrievalConfig'],
|
318
|
+
_DynamicRetrievalConfig_to_mldev(
|
319
|
+
getv(from_object, ['dynamic_retrieval_config']), to_object
|
320
|
+
),
|
266
321
|
)
|
267
322
|
|
268
|
-
if getv(from_object, ['role']) is not None:
|
269
|
-
setv(to_object, ['role'], getv(from_object, ['role']))
|
270
|
-
|
271
323
|
return to_object
|
272
324
|
|
273
325
|
|
274
|
-
def
|
326
|
+
def _GoogleSearch_to_mldev(
|
275
327
|
from_object: Union[dict[str, Any], object],
|
276
328
|
parent_object: Optional[dict[str, Any]] = None,
|
277
329
|
) -> dict[str, Any]:
|
278
330
|
to_object: dict[str, Any] = {}
|
279
|
-
if getv(from_object, ['
|
280
|
-
setv(to_object, ['behavior'], getv(from_object, ['behavior']))
|
281
|
-
|
282
|
-
if getv(from_object, ['description']) is not None:
|
283
|
-
setv(to_object, ['description'], getv(from_object, ['description']))
|
284
|
-
|
285
|
-
if getv(from_object, ['name']) is not None:
|
286
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
287
|
-
|
288
|
-
if getv(from_object, ['parameters']) is not None:
|
289
|
-
setv(to_object, ['parameters'], getv(from_object, ['parameters']))
|
290
|
-
|
291
|
-
if getv(from_object, ['parameters_json_schema']) is not None:
|
331
|
+
if getv(from_object, ['time_range_filter']) is not None:
|
292
332
|
setv(
|
293
333
|
to_object,
|
294
|
-
['
|
295
|
-
getv(from_object, ['
|
334
|
+
['timeRangeFilter'],
|
335
|
+
_Interval_to_mldev(getv(from_object, ['time_range_filter']), to_object),
|
296
336
|
)
|
297
337
|
|
298
|
-
if getv(from_object, ['
|
299
|
-
|
300
|
-
|
301
|
-
if getv(from_object, ['response_json_schema']) is not None:
|
302
|
-
setv(
|
303
|
-
to_object,
|
304
|
-
['responseJsonSchema'],
|
305
|
-
getv(from_object, ['response_json_schema']),
|
338
|
+
if getv(from_object, ['exclude_domains']) is not None:
|
339
|
+
raise ValueError(
|
340
|
+
'exclude_domains parameter is not supported in Gemini API.'
|
306
341
|
)
|
307
342
|
|
308
343
|
return to_object
|
@@ -322,202 +357,292 @@ def _Interval_to_mldev(
|
|
322
357
|
return to_object
|
323
358
|
|
324
359
|
|
325
|
-
def
|
360
|
+
def _LiveConnectConfig_to_mldev(
|
361
|
+
api_client: BaseApiClient,
|
326
362
|
from_object: Union[dict[str, Any], object],
|
327
363
|
parent_object: Optional[dict[str, Any]] = None,
|
328
364
|
) -> dict[str, Any]:
|
329
365
|
to_object: dict[str, Any] = {}
|
330
|
-
|
366
|
+
|
367
|
+
if getv(from_object, ['generation_config']) is not None:
|
331
368
|
setv(
|
332
|
-
|
333
|
-
['
|
334
|
-
|
369
|
+
parent_object,
|
370
|
+
['setup', 'generationConfig'],
|
371
|
+
getv(from_object, ['generation_config']),
|
335
372
|
)
|
336
373
|
|
337
|
-
if getv(from_object, ['
|
338
|
-
|
339
|
-
|
374
|
+
if getv(from_object, ['response_modalities']) is not None:
|
375
|
+
setv(
|
376
|
+
parent_object,
|
377
|
+
['setup', 'generationConfig', 'responseModalities'],
|
378
|
+
getv(from_object, ['response_modalities']),
|
340
379
|
)
|
341
380
|
|
342
|
-
|
381
|
+
if getv(from_object, ['temperature']) is not None:
|
382
|
+
setv(
|
383
|
+
parent_object,
|
384
|
+
['setup', 'generationConfig', 'temperature'],
|
385
|
+
getv(from_object, ['temperature']),
|
386
|
+
)
|
343
387
|
|
388
|
+
if getv(from_object, ['top_p']) is not None:
|
389
|
+
setv(
|
390
|
+
parent_object,
|
391
|
+
['setup', 'generationConfig', 'topP'],
|
392
|
+
getv(from_object, ['top_p']),
|
393
|
+
)
|
344
394
|
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
395
|
+
if getv(from_object, ['top_k']) is not None:
|
396
|
+
setv(
|
397
|
+
parent_object,
|
398
|
+
['setup', 'generationConfig', 'topK'],
|
399
|
+
getv(from_object, ['top_k']),
|
400
|
+
)
|
352
401
|
|
353
|
-
if getv(from_object, ['
|
402
|
+
if getv(from_object, ['max_output_tokens']) is not None:
|
354
403
|
setv(
|
355
|
-
|
356
|
-
['
|
357
|
-
getv(from_object, ['
|
404
|
+
parent_object,
|
405
|
+
['setup', 'generationConfig', 'maxOutputTokens'],
|
406
|
+
getv(from_object, ['max_output_tokens']),
|
358
407
|
)
|
359
408
|
|
360
|
-
|
409
|
+
if getv(from_object, ['media_resolution']) is not None:
|
410
|
+
setv(
|
411
|
+
parent_object,
|
412
|
+
['setup', 'generationConfig', 'mediaResolution'],
|
413
|
+
getv(from_object, ['media_resolution']),
|
414
|
+
)
|
361
415
|
|
416
|
+
if getv(from_object, ['seed']) is not None:
|
417
|
+
setv(
|
418
|
+
parent_object,
|
419
|
+
['setup', 'generationConfig', 'seed'],
|
420
|
+
getv(from_object, ['seed']),
|
421
|
+
)
|
362
422
|
|
363
|
-
|
364
|
-
from_object: Union[dict[str, Any], object],
|
365
|
-
parent_object: Optional[dict[str, Any]] = None,
|
366
|
-
) -> dict[str, Any]:
|
367
|
-
to_object: dict[str, Any] = {}
|
368
|
-
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
423
|
+
if getv(from_object, ['speech_config']) is not None:
|
369
424
|
setv(
|
370
|
-
|
371
|
-
['
|
372
|
-
|
373
|
-
getv(from_object, ['
|
425
|
+
parent_object,
|
426
|
+
['setup', 'generationConfig', 'speechConfig'],
|
427
|
+
_SpeechConfig_to_mldev(
|
428
|
+
t.t_live_speech_config(getv(from_object, ['speech_config'])),
|
429
|
+
to_object,
|
374
430
|
),
|
375
431
|
)
|
376
432
|
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
) -> dict[str, Any]:
|
384
|
-
to_object: dict[str, Any] = {}
|
385
|
-
|
386
|
-
return to_object
|
387
|
-
|
388
|
-
|
389
|
-
def _ToolComputerUse_to_mldev(
|
390
|
-
from_object: Union[dict[str, Any], object],
|
391
|
-
parent_object: Optional[dict[str, Any]] = None,
|
392
|
-
) -> dict[str, Any]:
|
393
|
-
to_object: dict[str, Any] = {}
|
394
|
-
if getv(from_object, ['environment']) is not None:
|
395
|
-
setv(to_object, ['environment'], getv(from_object, ['environment']))
|
396
|
-
|
397
|
-
return to_object
|
433
|
+
if getv(from_object, ['enable_affective_dialog']) is not None:
|
434
|
+
setv(
|
435
|
+
parent_object,
|
436
|
+
['setup', 'generationConfig', 'enableAffectiveDialog'],
|
437
|
+
getv(from_object, ['enable_affective_dialog']),
|
438
|
+
)
|
398
439
|
|
440
|
+
if getv(from_object, ['system_instruction']) is not None:
|
441
|
+
setv(
|
442
|
+
parent_object,
|
443
|
+
['setup', 'systemInstruction'],
|
444
|
+
_Content_to_mldev(
|
445
|
+
t.t_content(getv(from_object, ['system_instruction'])), to_object
|
446
|
+
),
|
447
|
+
)
|
399
448
|
|
400
|
-
|
401
|
-
from_object: Union[dict[str, Any], object],
|
402
|
-
parent_object: Optional[dict[str, Any]] = None,
|
403
|
-
) -> dict[str, Any]:
|
404
|
-
to_object: dict[str, Any] = {}
|
405
|
-
if getv(from_object, ['function_declarations']) is not None:
|
449
|
+
if getv(from_object, ['tools']) is not None:
|
406
450
|
setv(
|
407
|
-
|
408
|
-
['
|
451
|
+
parent_object,
|
452
|
+
['setup', 'tools'],
|
409
453
|
[
|
410
|
-
|
411
|
-
for item in getv(from_object, ['
|
454
|
+
_Tool_to_mldev(t.t_tool(api_client, item), to_object)
|
455
|
+
for item in t.t_tools(api_client, getv(from_object, ['tools']))
|
412
456
|
],
|
413
457
|
)
|
414
458
|
|
415
|
-
if getv(from_object, ['
|
416
|
-
raise ValueError('retrieval parameter is not supported in Gemini API.')
|
417
|
-
|
418
|
-
if getv(from_object, ['google_search']) is not None:
|
459
|
+
if getv(from_object, ['session_resumption']) is not None:
|
419
460
|
setv(
|
420
|
-
|
421
|
-
['
|
422
|
-
|
461
|
+
parent_object,
|
462
|
+
['setup', 'sessionResumption'],
|
463
|
+
_SessionResumptionConfig_to_mldev(
|
464
|
+
getv(from_object, ['session_resumption']), to_object
|
465
|
+
),
|
423
466
|
)
|
424
467
|
|
425
|
-
if getv(from_object, ['
|
468
|
+
if getv(from_object, ['input_audio_transcription']) is not None:
|
426
469
|
setv(
|
427
|
-
|
428
|
-
['
|
429
|
-
|
430
|
-
getv(from_object, ['
|
470
|
+
parent_object,
|
471
|
+
['setup', 'inputAudioTranscription'],
|
472
|
+
_AudioTranscriptionConfig_to_mldev(
|
473
|
+
getv(from_object, ['input_audio_transcription']), to_object
|
431
474
|
),
|
432
475
|
)
|
433
476
|
|
434
|
-
if getv(from_object, ['
|
435
|
-
|
436
|
-
|
477
|
+
if getv(from_object, ['output_audio_transcription']) is not None:
|
478
|
+
setv(
|
479
|
+
parent_object,
|
480
|
+
['setup', 'outputAudioTranscription'],
|
481
|
+
_AudioTranscriptionConfig_to_mldev(
|
482
|
+
getv(from_object, ['output_audio_transcription']), to_object
|
483
|
+
),
|
437
484
|
)
|
438
485
|
|
439
|
-
if getv(from_object, ['
|
440
|
-
raise ValueError('google_maps parameter is not supported in Gemini API.')
|
441
|
-
|
442
|
-
if getv(from_object, ['url_context']) is not None:
|
486
|
+
if getv(from_object, ['realtime_input_config']) is not None:
|
443
487
|
setv(
|
444
|
-
|
445
|
-
['
|
446
|
-
|
488
|
+
parent_object,
|
489
|
+
['setup', 'realtimeInputConfig'],
|
490
|
+
_RealtimeInputConfig_to_mldev(
|
491
|
+
getv(from_object, ['realtime_input_config']), to_object
|
492
|
+
),
|
447
493
|
)
|
448
494
|
|
449
|
-
if getv(from_object, ['
|
495
|
+
if getv(from_object, ['context_window_compression']) is not None:
|
450
496
|
setv(
|
451
|
-
|
452
|
-
['
|
453
|
-
|
454
|
-
getv(from_object, ['
|
497
|
+
parent_object,
|
498
|
+
['setup', 'contextWindowCompression'],
|
499
|
+
_ContextWindowCompressionConfig_to_mldev(
|
500
|
+
getv(from_object, ['context_window_compression']), to_object
|
455
501
|
),
|
456
502
|
)
|
457
503
|
|
458
|
-
if getv(from_object, ['
|
459
|
-
setv(
|
504
|
+
if getv(from_object, ['proactivity']) is not None:
|
505
|
+
setv(
|
506
|
+
parent_object,
|
507
|
+
['setup', 'proactivity'],
|
508
|
+
_ProactivityConfig_to_mldev(
|
509
|
+
getv(from_object, ['proactivity']), to_object
|
510
|
+
),
|
511
|
+
)
|
460
512
|
|
461
513
|
return to_object
|
462
514
|
|
463
515
|
|
464
|
-
def
|
516
|
+
def _LiveConnectConstraints_to_mldev(
|
517
|
+
api_client: BaseApiClient,
|
465
518
|
from_object: Union[dict[str, Any], object],
|
466
519
|
parent_object: Optional[dict[str, Any]] = None,
|
467
520
|
) -> dict[str, Any]:
|
468
521
|
to_object: dict[str, Any] = {}
|
469
|
-
if getv(from_object, ['
|
470
|
-
setv(
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
return to_object
|
522
|
+
if getv(from_object, ['model']) is not None:
|
523
|
+
setv(
|
524
|
+
to_object,
|
525
|
+
['setup', 'model'],
|
526
|
+
t.t_model(api_client, getv(from_object, ['model'])),
|
527
|
+
)
|
476
528
|
|
529
|
+
if getv(from_object, ['config']) is not None:
|
530
|
+
setv(
|
531
|
+
to_object,
|
532
|
+
['config'],
|
533
|
+
_LiveConnectConfig_to_mldev(
|
534
|
+
api_client, getv(from_object, ['config']), to_object
|
535
|
+
),
|
536
|
+
)
|
477
537
|
|
478
|
-
|
538
|
+
return to_object
|
539
|
+
|
540
|
+
|
541
|
+
def _MultiSpeakerVoiceConfig_to_mldev(
|
479
542
|
from_object: Union[dict[str, Any], object],
|
480
543
|
parent_object: Optional[dict[str, Any]] = None,
|
481
544
|
) -> dict[str, Any]:
|
482
545
|
to_object: dict[str, Any] = {}
|
546
|
+
if getv(from_object, ['speaker_voice_configs']) is not None:
|
547
|
+
setv(
|
548
|
+
to_object,
|
549
|
+
['speakerVoiceConfigs'],
|
550
|
+
[
|
551
|
+
_SpeakerVoiceConfig_to_mldev(item, to_object)
|
552
|
+
for item in getv(from_object, ['speaker_voice_configs'])
|
553
|
+
],
|
554
|
+
)
|
483
555
|
|
484
556
|
return to_object
|
485
557
|
|
486
558
|
|
487
|
-
def
|
559
|
+
def _Part_to_mldev(
|
488
560
|
from_object: Union[dict[str, Any], object],
|
489
561
|
parent_object: Optional[dict[str, Any]] = None,
|
490
562
|
) -> dict[str, Any]:
|
491
563
|
to_object: dict[str, Any] = {}
|
492
|
-
if getv(from_object, ['
|
493
|
-
setv(
|
564
|
+
if getv(from_object, ['video_metadata']) is not None:
|
565
|
+
setv(
|
566
|
+
to_object,
|
567
|
+
['videoMetadata'],
|
568
|
+
_VideoMetadata_to_mldev(
|
569
|
+
getv(from_object, ['video_metadata']), to_object
|
570
|
+
),
|
571
|
+
)
|
494
572
|
|
495
|
-
if getv(from_object, ['
|
573
|
+
if getv(from_object, ['thought']) is not None:
|
574
|
+
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
575
|
+
|
576
|
+
if getv(from_object, ['inline_data']) is not None:
|
496
577
|
setv(
|
497
578
|
to_object,
|
498
|
-
['
|
499
|
-
getv(from_object, ['
|
579
|
+
['inlineData'],
|
580
|
+
_Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
|
500
581
|
)
|
501
582
|
|
502
|
-
if getv(from_object, ['
|
583
|
+
if getv(from_object, ['file_data']) is not None:
|
503
584
|
setv(
|
504
585
|
to_object,
|
505
|
-
['
|
506
|
-
getv(from_object, ['
|
586
|
+
['fileData'],
|
587
|
+
_FileData_to_mldev(getv(from_object, ['file_data']), to_object),
|
507
588
|
)
|
508
589
|
|
509
|
-
if getv(from_object, ['
|
590
|
+
if getv(from_object, ['thought_signature']) is not None:
|
510
591
|
setv(
|
511
|
-
to_object,
|
592
|
+
to_object,
|
593
|
+
['thoughtSignature'],
|
594
|
+
getv(from_object, ['thought_signature']),
|
512
595
|
)
|
513
596
|
|
514
|
-
if getv(from_object, ['
|
597
|
+
if getv(from_object, ['function_call']) is not None:
|
515
598
|
setv(
|
516
599
|
to_object,
|
517
|
-
['
|
518
|
-
getv(from_object, ['
|
600
|
+
['functionCall'],
|
601
|
+
_FunctionCall_to_mldev(getv(from_object, ['function_call']), to_object),
|
602
|
+
)
|
603
|
+
|
604
|
+
if getv(from_object, ['code_execution_result']) is not None:
|
605
|
+
setv(
|
606
|
+
to_object,
|
607
|
+
['codeExecutionResult'],
|
608
|
+
getv(from_object, ['code_execution_result']),
|
519
609
|
)
|
520
610
|
|
611
|
+
if getv(from_object, ['executable_code']) is not None:
|
612
|
+
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
613
|
+
|
614
|
+
if getv(from_object, ['function_response']) is not None:
|
615
|
+
setv(
|
616
|
+
to_object,
|
617
|
+
['functionResponse'],
|
618
|
+
getv(from_object, ['function_response']),
|
619
|
+
)
|
620
|
+
|
621
|
+
if getv(from_object, ['text']) is not None:
|
622
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
623
|
+
|
624
|
+
return to_object
|
625
|
+
|
626
|
+
|
627
|
+
def _PrebuiltVoiceConfig_to_mldev(
|
628
|
+
from_object: Union[dict[str, Any], object],
|
629
|
+
parent_object: Optional[dict[str, Any]] = None,
|
630
|
+
) -> dict[str, Any]:
|
631
|
+
to_object: dict[str, Any] = {}
|
632
|
+
if getv(from_object, ['voice_name']) is not None:
|
633
|
+
setv(to_object, ['voiceName'], getv(from_object, ['voice_name']))
|
634
|
+
|
635
|
+
return to_object
|
636
|
+
|
637
|
+
|
638
|
+
def _ProactivityConfig_to_mldev(
|
639
|
+
from_object: Union[dict[str, Any], object],
|
640
|
+
parent_object: Optional[dict[str, Any]] = None,
|
641
|
+
) -> dict[str, Any]:
|
642
|
+
to_object: dict[str, Any] = {}
|
643
|
+
if getv(from_object, ['proactive_audio']) is not None:
|
644
|
+
setv(to_object, ['proactiveAudio'], getv(from_object, ['proactive_audio']))
|
645
|
+
|
521
646
|
return to_object
|
522
647
|
|
523
648
|
|
@@ -548,314 +673,196 @@ def _RealtimeInputConfig_to_mldev(
|
|
548
673
|
return to_object
|
549
674
|
|
550
675
|
|
551
|
-
def
|
676
|
+
def _SessionResumptionConfig_to_mldev(
|
552
677
|
from_object: Union[dict[str, Any], object],
|
553
678
|
parent_object: Optional[dict[str, Any]] = None,
|
554
679
|
) -> dict[str, Any]:
|
555
680
|
to_object: dict[str, Any] = {}
|
556
|
-
if getv(from_object, ['
|
557
|
-
setv(to_object, ['
|
681
|
+
if getv(from_object, ['handle']) is not None:
|
682
|
+
setv(to_object, ['handle'], getv(from_object, ['handle']))
|
683
|
+
|
684
|
+
if getv(from_object, ['transparent']) is not None:
|
685
|
+
raise ValueError('transparent parameter is not supported in Gemini API.')
|
558
686
|
|
559
687
|
return to_object
|
560
688
|
|
561
689
|
|
562
|
-
def
|
690
|
+
def _SlidingWindow_to_mldev(
|
563
691
|
from_object: Union[dict[str, Any], object],
|
564
692
|
parent_object: Optional[dict[str, Any]] = None,
|
565
693
|
) -> dict[str, Any]:
|
566
694
|
to_object: dict[str, Any] = {}
|
567
|
-
if getv(from_object, ['
|
568
|
-
setv(to_object, ['
|
569
|
-
|
570
|
-
if getv(from_object, ['sliding_window']) is not None:
|
571
|
-
setv(
|
572
|
-
to_object,
|
573
|
-
['slidingWindow'],
|
574
|
-
_SlidingWindow_to_mldev(
|
575
|
-
getv(from_object, ['sliding_window']), to_object
|
576
|
-
),
|
577
|
-
)
|
695
|
+
if getv(from_object, ['target_tokens']) is not None:
|
696
|
+
setv(to_object, ['targetTokens'], getv(from_object, ['target_tokens']))
|
578
697
|
|
579
698
|
return to_object
|
580
699
|
|
581
700
|
|
582
|
-
def
|
701
|
+
def _SpeakerVoiceConfig_to_mldev(
|
583
702
|
from_object: Union[dict[str, Any], object],
|
584
703
|
parent_object: Optional[dict[str, Any]] = None,
|
585
704
|
) -> dict[str, Any]:
|
586
705
|
to_object: dict[str, Any] = {}
|
587
|
-
if getv(from_object, ['
|
588
|
-
setv(to_object, ['
|
706
|
+
if getv(from_object, ['speaker']) is not None:
|
707
|
+
setv(to_object, ['speaker'], getv(from_object, ['speaker']))
|
708
|
+
|
709
|
+
if getv(from_object, ['voice_config']) is not None:
|
710
|
+
setv(
|
711
|
+
to_object,
|
712
|
+
['voiceConfig'],
|
713
|
+
_VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
|
714
|
+
)
|
589
715
|
|
590
716
|
return to_object
|
591
717
|
|
592
718
|
|
593
|
-
def
|
594
|
-
api_client: BaseApiClient,
|
719
|
+
def _SpeechConfig_to_mldev(
|
595
720
|
from_object: Union[dict[str, Any], object],
|
596
721
|
parent_object: Optional[dict[str, Any]] = None,
|
597
722
|
) -> dict[str, Any]:
|
598
723
|
to_object: dict[str, Any] = {}
|
599
|
-
|
600
|
-
if getv(from_object, ['generation_config']) is not None:
|
601
|
-
setv(
|
602
|
-
parent_object,
|
603
|
-
['setup', 'generationConfig'],
|
604
|
-
getv(from_object, ['generation_config']),
|
605
|
-
)
|
606
|
-
|
607
|
-
if getv(from_object, ['response_modalities']) is not None:
|
608
|
-
setv(
|
609
|
-
parent_object,
|
610
|
-
['setup', 'generationConfig', 'responseModalities'],
|
611
|
-
getv(from_object, ['response_modalities']),
|
612
|
-
)
|
613
|
-
|
614
|
-
if getv(from_object, ['temperature']) is not None:
|
615
|
-
setv(
|
616
|
-
parent_object,
|
617
|
-
['setup', 'generationConfig', 'temperature'],
|
618
|
-
getv(from_object, ['temperature']),
|
619
|
-
)
|
620
|
-
|
621
|
-
if getv(from_object, ['top_p']) is not None:
|
622
|
-
setv(
|
623
|
-
parent_object,
|
624
|
-
['setup', 'generationConfig', 'topP'],
|
625
|
-
getv(from_object, ['top_p']),
|
626
|
-
)
|
627
|
-
|
628
|
-
if getv(from_object, ['top_k']) is not None:
|
629
|
-
setv(
|
630
|
-
parent_object,
|
631
|
-
['setup', 'generationConfig', 'topK'],
|
632
|
-
getv(from_object, ['top_k']),
|
633
|
-
)
|
634
|
-
|
635
|
-
if getv(from_object, ['max_output_tokens']) is not None:
|
636
|
-
setv(
|
637
|
-
parent_object,
|
638
|
-
['setup', 'generationConfig', 'maxOutputTokens'],
|
639
|
-
getv(from_object, ['max_output_tokens']),
|
640
|
-
)
|
641
|
-
|
642
|
-
if getv(from_object, ['media_resolution']) is not None:
|
643
|
-
setv(
|
644
|
-
parent_object,
|
645
|
-
['setup', 'generationConfig', 'mediaResolution'],
|
646
|
-
getv(from_object, ['media_resolution']),
|
647
|
-
)
|
648
|
-
|
649
|
-
if getv(from_object, ['seed']) is not None:
|
650
|
-
setv(
|
651
|
-
parent_object,
|
652
|
-
['setup', 'generationConfig', 'seed'],
|
653
|
-
getv(from_object, ['seed']),
|
654
|
-
)
|
655
|
-
|
656
|
-
if getv(from_object, ['speech_config']) is not None:
|
657
|
-
setv(
|
658
|
-
parent_object,
|
659
|
-
['setup', 'generationConfig', 'speechConfig'],
|
660
|
-
_SpeechConfig_to_mldev(
|
661
|
-
t.t_live_speech_config(getv(from_object, ['speech_config'])),
|
662
|
-
to_object,
|
663
|
-
),
|
664
|
-
)
|
665
|
-
|
666
|
-
if getv(from_object, ['enable_affective_dialog']) is not None:
|
667
|
-
setv(
|
668
|
-
parent_object,
|
669
|
-
['setup', 'generationConfig', 'enableAffectiveDialog'],
|
670
|
-
getv(from_object, ['enable_affective_dialog']),
|
671
|
-
)
|
672
|
-
|
673
|
-
if getv(from_object, ['system_instruction']) is not None:
|
674
|
-
setv(
|
675
|
-
parent_object,
|
676
|
-
['setup', 'systemInstruction'],
|
677
|
-
_Content_to_mldev(
|
678
|
-
t.t_content(getv(from_object, ['system_instruction'])), to_object
|
679
|
-
),
|
680
|
-
)
|
681
|
-
|
682
|
-
if getv(from_object, ['tools']) is not None:
|
683
|
-
setv(
|
684
|
-
parent_object,
|
685
|
-
['setup', 'tools'],
|
686
|
-
[
|
687
|
-
_Tool_to_mldev(t.t_tool(api_client, item), to_object)
|
688
|
-
for item in t.t_tools(api_client, getv(from_object, ['tools']))
|
689
|
-
],
|
690
|
-
)
|
691
|
-
|
692
|
-
if getv(from_object, ['session_resumption']) is not None:
|
693
|
-
setv(
|
694
|
-
parent_object,
|
695
|
-
['setup', 'sessionResumption'],
|
696
|
-
_SessionResumptionConfig_to_mldev(
|
697
|
-
getv(from_object, ['session_resumption']), to_object
|
698
|
-
),
|
699
|
-
)
|
700
|
-
|
701
|
-
if getv(from_object, ['input_audio_transcription']) is not None:
|
702
|
-
setv(
|
703
|
-
parent_object,
|
704
|
-
['setup', 'inputAudioTranscription'],
|
705
|
-
_AudioTranscriptionConfig_to_mldev(
|
706
|
-
getv(from_object, ['input_audio_transcription']), to_object
|
707
|
-
),
|
708
|
-
)
|
709
|
-
|
710
|
-
if getv(from_object, ['output_audio_transcription']) is not None:
|
711
|
-
setv(
|
712
|
-
parent_object,
|
713
|
-
['setup', 'outputAudioTranscription'],
|
714
|
-
_AudioTranscriptionConfig_to_mldev(
|
715
|
-
getv(from_object, ['output_audio_transcription']), to_object
|
716
|
-
),
|
717
|
-
)
|
718
|
-
|
719
|
-
if getv(from_object, ['realtime_input_config']) is not None:
|
724
|
+
if getv(from_object, ['voice_config']) is not None:
|
720
725
|
setv(
|
721
|
-
|
722
|
-
['
|
723
|
-
|
724
|
-
getv(from_object, ['realtime_input_config']), to_object
|
725
|
-
),
|
726
|
+
to_object,
|
727
|
+
['voiceConfig'],
|
728
|
+
_VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
|
726
729
|
)
|
727
730
|
|
728
|
-
if getv(from_object, ['
|
731
|
+
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
729
732
|
setv(
|
730
|
-
|
731
|
-
['
|
732
|
-
|
733
|
-
getv(from_object, ['
|
733
|
+
to_object,
|
734
|
+
['multiSpeakerVoiceConfig'],
|
735
|
+
_MultiSpeakerVoiceConfig_to_mldev(
|
736
|
+
getv(from_object, ['multi_speaker_voice_config']), to_object
|
734
737
|
),
|
735
738
|
)
|
736
739
|
|
737
|
-
if getv(from_object, ['
|
738
|
-
setv(
|
739
|
-
parent_object,
|
740
|
-
['setup', 'proactivity'],
|
741
|
-
_ProactivityConfig_to_mldev(
|
742
|
-
getv(from_object, ['proactivity']), to_object
|
743
|
-
),
|
744
|
-
)
|
740
|
+
if getv(from_object, ['language_code']) is not None:
|
741
|
+
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
745
742
|
|
746
743
|
return to_object
|
747
744
|
|
748
745
|
|
749
|
-
def
|
750
|
-
api_client: BaseApiClient,
|
746
|
+
def _ToolComputerUse_to_mldev(
|
751
747
|
from_object: Union[dict[str, Any], object],
|
752
748
|
parent_object: Optional[dict[str, Any]] = None,
|
753
749
|
) -> dict[str, Any]:
|
754
750
|
to_object: dict[str, Any] = {}
|
755
|
-
if getv(from_object, ['
|
756
|
-
setv(
|
757
|
-
to_object,
|
758
|
-
['setup', 'model'],
|
759
|
-
t.t_model(api_client, getv(from_object, ['model'])),
|
760
|
-
)
|
751
|
+
if getv(from_object, ['environment']) is not None:
|
752
|
+
setv(to_object, ['environment'], getv(from_object, ['environment']))
|
761
753
|
|
762
|
-
if getv(from_object, ['
|
754
|
+
if getv(from_object, ['excluded_predefined_functions']) is not None:
|
763
755
|
setv(
|
764
756
|
to_object,
|
765
|
-
['
|
766
|
-
|
767
|
-
api_client, getv(from_object, ['config']), to_object
|
768
|
-
),
|
757
|
+
['excludedPredefinedFunctions'],
|
758
|
+
getv(from_object, ['excluded_predefined_functions']),
|
769
759
|
)
|
770
760
|
|
771
761
|
return to_object
|
772
762
|
|
773
763
|
|
774
|
-
def
|
775
|
-
api_client: BaseApiClient,
|
764
|
+
def _Tool_to_mldev(
|
776
765
|
from_object: Union[dict[str, Any], object],
|
777
766
|
parent_object: Optional[dict[str, Any]] = None,
|
778
767
|
) -> dict[str, Any]:
|
779
768
|
to_object: dict[str, Any] = {}
|
769
|
+
if getv(from_object, ['function_declarations']) is not None:
|
770
|
+
setv(
|
771
|
+
to_object,
|
772
|
+
['functionDeclarations'],
|
773
|
+
[
|
774
|
+
_FunctionDeclaration_to_mldev(item, to_object)
|
775
|
+
for item in getv(from_object, ['function_declarations'])
|
776
|
+
],
|
777
|
+
)
|
780
778
|
|
781
|
-
if getv(from_object, ['
|
782
|
-
|
779
|
+
if getv(from_object, ['retrieval']) is not None:
|
780
|
+
raise ValueError('retrieval parameter is not supported in Gemini API.')
|
783
781
|
|
784
|
-
if getv(from_object, ['
|
782
|
+
if getv(from_object, ['google_search']) is not None:
|
785
783
|
setv(
|
786
|
-
|
787
|
-
['
|
788
|
-
getv(from_object, ['
|
784
|
+
to_object,
|
785
|
+
['googleSearch'],
|
786
|
+
_GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
|
789
787
|
)
|
790
788
|
|
791
|
-
if getv(from_object, ['
|
792
|
-
setv(parent_object, ['uses'], getv(from_object, ['uses']))
|
793
|
-
|
794
|
-
if getv(from_object, ['live_connect_constraints']) is not None:
|
789
|
+
if getv(from_object, ['google_search_retrieval']) is not None:
|
795
790
|
setv(
|
796
|
-
|
797
|
-
['
|
798
|
-
|
799
|
-
|
800
|
-
getv(from_object, ['live_connect_constraints']),
|
801
|
-
to_object,
|
791
|
+
to_object,
|
792
|
+
['googleSearchRetrieval'],
|
793
|
+
_GoogleSearchRetrieval_to_mldev(
|
794
|
+
getv(from_object, ['google_search_retrieval']), to_object
|
802
795
|
),
|
803
796
|
)
|
804
797
|
|
805
|
-
if getv(from_object, ['
|
806
|
-
|
807
|
-
|
808
|
-
['fieldMask'],
|
809
|
-
getv(from_object, ['lock_additional_fields']),
|
798
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
799
|
+
raise ValueError(
|
800
|
+
'enterprise_web_search parameter is not supported in Gemini API.'
|
810
801
|
)
|
811
802
|
|
812
|
-
|
803
|
+
if getv(from_object, ['google_maps']) is not None:
|
804
|
+
raise ValueError('google_maps parameter is not supported in Gemini API.')
|
813
805
|
|
806
|
+
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
|
+
)
|
814
812
|
|
815
|
-
|
816
|
-
api_client: BaseApiClient,
|
817
|
-
from_object: Union[dict[str, Any], object],
|
818
|
-
parent_object: Optional[dict[str, Any]] = None,
|
819
|
-
) -> dict[str, Any]:
|
820
|
-
to_object: dict[str, Any] = {}
|
821
|
-
if getv(from_object, ['config']) is not None:
|
813
|
+
if getv(from_object, ['computer_use']) is not None:
|
822
814
|
setv(
|
823
815
|
to_object,
|
824
|
-
['
|
825
|
-
|
826
|
-
|
816
|
+
['computerUse'],
|
817
|
+
_ToolComputerUse_to_mldev(
|
818
|
+
getv(from_object, ['computer_use']), to_object
|
827
819
|
),
|
828
820
|
)
|
829
821
|
|
822
|
+
if getv(from_object, ['code_execution']) is not None:
|
823
|
+
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
824
|
+
|
830
825
|
return to_object
|
831
826
|
|
832
827
|
|
833
|
-
def
|
828
|
+
def _UrlContext_to_mldev(
|
834
829
|
from_object: Union[dict[str, Any], object],
|
835
830
|
parent_object: Optional[dict[str, Any]] = None,
|
836
831
|
) -> dict[str, Any]:
|
837
832
|
to_object: dict[str, Any] = {}
|
838
|
-
if getv(from_object, ['config']) is not None:
|
839
|
-
raise ValueError('config parameter is not supported in Vertex AI.')
|
840
833
|
|
841
834
|
return to_object
|
842
835
|
|
843
836
|
|
844
|
-
def
|
837
|
+
def _VideoMetadata_to_mldev(
|
845
838
|
from_object: Union[dict[str, Any], object],
|
846
839
|
parent_object: Optional[dict[str, Any]] = None,
|
847
840
|
) -> dict[str, Any]:
|
848
841
|
to_object: dict[str, Any] = {}
|
849
|
-
if getv(from_object, ['
|
850
|
-
setv(to_object, ['
|
842
|
+
if getv(from_object, ['fps']) is not None:
|
843
|
+
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
844
|
+
|
845
|
+
if getv(from_object, ['end_offset']) is not None:
|
846
|
+
setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
|
847
|
+
|
848
|
+
if getv(from_object, ['start_offset']) is not None:
|
849
|
+
setv(to_object, ['startOffset'], getv(from_object, ['start_offset']))
|
851
850
|
|
852
851
|
return to_object
|
853
852
|
|
854
853
|
|
855
|
-
def
|
854
|
+
def _VoiceConfig_to_mldev(
|
856
855
|
from_object: Union[dict[str, Any], object],
|
857
856
|
parent_object: Optional[dict[str, Any]] = None,
|
858
857
|
) -> dict[str, Any]:
|
859
858
|
to_object: dict[str, Any] = {}
|
859
|
+
if getv(from_object, ['prebuilt_voice_config']) is not None:
|
860
|
+
setv(
|
861
|
+
to_object,
|
862
|
+
['prebuiltVoiceConfig'],
|
863
|
+
_PrebuiltVoiceConfig_to_mldev(
|
864
|
+
getv(from_object, ['prebuilt_voice_config']), to_object
|
865
|
+
),
|
866
|
+
)
|
860
867
|
|
861
868
|
return to_object
|