google-genai 1.7.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/__init__.py +4 -2
- google/genai/_adapters.py +55 -0
- google/genai/_api_client.py +1301 -299
- google/genai/_api_module.py +1 -1
- google/genai/_automatic_function_calling_util.py +54 -33
- google/genai/_base_transformers.py +26 -0
- google/genai/_base_url.py +50 -0
- google/genai/_common.py +560 -59
- google/genai/_extra_utils.py +371 -38
- google/genai/_live_converters.py +1467 -0
- google/genai/_local_tokenizer_loader.py +214 -0
- google/genai/_mcp_utils.py +117 -0
- google/genai/_operations_converters.py +394 -0
- google/genai/_replay_api_client.py +204 -92
- google/genai/_test_api_client.py +1 -1
- google/genai/_tokens_converters.py +520 -0
- google/genai/_transformers.py +633 -233
- google/genai/batches.py +1733 -538
- google/genai/caches.py +678 -1012
- google/genai/chats.py +48 -38
- google/genai/client.py +142 -15
- google/genai/documents.py +532 -0
- google/genai/errors.py +141 -35
- google/genai/file_search_stores.py +1296 -0
- google/genai/files.py +312 -744
- google/genai/live.py +617 -367
- google/genai/live_music.py +197 -0
- google/genai/local_tokenizer.py +395 -0
- google/genai/models.py +3598 -3116
- google/genai/operations.py +201 -362
- google/genai/pagers.py +23 -7
- google/genai/py.typed +1 -0
- google/genai/tokens.py +362 -0
- google/genai/tunings.py +1274 -496
- google/genai/types.py +14535 -5454
- google/genai/version.py +2 -2
- {google_genai-1.7.0.dist-info → google_genai-1.53.0.dist-info}/METADATA +736 -234
- google_genai-1.53.0.dist-info/RECORD +41 -0
- {google_genai-1.7.0.dist-info → google_genai-1.53.0.dist-info}/WHEEL +1 -1
- google_genai-1.7.0.dist-info/RECORD +0 -27
- {google_genai-1.7.0.dist-info → google_genai-1.53.0.dist-info/licenses}/LICENSE +0 -0
- {google_genai-1.7.0.dist-info → google_genai-1.53.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
# Copyright 2025 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
# Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
17
|
+
|
|
18
|
+
from typing import Any, Optional, Union
|
|
19
|
+
|
|
20
|
+
from . import _transformers as t
|
|
21
|
+
from ._api_client import BaseApiClient
|
|
22
|
+
from ._common import get_value_by_path as getv
|
|
23
|
+
from ._common import set_value_by_path as setv
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _Blob_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, ['data']) is not None:
|
|
32
|
+
setv(to_object, ['data'], getv(from_object, ['data']))
|
|
33
|
+
|
|
34
|
+
if getv(from_object, ['display_name']) is not None:
|
|
35
|
+
raise ValueError('display_name parameter is not supported in Gemini API.')
|
|
36
|
+
|
|
37
|
+
if getv(from_object, ['mime_type']) is not None:
|
|
38
|
+
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
|
39
|
+
|
|
40
|
+
return to_object
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _Content_to_mldev(
|
|
44
|
+
from_object: Union[dict[str, Any], object],
|
|
45
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
46
|
+
) -> dict[str, Any]:
|
|
47
|
+
to_object: dict[str, Any] = {}
|
|
48
|
+
if getv(from_object, ['parts']) is not None:
|
|
49
|
+
setv(
|
|
50
|
+
to_object,
|
|
51
|
+
['parts'],
|
|
52
|
+
[
|
|
53
|
+
_Part_to_mldev(item, to_object)
|
|
54
|
+
for item in getv(from_object, ['parts'])
|
|
55
|
+
],
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
if getv(from_object, ['role']) is not None:
|
|
59
|
+
setv(to_object, ['role'], getv(from_object, ['role']))
|
|
60
|
+
|
|
61
|
+
return to_object
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _CreateAuthTokenConfig_to_mldev(
|
|
65
|
+
api_client: BaseApiClient,
|
|
66
|
+
from_object: Union[dict[str, Any], object],
|
|
67
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
68
|
+
) -> dict[str, Any]:
|
|
69
|
+
to_object: dict[str, Any] = {}
|
|
70
|
+
|
|
71
|
+
if getv(from_object, ['expire_time']) is not None:
|
|
72
|
+
setv(parent_object, ['expireTime'], getv(from_object, ['expire_time']))
|
|
73
|
+
|
|
74
|
+
if getv(from_object, ['new_session_expire_time']) is not None:
|
|
75
|
+
setv(
|
|
76
|
+
parent_object,
|
|
77
|
+
['newSessionExpireTime'],
|
|
78
|
+
getv(from_object, ['new_session_expire_time']),
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
if getv(from_object, ['uses']) is not None:
|
|
82
|
+
setv(parent_object, ['uses'], getv(from_object, ['uses']))
|
|
83
|
+
|
|
84
|
+
if getv(from_object, ['live_connect_constraints']) is not None:
|
|
85
|
+
setv(
|
|
86
|
+
parent_object,
|
|
87
|
+
['bidiGenerateContentSetup'],
|
|
88
|
+
_LiveConnectConstraints_to_mldev(
|
|
89
|
+
api_client,
|
|
90
|
+
getv(from_object, ['live_connect_constraints']),
|
|
91
|
+
to_object,
|
|
92
|
+
),
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
if getv(from_object, ['lock_additional_fields']) is not None:
|
|
96
|
+
setv(
|
|
97
|
+
parent_object,
|
|
98
|
+
['fieldMask'],
|
|
99
|
+
getv(from_object, ['lock_additional_fields']),
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
return to_object
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def _CreateAuthTokenParameters_to_mldev(
|
|
106
|
+
api_client: BaseApiClient,
|
|
107
|
+
from_object: Union[dict[str, Any], object],
|
|
108
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
109
|
+
) -> dict[str, Any]:
|
|
110
|
+
to_object: dict[str, Any] = {}
|
|
111
|
+
if getv(from_object, ['config']) is not None:
|
|
112
|
+
setv(
|
|
113
|
+
to_object,
|
|
114
|
+
['config'],
|
|
115
|
+
_CreateAuthTokenConfig_to_mldev(
|
|
116
|
+
api_client, getv(from_object, ['config']), to_object
|
|
117
|
+
),
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
return to_object
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def _CreateAuthTokenParameters_to_vertex(
|
|
124
|
+
from_object: Union[dict[str, Any], object],
|
|
125
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
126
|
+
) -> dict[str, Any]:
|
|
127
|
+
to_object: dict[str, Any] = {}
|
|
128
|
+
if getv(from_object, ['config']) is not None:
|
|
129
|
+
raise ValueError('config parameter is not supported in Vertex AI.')
|
|
130
|
+
|
|
131
|
+
return to_object
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def _FileData_to_mldev(
|
|
135
|
+
from_object: Union[dict[str, Any], object],
|
|
136
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
137
|
+
) -> dict[str, Any]:
|
|
138
|
+
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
|
+
if getv(from_object, ['file_uri']) is not None:
|
|
143
|
+
setv(to_object, ['fileUri'], getv(from_object, ['file_uri']))
|
|
144
|
+
|
|
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 _FunctionCall_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
|
+
if getv(from_object, ['id']) is not None:
|
|
157
|
+
setv(to_object, ['id'], getv(from_object, ['id']))
|
|
158
|
+
|
|
159
|
+
if getv(from_object, ['args']) is not None:
|
|
160
|
+
setv(to_object, ['args'], getv(from_object, ['args']))
|
|
161
|
+
|
|
162
|
+
if getv(from_object, ['name']) is not None:
|
|
163
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
|
164
|
+
|
|
165
|
+
if getv(from_object, ['partial_args']) is not None:
|
|
166
|
+
raise ValueError('partial_args parameter is not supported in Gemini API.')
|
|
167
|
+
|
|
168
|
+
if getv(from_object, ['will_continue']) is not None:
|
|
169
|
+
raise ValueError('will_continue parameter is not supported in Gemini API.')
|
|
170
|
+
|
|
171
|
+
return to_object
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def _GoogleMaps_to_mldev(
|
|
175
|
+
from_object: Union[dict[str, Any], object],
|
|
176
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
177
|
+
) -> dict[str, Any]:
|
|
178
|
+
to_object: dict[str, Any] = {}
|
|
179
|
+
if getv(from_object, ['auth_config']) is not None:
|
|
180
|
+
raise ValueError('auth_config parameter is not supported in Gemini API.')
|
|
181
|
+
|
|
182
|
+
if getv(from_object, ['enable_widget']) is not None:
|
|
183
|
+
setv(to_object, ['enableWidget'], getv(from_object, ['enable_widget']))
|
|
184
|
+
|
|
185
|
+
return to_object
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def _GoogleSearch_to_mldev(
|
|
189
|
+
from_object: Union[dict[str, Any], object],
|
|
190
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
191
|
+
) -> dict[str, Any]:
|
|
192
|
+
to_object: dict[str, Any] = {}
|
|
193
|
+
if getv(from_object, ['exclude_domains']) is not None:
|
|
194
|
+
raise ValueError(
|
|
195
|
+
'exclude_domains parameter is not supported in Gemini API.'
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
if getv(from_object, ['blocking_confidence']) is not None:
|
|
199
|
+
raise ValueError(
|
|
200
|
+
'blocking_confidence parameter is not supported in Gemini API.'
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
if getv(from_object, ['time_range_filter']) is not None:
|
|
204
|
+
setv(
|
|
205
|
+
to_object, ['timeRangeFilter'], getv(from_object, ['time_range_filter'])
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
return to_object
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def _LiveConnectConfig_to_mldev(
|
|
212
|
+
api_client: BaseApiClient,
|
|
213
|
+
from_object: Union[dict[str, Any], object],
|
|
214
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
215
|
+
) -> dict[str, Any]:
|
|
216
|
+
to_object: dict[str, Any] = {}
|
|
217
|
+
|
|
218
|
+
if getv(from_object, ['generation_config']) is not None:
|
|
219
|
+
setv(
|
|
220
|
+
parent_object,
|
|
221
|
+
['setup', 'generationConfig'],
|
|
222
|
+
getv(from_object, ['generation_config']),
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
if getv(from_object, ['response_modalities']) is not None:
|
|
226
|
+
setv(
|
|
227
|
+
parent_object,
|
|
228
|
+
['setup', 'generationConfig', 'responseModalities'],
|
|
229
|
+
getv(from_object, ['response_modalities']),
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
if getv(from_object, ['temperature']) is not None:
|
|
233
|
+
setv(
|
|
234
|
+
parent_object,
|
|
235
|
+
['setup', 'generationConfig', 'temperature'],
|
|
236
|
+
getv(from_object, ['temperature']),
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
if getv(from_object, ['top_p']) is not None:
|
|
240
|
+
setv(
|
|
241
|
+
parent_object,
|
|
242
|
+
['setup', 'generationConfig', 'topP'],
|
|
243
|
+
getv(from_object, ['top_p']),
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
if getv(from_object, ['top_k']) is not None:
|
|
247
|
+
setv(
|
|
248
|
+
parent_object,
|
|
249
|
+
['setup', 'generationConfig', 'topK'],
|
|
250
|
+
getv(from_object, ['top_k']),
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
if getv(from_object, ['max_output_tokens']) is not None:
|
|
254
|
+
setv(
|
|
255
|
+
parent_object,
|
|
256
|
+
['setup', 'generationConfig', 'maxOutputTokens'],
|
|
257
|
+
getv(from_object, ['max_output_tokens']),
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
if getv(from_object, ['media_resolution']) is not None:
|
|
261
|
+
setv(
|
|
262
|
+
parent_object,
|
|
263
|
+
['setup', 'generationConfig', 'mediaResolution'],
|
|
264
|
+
getv(from_object, ['media_resolution']),
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
if getv(from_object, ['seed']) is not None:
|
|
268
|
+
setv(
|
|
269
|
+
parent_object,
|
|
270
|
+
['setup', 'generationConfig', 'seed'],
|
|
271
|
+
getv(from_object, ['seed']),
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
if getv(from_object, ['speech_config']) is not None:
|
|
275
|
+
setv(
|
|
276
|
+
parent_object,
|
|
277
|
+
['setup', 'generationConfig', 'speechConfig'],
|
|
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']),
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
if getv(from_object, ['enable_affective_dialog']) is not None:
|
|
289
|
+
setv(
|
|
290
|
+
parent_object,
|
|
291
|
+
['setup', 'generationConfig', 'enableAffectiveDialog'],
|
|
292
|
+
getv(from_object, ['enable_affective_dialog']),
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
if getv(from_object, ['system_instruction']) is not None:
|
|
296
|
+
setv(
|
|
297
|
+
parent_object,
|
|
298
|
+
['setup', 'systemInstruction'],
|
|
299
|
+
_Content_to_mldev(
|
|
300
|
+
t.t_content(getv(from_object, ['system_instruction'])), to_object
|
|
301
|
+
),
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
if getv(from_object, ['tools']) is not None:
|
|
305
|
+
setv(
|
|
306
|
+
parent_object,
|
|
307
|
+
['setup', 'tools'],
|
|
308
|
+
[
|
|
309
|
+
_Tool_to_mldev(t.t_tool(api_client, item), to_object)
|
|
310
|
+
for item in t.t_tools(api_client, getv(from_object, ['tools']))
|
|
311
|
+
],
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
if getv(from_object, ['session_resumption']) is not None:
|
|
315
|
+
setv(
|
|
316
|
+
parent_object,
|
|
317
|
+
['setup', 'sessionResumption'],
|
|
318
|
+
_SessionResumptionConfig_to_mldev(
|
|
319
|
+
getv(from_object, ['session_resumption']), to_object
|
|
320
|
+
),
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
if getv(from_object, ['input_audio_transcription']) is not None:
|
|
324
|
+
setv(
|
|
325
|
+
parent_object,
|
|
326
|
+
['setup', 'inputAudioTranscription'],
|
|
327
|
+
getv(from_object, ['input_audio_transcription']),
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
if getv(from_object, ['output_audio_transcription']) is not None:
|
|
331
|
+
setv(
|
|
332
|
+
parent_object,
|
|
333
|
+
['setup', 'outputAudioTranscription'],
|
|
334
|
+
getv(from_object, ['output_audio_transcription']),
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
if getv(from_object, ['realtime_input_config']) is not None:
|
|
338
|
+
setv(
|
|
339
|
+
parent_object,
|
|
340
|
+
['setup', 'realtimeInputConfig'],
|
|
341
|
+
getv(from_object, ['realtime_input_config']),
|
|
342
|
+
)
|
|
343
|
+
|
|
344
|
+
if getv(from_object, ['context_window_compression']) is not None:
|
|
345
|
+
setv(
|
|
346
|
+
parent_object,
|
|
347
|
+
['setup', 'contextWindowCompression'],
|
|
348
|
+
getv(from_object, ['context_window_compression']),
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
if getv(from_object, ['proactivity']) is not None:
|
|
352
|
+
setv(
|
|
353
|
+
parent_object,
|
|
354
|
+
['setup', 'proactivity'],
|
|
355
|
+
getv(from_object, ['proactivity']),
|
|
356
|
+
)
|
|
357
|
+
|
|
358
|
+
return to_object
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
def _LiveConnectConstraints_to_mldev(
|
|
362
|
+
api_client: BaseApiClient,
|
|
363
|
+
from_object: Union[dict[str, Any], object],
|
|
364
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
365
|
+
) -> dict[str, Any]:
|
|
366
|
+
to_object: dict[str, Any] = {}
|
|
367
|
+
if getv(from_object, ['model']) is not None:
|
|
368
|
+
setv(
|
|
369
|
+
to_object,
|
|
370
|
+
['setup', 'model'],
|
|
371
|
+
t.t_model(api_client, getv(from_object, ['model'])),
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
if getv(from_object, ['config']) is not None:
|
|
375
|
+
setv(
|
|
376
|
+
to_object,
|
|
377
|
+
['config'],
|
|
378
|
+
_LiveConnectConfig_to_mldev(
|
|
379
|
+
api_client, getv(from_object, ['config']), to_object
|
|
380
|
+
),
|
|
381
|
+
)
|
|
382
|
+
|
|
383
|
+
return to_object
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
def _Part_to_mldev(
|
|
387
|
+
from_object: Union[dict[str, Any], object],
|
|
388
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
389
|
+
) -> dict[str, Any]:
|
|
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
|
+
)
|
|
395
|
+
|
|
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
|
+
)
|
|
402
|
+
|
|
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:
|
|
407
|
+
setv(
|
|
408
|
+
to_object,
|
|
409
|
+
['fileData'],
|
|
410
|
+
_FileData_to_mldev(getv(from_object, ['file_data']), to_object),
|
|
411
|
+
)
|
|
412
|
+
|
|
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
|
+
)
|
|
419
|
+
|
|
420
|
+
if getv(from_object, ['function_response']) is not None:
|
|
421
|
+
setv(
|
|
422
|
+
to_object,
|
|
423
|
+
['functionResponse'],
|
|
424
|
+
getv(from_object, ['function_response']),
|
|
425
|
+
)
|
|
426
|
+
|
|
427
|
+
if getv(from_object, ['inline_data']) is not None:
|
|
428
|
+
setv(
|
|
429
|
+
to_object,
|
|
430
|
+
['inlineData'],
|
|
431
|
+
_Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
|
|
432
|
+
)
|
|
433
|
+
|
|
434
|
+
if getv(from_object, ['text']) is not None:
|
|
435
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
|
436
|
+
|
|
437
|
+
if getv(from_object, ['thought']) is not None:
|
|
438
|
+
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
|
439
|
+
|
|
440
|
+
if getv(from_object, ['thought_signature']) is not None:
|
|
441
|
+
setv(
|
|
442
|
+
to_object,
|
|
443
|
+
['thoughtSignature'],
|
|
444
|
+
getv(from_object, ['thought_signature']),
|
|
445
|
+
)
|
|
446
|
+
|
|
447
|
+
if getv(from_object, ['video_metadata']) is not None:
|
|
448
|
+
setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
|
|
449
|
+
|
|
450
|
+
return to_object
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
def _SessionResumptionConfig_to_mldev(
|
|
454
|
+
from_object: Union[dict[str, Any], object],
|
|
455
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
456
|
+
) -> dict[str, Any]:
|
|
457
|
+
to_object: dict[str, Any] = {}
|
|
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.')
|
|
463
|
+
|
|
464
|
+
return to_object
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
def _Tool_to_mldev(
|
|
468
|
+
from_object: Union[dict[str, Any], object],
|
|
469
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
470
|
+
) -> dict[str, Any]:
|
|
471
|
+
to_object: dict[str, Any] = {}
|
|
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
|
+
)
|
|
478
|
+
|
|
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
|
+
)
|
|
488
|
+
|
|
489
|
+
if getv(from_object, ['computer_use']) is not None:
|
|
490
|
+
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
|
491
|
+
|
|
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']))
|
|
519
|
+
|
|
520
|
+
return to_object
|