google-genai 1.15.0__py3-none-any.whl → 1.16.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 +5 -3
- google/genai/_adapters.py +55 -0
- google/genai/_api_client.py +3 -3
- google/genai/_api_module.py +1 -1
- google/genai/_automatic_function_calling_util.py +1 -1
- google/genai/_common.py +1 -1
- google/genai/_extra_utils.py +117 -9
- google/genai/_live_converters.py +1295 -20
- google/genai/_mcp_utils.py +117 -0
- google/genai/_replay_api_client.py +1 -1
- google/genai/_test_api_client.py +1 -1
- google/genai/_tokens_converters.py +1701 -0
- google/genai/_transformers.py +66 -33
- google/genai/caches.py +223 -20
- google/genai/chats.py +1 -1
- google/genai/client.py +12 -1
- google/genai/errors.py +1 -1
- google/genai/live.py +218 -35
- google/genai/live_music.py +201 -0
- google/genai/models.py +505 -44
- google/genai/pagers.py +1 -1
- google/genai/tokens.py +357 -0
- google/genai/types.py +7887 -6765
- google/genai/version.py +2 -2
- {google_genai-1.15.0.dist-info → google_genai-1.16.0.dist-info}/METADATA +8 -4
- google_genai-1.16.0.dist-info/RECORD +35 -0
- {google_genai-1.15.0.dist-info → google_genai-1.16.0.dist-info}/WHEEL +1 -1
- google_genai-1.15.0.dist-info/RECORD +0 -30
- {google_genai-1.15.0.dist-info → google_genai-1.16.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.15.0.dist-info → google_genai-1.16.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,1701 @@
|
|
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
|
+
from . import _transformers as t
|
20
|
+
from ._api_client import BaseApiClient
|
21
|
+
from ._common import get_value_by_path as getv
|
22
|
+
from ._common import set_value_by_path as setv
|
23
|
+
|
24
|
+
|
25
|
+
def _PrebuiltVoiceConfig_to_mldev(
|
26
|
+
api_client: BaseApiClient,
|
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 _PrebuiltVoiceConfig_to_vertex(
|
38
|
+
api_client: BaseApiClient,
|
39
|
+
from_object: Union[dict[str, Any], object],
|
40
|
+
parent_object: Optional[dict[str, Any]] = None,
|
41
|
+
) -> dict[str, Any]:
|
42
|
+
to_object: dict[str, Any] = {}
|
43
|
+
if getv(from_object, ['voice_name']) is not None:
|
44
|
+
setv(to_object, ['voiceName'], getv(from_object, ['voice_name']))
|
45
|
+
|
46
|
+
return to_object
|
47
|
+
|
48
|
+
|
49
|
+
def _VoiceConfig_to_mldev(
|
50
|
+
api_client: BaseApiClient,
|
51
|
+
from_object: Union[dict[str, Any], object],
|
52
|
+
parent_object: Optional[dict[str, Any]] = None,
|
53
|
+
) -> dict[str, Any]:
|
54
|
+
to_object: dict[str, Any] = {}
|
55
|
+
if getv(from_object, ['prebuilt_voice_config']) is not None:
|
56
|
+
setv(
|
57
|
+
to_object,
|
58
|
+
['prebuiltVoiceConfig'],
|
59
|
+
_PrebuiltVoiceConfig_to_mldev(
|
60
|
+
api_client, getv(from_object, ['prebuilt_voice_config']), to_object
|
61
|
+
),
|
62
|
+
)
|
63
|
+
|
64
|
+
return to_object
|
65
|
+
|
66
|
+
|
67
|
+
def _VoiceConfig_to_vertex(
|
68
|
+
api_client: BaseApiClient,
|
69
|
+
from_object: Union[dict[str, Any], object],
|
70
|
+
parent_object: Optional[dict[str, Any]] = None,
|
71
|
+
) -> dict[str, Any]:
|
72
|
+
to_object: dict[str, Any] = {}
|
73
|
+
if getv(from_object, ['prebuilt_voice_config']) is not None:
|
74
|
+
setv(
|
75
|
+
to_object,
|
76
|
+
['prebuiltVoiceConfig'],
|
77
|
+
_PrebuiltVoiceConfig_to_vertex(
|
78
|
+
api_client, getv(from_object, ['prebuilt_voice_config']), to_object
|
79
|
+
),
|
80
|
+
)
|
81
|
+
|
82
|
+
return to_object
|
83
|
+
|
84
|
+
|
85
|
+
def _SpeakerVoiceConfig_to_mldev(
|
86
|
+
api_client: BaseApiClient,
|
87
|
+
from_object: Union[dict[str, Any], object],
|
88
|
+
parent_object: Optional[dict[str, Any]] = None,
|
89
|
+
) -> dict[str, Any]:
|
90
|
+
to_object: dict[str, Any] = {}
|
91
|
+
if getv(from_object, ['speaker']) is not None:
|
92
|
+
setv(to_object, ['speaker'], getv(from_object, ['speaker']))
|
93
|
+
|
94
|
+
if getv(from_object, ['voice_config']) is not None:
|
95
|
+
setv(
|
96
|
+
to_object,
|
97
|
+
['voiceConfig'],
|
98
|
+
_VoiceConfig_to_mldev(
|
99
|
+
api_client, getv(from_object, ['voice_config']), to_object
|
100
|
+
),
|
101
|
+
)
|
102
|
+
|
103
|
+
return to_object
|
104
|
+
|
105
|
+
|
106
|
+
def _SpeakerVoiceConfig_to_vertex(
|
107
|
+
api_client: BaseApiClient,
|
108
|
+
from_object: Union[dict[str, Any], object],
|
109
|
+
parent_object: Optional[dict[str, Any]] = None,
|
110
|
+
) -> dict[str, Any]:
|
111
|
+
to_object: dict[str, Any] = {}
|
112
|
+
if getv(from_object, ['speaker']) is not None:
|
113
|
+
raise ValueError('speaker parameter is not supported in Vertex AI.')
|
114
|
+
|
115
|
+
if getv(from_object, ['voice_config']) is not None:
|
116
|
+
raise ValueError('voice_config parameter is not supported in Vertex AI.')
|
117
|
+
|
118
|
+
return to_object
|
119
|
+
|
120
|
+
|
121
|
+
def _MultiSpeakerVoiceConfig_to_mldev(
|
122
|
+
api_client: BaseApiClient,
|
123
|
+
from_object: Union[dict[str, Any], object],
|
124
|
+
parent_object: Optional[dict[str, Any]] = None,
|
125
|
+
) -> dict[str, Any]:
|
126
|
+
to_object: dict[str, Any] = {}
|
127
|
+
if getv(from_object, ['speaker_voice_configs']) is not None:
|
128
|
+
setv(
|
129
|
+
to_object,
|
130
|
+
['speakerVoiceConfigs'],
|
131
|
+
[
|
132
|
+
_SpeakerVoiceConfig_to_mldev(api_client, item, to_object)
|
133
|
+
for item in getv(from_object, ['speaker_voice_configs'])
|
134
|
+
],
|
135
|
+
)
|
136
|
+
|
137
|
+
return to_object
|
138
|
+
|
139
|
+
|
140
|
+
def _MultiSpeakerVoiceConfig_to_vertex(
|
141
|
+
api_client: BaseApiClient,
|
142
|
+
from_object: Union[dict[str, Any], object],
|
143
|
+
parent_object: Optional[dict[str, Any]] = None,
|
144
|
+
) -> dict[str, Any]:
|
145
|
+
to_object: dict[str, Any] = {}
|
146
|
+
if getv(from_object, ['speaker_voice_configs']) is not None:
|
147
|
+
raise ValueError(
|
148
|
+
'speaker_voice_configs parameter is not supported in Vertex AI.'
|
149
|
+
)
|
150
|
+
|
151
|
+
return to_object
|
152
|
+
|
153
|
+
|
154
|
+
def _SpeechConfig_to_mldev(
|
155
|
+
api_client: BaseApiClient,
|
156
|
+
from_object: Union[dict[str, Any], object],
|
157
|
+
parent_object: Optional[dict[str, Any]] = None,
|
158
|
+
) -> dict[str, Any]:
|
159
|
+
to_object: dict[str, Any] = {}
|
160
|
+
if getv(from_object, ['voice_config']) is not None:
|
161
|
+
setv(
|
162
|
+
to_object,
|
163
|
+
['voiceConfig'],
|
164
|
+
_VoiceConfig_to_mldev(
|
165
|
+
api_client, getv(from_object, ['voice_config']), to_object
|
166
|
+
),
|
167
|
+
)
|
168
|
+
|
169
|
+
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
170
|
+
setv(
|
171
|
+
to_object,
|
172
|
+
['multiSpeakerVoiceConfig'],
|
173
|
+
_MultiSpeakerVoiceConfig_to_mldev(
|
174
|
+
api_client,
|
175
|
+
getv(from_object, ['multi_speaker_voice_config']),
|
176
|
+
to_object,
|
177
|
+
),
|
178
|
+
)
|
179
|
+
|
180
|
+
if getv(from_object, ['language_code']) is not None:
|
181
|
+
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
182
|
+
|
183
|
+
return to_object
|
184
|
+
|
185
|
+
|
186
|
+
def _SpeechConfig_to_vertex(
|
187
|
+
api_client: BaseApiClient,
|
188
|
+
from_object: Union[dict[str, Any], object],
|
189
|
+
parent_object: Optional[dict[str, Any]] = None,
|
190
|
+
) -> dict[str, Any]:
|
191
|
+
to_object: dict[str, Any] = {}
|
192
|
+
if getv(from_object, ['voice_config']) is not None:
|
193
|
+
setv(
|
194
|
+
to_object,
|
195
|
+
['voiceConfig'],
|
196
|
+
_VoiceConfig_to_vertex(
|
197
|
+
api_client, getv(from_object, ['voice_config']), to_object
|
198
|
+
),
|
199
|
+
)
|
200
|
+
|
201
|
+
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
202
|
+
raise ValueError(
|
203
|
+
'multi_speaker_voice_config parameter is not supported in Vertex AI.'
|
204
|
+
)
|
205
|
+
|
206
|
+
if getv(from_object, ['language_code']) is not None:
|
207
|
+
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
208
|
+
|
209
|
+
return to_object
|
210
|
+
|
211
|
+
|
212
|
+
def _VideoMetadata_to_mldev(
|
213
|
+
api_client: BaseApiClient,
|
214
|
+
from_object: Union[dict[str, Any], object],
|
215
|
+
parent_object: Optional[dict[str, Any]] = None,
|
216
|
+
) -> dict[str, Any]:
|
217
|
+
to_object: dict[str, Any] = {}
|
218
|
+
if getv(from_object, ['fps']) is not None:
|
219
|
+
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
220
|
+
|
221
|
+
if getv(from_object, ['end_offset']) is not None:
|
222
|
+
setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
|
223
|
+
|
224
|
+
if getv(from_object, ['start_offset']) is not None:
|
225
|
+
setv(to_object, ['startOffset'], getv(from_object, ['start_offset']))
|
226
|
+
|
227
|
+
return to_object
|
228
|
+
|
229
|
+
|
230
|
+
def _VideoMetadata_to_vertex(
|
231
|
+
api_client: BaseApiClient,
|
232
|
+
from_object: Union[dict[str, Any], object],
|
233
|
+
parent_object: Optional[dict[str, Any]] = None,
|
234
|
+
) -> dict[str, Any]:
|
235
|
+
to_object: dict[str, Any] = {}
|
236
|
+
if getv(from_object, ['fps']) is not None:
|
237
|
+
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
238
|
+
|
239
|
+
if getv(from_object, ['end_offset']) is not None:
|
240
|
+
setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
|
241
|
+
|
242
|
+
if getv(from_object, ['start_offset']) is not None:
|
243
|
+
setv(to_object, ['startOffset'], getv(from_object, ['start_offset']))
|
244
|
+
|
245
|
+
return to_object
|
246
|
+
|
247
|
+
|
248
|
+
def _Blob_to_mldev(
|
249
|
+
api_client: BaseApiClient,
|
250
|
+
from_object: Union[dict[str, Any], object],
|
251
|
+
parent_object: Optional[dict[str, Any]] = None,
|
252
|
+
) -> dict[str, Any]:
|
253
|
+
to_object: dict[str, Any] = {}
|
254
|
+
if getv(from_object, ['display_name']) is not None:
|
255
|
+
raise ValueError('display_name parameter is not supported in Gemini API.')
|
256
|
+
|
257
|
+
if getv(from_object, ['data']) is not None:
|
258
|
+
setv(to_object, ['data'], getv(from_object, ['data']))
|
259
|
+
|
260
|
+
if getv(from_object, ['mime_type']) is not None:
|
261
|
+
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
262
|
+
|
263
|
+
return to_object
|
264
|
+
|
265
|
+
|
266
|
+
def _Blob_to_vertex(
|
267
|
+
api_client: BaseApiClient,
|
268
|
+
from_object: Union[dict[str, Any], object],
|
269
|
+
parent_object: Optional[dict[str, Any]] = None,
|
270
|
+
) -> dict[str, Any]:
|
271
|
+
to_object: dict[str, Any] = {}
|
272
|
+
if getv(from_object, ['display_name']) is not None:
|
273
|
+
setv(to_object, ['displayName'], getv(from_object, ['display_name']))
|
274
|
+
|
275
|
+
if getv(from_object, ['data']) is not None:
|
276
|
+
setv(to_object, ['data'], getv(from_object, ['data']))
|
277
|
+
|
278
|
+
if getv(from_object, ['mime_type']) is not None:
|
279
|
+
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
280
|
+
|
281
|
+
return to_object
|
282
|
+
|
283
|
+
|
284
|
+
def _Part_to_mldev(
|
285
|
+
api_client: BaseApiClient,
|
286
|
+
from_object: Union[dict[str, Any], object],
|
287
|
+
parent_object: Optional[dict[str, Any]] = None,
|
288
|
+
) -> dict[str, Any]:
|
289
|
+
to_object: dict[str, Any] = {}
|
290
|
+
if getv(from_object, ['video_metadata']) is not None:
|
291
|
+
setv(
|
292
|
+
to_object,
|
293
|
+
['videoMetadata'],
|
294
|
+
_VideoMetadata_to_mldev(
|
295
|
+
api_client, getv(from_object, ['video_metadata']), to_object
|
296
|
+
),
|
297
|
+
)
|
298
|
+
|
299
|
+
if getv(from_object, ['thought']) is not None:
|
300
|
+
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
301
|
+
|
302
|
+
if getv(from_object, ['inline_data']) is not None:
|
303
|
+
setv(
|
304
|
+
to_object,
|
305
|
+
['inlineData'],
|
306
|
+
_Blob_to_mldev(
|
307
|
+
api_client, getv(from_object, ['inline_data']), to_object
|
308
|
+
),
|
309
|
+
)
|
310
|
+
|
311
|
+
if getv(from_object, ['code_execution_result']) is not None:
|
312
|
+
setv(
|
313
|
+
to_object,
|
314
|
+
['codeExecutionResult'],
|
315
|
+
getv(from_object, ['code_execution_result']),
|
316
|
+
)
|
317
|
+
|
318
|
+
if getv(from_object, ['executable_code']) is not None:
|
319
|
+
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
320
|
+
|
321
|
+
if getv(from_object, ['file_data']) is not None:
|
322
|
+
setv(to_object, ['fileData'], getv(from_object, ['file_data']))
|
323
|
+
|
324
|
+
if getv(from_object, ['function_call']) is not None:
|
325
|
+
setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
|
326
|
+
|
327
|
+
if getv(from_object, ['function_response']) is not None:
|
328
|
+
setv(
|
329
|
+
to_object,
|
330
|
+
['functionResponse'],
|
331
|
+
getv(from_object, ['function_response']),
|
332
|
+
)
|
333
|
+
|
334
|
+
if getv(from_object, ['text']) is not None:
|
335
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
336
|
+
|
337
|
+
return to_object
|
338
|
+
|
339
|
+
|
340
|
+
def _Part_to_vertex(
|
341
|
+
api_client: BaseApiClient,
|
342
|
+
from_object: Union[dict[str, Any], object],
|
343
|
+
parent_object: Optional[dict[str, Any]] = None,
|
344
|
+
) -> dict[str, Any]:
|
345
|
+
to_object: dict[str, Any] = {}
|
346
|
+
if getv(from_object, ['video_metadata']) is not None:
|
347
|
+
setv(
|
348
|
+
to_object,
|
349
|
+
['videoMetadata'],
|
350
|
+
_VideoMetadata_to_vertex(
|
351
|
+
api_client, getv(from_object, ['video_metadata']), to_object
|
352
|
+
),
|
353
|
+
)
|
354
|
+
|
355
|
+
if getv(from_object, ['thought']) is not None:
|
356
|
+
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
357
|
+
|
358
|
+
if getv(from_object, ['inline_data']) is not None:
|
359
|
+
setv(
|
360
|
+
to_object,
|
361
|
+
['inlineData'],
|
362
|
+
_Blob_to_vertex(
|
363
|
+
api_client, getv(from_object, ['inline_data']), to_object
|
364
|
+
),
|
365
|
+
)
|
366
|
+
|
367
|
+
if getv(from_object, ['code_execution_result']) is not None:
|
368
|
+
setv(
|
369
|
+
to_object,
|
370
|
+
['codeExecutionResult'],
|
371
|
+
getv(from_object, ['code_execution_result']),
|
372
|
+
)
|
373
|
+
|
374
|
+
if getv(from_object, ['executable_code']) is not None:
|
375
|
+
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
376
|
+
|
377
|
+
if getv(from_object, ['file_data']) is not None:
|
378
|
+
setv(to_object, ['fileData'], getv(from_object, ['file_data']))
|
379
|
+
|
380
|
+
if getv(from_object, ['function_call']) is not None:
|
381
|
+
setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
|
382
|
+
|
383
|
+
if getv(from_object, ['function_response']) is not None:
|
384
|
+
setv(
|
385
|
+
to_object,
|
386
|
+
['functionResponse'],
|
387
|
+
getv(from_object, ['function_response']),
|
388
|
+
)
|
389
|
+
|
390
|
+
if getv(from_object, ['text']) is not None:
|
391
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
392
|
+
|
393
|
+
return to_object
|
394
|
+
|
395
|
+
|
396
|
+
def _Content_to_mldev(
|
397
|
+
api_client: BaseApiClient,
|
398
|
+
from_object: Union[dict[str, Any], object],
|
399
|
+
parent_object: Optional[dict[str, Any]] = None,
|
400
|
+
) -> dict[str, Any]:
|
401
|
+
to_object: dict[str, Any] = {}
|
402
|
+
if getv(from_object, ['parts']) is not None:
|
403
|
+
setv(
|
404
|
+
to_object,
|
405
|
+
['parts'],
|
406
|
+
[
|
407
|
+
_Part_to_mldev(api_client, item, to_object)
|
408
|
+
for item in getv(from_object, ['parts'])
|
409
|
+
],
|
410
|
+
)
|
411
|
+
|
412
|
+
if getv(from_object, ['role']) is not None:
|
413
|
+
setv(to_object, ['role'], getv(from_object, ['role']))
|
414
|
+
|
415
|
+
return to_object
|
416
|
+
|
417
|
+
|
418
|
+
def _Content_to_vertex(
|
419
|
+
api_client: BaseApiClient,
|
420
|
+
from_object: Union[dict[str, Any], object],
|
421
|
+
parent_object: Optional[dict[str, Any]] = None,
|
422
|
+
) -> dict[str, Any]:
|
423
|
+
to_object: dict[str, Any] = {}
|
424
|
+
if getv(from_object, ['parts']) is not None:
|
425
|
+
setv(
|
426
|
+
to_object,
|
427
|
+
['parts'],
|
428
|
+
[
|
429
|
+
_Part_to_vertex(api_client, item, to_object)
|
430
|
+
for item in getv(from_object, ['parts'])
|
431
|
+
],
|
432
|
+
)
|
433
|
+
|
434
|
+
if getv(from_object, ['role']) is not None:
|
435
|
+
setv(to_object, ['role'], getv(from_object, ['role']))
|
436
|
+
|
437
|
+
return to_object
|
438
|
+
|
439
|
+
|
440
|
+
def _FunctionDeclaration_to_mldev(
|
441
|
+
api_client: BaseApiClient,
|
442
|
+
from_object: Union[dict[str, Any], object],
|
443
|
+
parent_object: Optional[dict[str, Any]] = None,
|
444
|
+
) -> dict[str, Any]:
|
445
|
+
to_object: dict[str, Any] = {}
|
446
|
+
if getv(from_object, ['behavior']) is not None:
|
447
|
+
setv(to_object, ['behavior'], getv(from_object, ['behavior']))
|
448
|
+
|
449
|
+
if getv(from_object, ['description']) is not None:
|
450
|
+
setv(to_object, ['description'], getv(from_object, ['description']))
|
451
|
+
|
452
|
+
if getv(from_object, ['name']) is not None:
|
453
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
454
|
+
|
455
|
+
if getv(from_object, ['parameters']) is not None:
|
456
|
+
setv(to_object, ['parameters'], getv(from_object, ['parameters']))
|
457
|
+
|
458
|
+
if getv(from_object, ['response']) is not None:
|
459
|
+
setv(to_object, ['response'], getv(from_object, ['response']))
|
460
|
+
|
461
|
+
return to_object
|
462
|
+
|
463
|
+
|
464
|
+
def _FunctionDeclaration_to_vertex(
|
465
|
+
api_client: BaseApiClient,
|
466
|
+
from_object: Union[dict[str, Any], object],
|
467
|
+
parent_object: Optional[dict[str, Any]] = None,
|
468
|
+
) -> dict[str, Any]:
|
469
|
+
to_object: dict[str, Any] = {}
|
470
|
+
if getv(from_object, ['behavior']) is not None:
|
471
|
+
raise ValueError('behavior parameter is not supported in Vertex AI.')
|
472
|
+
|
473
|
+
if getv(from_object, ['description']) is not None:
|
474
|
+
setv(to_object, ['description'], getv(from_object, ['description']))
|
475
|
+
|
476
|
+
if getv(from_object, ['name']) is not None:
|
477
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
478
|
+
|
479
|
+
if getv(from_object, ['parameters']) is not None:
|
480
|
+
setv(to_object, ['parameters'], getv(from_object, ['parameters']))
|
481
|
+
|
482
|
+
if getv(from_object, ['response']) is not None:
|
483
|
+
setv(to_object, ['response'], getv(from_object, ['response']))
|
484
|
+
|
485
|
+
return to_object
|
486
|
+
|
487
|
+
|
488
|
+
def _Interval_to_mldev(
|
489
|
+
api_client: BaseApiClient,
|
490
|
+
from_object: Union[dict[str, Any], object],
|
491
|
+
parent_object: Optional[dict[str, Any]] = None,
|
492
|
+
) -> dict[str, Any]:
|
493
|
+
to_object: dict[str, Any] = {}
|
494
|
+
if getv(from_object, ['start_time']) is not None:
|
495
|
+
setv(to_object, ['startTime'], getv(from_object, ['start_time']))
|
496
|
+
|
497
|
+
if getv(from_object, ['end_time']) is not None:
|
498
|
+
setv(to_object, ['endTime'], getv(from_object, ['end_time']))
|
499
|
+
|
500
|
+
return to_object
|
501
|
+
|
502
|
+
|
503
|
+
def _Interval_to_vertex(
|
504
|
+
api_client: BaseApiClient,
|
505
|
+
from_object: Union[dict[str, Any], object],
|
506
|
+
parent_object: Optional[dict[str, Any]] = None,
|
507
|
+
) -> dict[str, Any]:
|
508
|
+
to_object: dict[str, Any] = {}
|
509
|
+
if getv(from_object, ['start_time']) is not None:
|
510
|
+
setv(to_object, ['startTime'], getv(from_object, ['start_time']))
|
511
|
+
|
512
|
+
if getv(from_object, ['end_time']) is not None:
|
513
|
+
setv(to_object, ['endTime'], getv(from_object, ['end_time']))
|
514
|
+
|
515
|
+
return to_object
|
516
|
+
|
517
|
+
|
518
|
+
def _GoogleSearch_to_mldev(
|
519
|
+
api_client: BaseApiClient,
|
520
|
+
from_object: Union[dict[str, Any], object],
|
521
|
+
parent_object: Optional[dict[str, Any]] = None,
|
522
|
+
) -> dict[str, Any]:
|
523
|
+
to_object: dict[str, Any] = {}
|
524
|
+
if getv(from_object, ['time_range_filter']) is not None:
|
525
|
+
setv(
|
526
|
+
to_object,
|
527
|
+
['timeRangeFilter'],
|
528
|
+
_Interval_to_mldev(
|
529
|
+
api_client, getv(from_object, ['time_range_filter']), to_object
|
530
|
+
),
|
531
|
+
)
|
532
|
+
|
533
|
+
return to_object
|
534
|
+
|
535
|
+
|
536
|
+
def _GoogleSearch_to_vertex(
|
537
|
+
api_client: BaseApiClient,
|
538
|
+
from_object: Union[dict[str, Any], object],
|
539
|
+
parent_object: Optional[dict[str, Any]] = None,
|
540
|
+
) -> dict[str, Any]:
|
541
|
+
to_object: dict[str, Any] = {}
|
542
|
+
if getv(from_object, ['time_range_filter']) is not None:
|
543
|
+
setv(
|
544
|
+
to_object,
|
545
|
+
['timeRangeFilter'],
|
546
|
+
_Interval_to_vertex(
|
547
|
+
api_client, getv(from_object, ['time_range_filter']), to_object
|
548
|
+
),
|
549
|
+
)
|
550
|
+
|
551
|
+
return to_object
|
552
|
+
|
553
|
+
|
554
|
+
def _DynamicRetrievalConfig_to_mldev(
|
555
|
+
api_client: BaseApiClient,
|
556
|
+
from_object: Union[dict[str, Any], object],
|
557
|
+
parent_object: Optional[dict[str, Any]] = None,
|
558
|
+
) -> dict[str, Any]:
|
559
|
+
to_object: dict[str, Any] = {}
|
560
|
+
if getv(from_object, ['mode']) is not None:
|
561
|
+
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
562
|
+
|
563
|
+
if getv(from_object, ['dynamic_threshold']) is not None:
|
564
|
+
setv(
|
565
|
+
to_object,
|
566
|
+
['dynamicThreshold'],
|
567
|
+
getv(from_object, ['dynamic_threshold']),
|
568
|
+
)
|
569
|
+
|
570
|
+
return to_object
|
571
|
+
|
572
|
+
|
573
|
+
def _DynamicRetrievalConfig_to_vertex(
|
574
|
+
api_client: BaseApiClient,
|
575
|
+
from_object: Union[dict[str, Any], object],
|
576
|
+
parent_object: Optional[dict[str, Any]] = None,
|
577
|
+
) -> dict[str, Any]:
|
578
|
+
to_object: dict[str, Any] = {}
|
579
|
+
if getv(from_object, ['mode']) is not None:
|
580
|
+
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
581
|
+
|
582
|
+
if getv(from_object, ['dynamic_threshold']) is not None:
|
583
|
+
setv(
|
584
|
+
to_object,
|
585
|
+
['dynamicThreshold'],
|
586
|
+
getv(from_object, ['dynamic_threshold']),
|
587
|
+
)
|
588
|
+
|
589
|
+
return to_object
|
590
|
+
|
591
|
+
|
592
|
+
def _GoogleSearchRetrieval_to_mldev(
|
593
|
+
api_client: BaseApiClient,
|
594
|
+
from_object: Union[dict[str, Any], object],
|
595
|
+
parent_object: Optional[dict[str, Any]] = None,
|
596
|
+
) -> dict[str, Any]:
|
597
|
+
to_object: dict[str, Any] = {}
|
598
|
+
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
599
|
+
setv(
|
600
|
+
to_object,
|
601
|
+
['dynamicRetrievalConfig'],
|
602
|
+
_DynamicRetrievalConfig_to_mldev(
|
603
|
+
api_client,
|
604
|
+
getv(from_object, ['dynamic_retrieval_config']),
|
605
|
+
to_object,
|
606
|
+
),
|
607
|
+
)
|
608
|
+
|
609
|
+
return to_object
|
610
|
+
|
611
|
+
|
612
|
+
def _GoogleSearchRetrieval_to_vertex(
|
613
|
+
api_client: BaseApiClient,
|
614
|
+
from_object: Union[dict[str, Any], object],
|
615
|
+
parent_object: Optional[dict[str, Any]] = None,
|
616
|
+
) -> dict[str, Any]:
|
617
|
+
to_object: dict[str, Any] = {}
|
618
|
+
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
619
|
+
setv(
|
620
|
+
to_object,
|
621
|
+
['dynamicRetrievalConfig'],
|
622
|
+
_DynamicRetrievalConfig_to_vertex(
|
623
|
+
api_client,
|
624
|
+
getv(from_object, ['dynamic_retrieval_config']),
|
625
|
+
to_object,
|
626
|
+
),
|
627
|
+
)
|
628
|
+
|
629
|
+
return to_object
|
630
|
+
|
631
|
+
|
632
|
+
def _EnterpriseWebSearch_to_mldev(
|
633
|
+
api_client: BaseApiClient,
|
634
|
+
from_object: Union[dict[str, Any], object],
|
635
|
+
parent_object: Optional[dict[str, Any]] = None,
|
636
|
+
) -> dict[str, Any]:
|
637
|
+
to_object: dict[str, Any] = {}
|
638
|
+
|
639
|
+
return to_object
|
640
|
+
|
641
|
+
|
642
|
+
def _EnterpriseWebSearch_to_vertex(
|
643
|
+
api_client: BaseApiClient,
|
644
|
+
from_object: Union[dict[str, Any], object],
|
645
|
+
parent_object: Optional[dict[str, Any]] = None,
|
646
|
+
) -> dict[str, Any]:
|
647
|
+
to_object: dict[str, Any] = {}
|
648
|
+
|
649
|
+
return to_object
|
650
|
+
|
651
|
+
|
652
|
+
def _ApiKeyConfig_to_mldev(
|
653
|
+
api_client: BaseApiClient,
|
654
|
+
from_object: Union[dict[str, Any], object],
|
655
|
+
parent_object: Optional[dict[str, Any]] = None,
|
656
|
+
) -> dict[str, Any]:
|
657
|
+
to_object: dict[str, Any] = {}
|
658
|
+
if getv(from_object, ['api_key_string']) is not None:
|
659
|
+
raise ValueError('api_key_string parameter is not supported in Gemini API.')
|
660
|
+
|
661
|
+
return to_object
|
662
|
+
|
663
|
+
|
664
|
+
def _ApiKeyConfig_to_vertex(
|
665
|
+
api_client: BaseApiClient,
|
666
|
+
from_object: Union[dict[str, Any], object],
|
667
|
+
parent_object: Optional[dict[str, Any]] = None,
|
668
|
+
) -> dict[str, Any]:
|
669
|
+
to_object: dict[str, Any] = {}
|
670
|
+
if getv(from_object, ['api_key_string']) is not None:
|
671
|
+
setv(to_object, ['apiKeyString'], getv(from_object, ['api_key_string']))
|
672
|
+
|
673
|
+
return to_object
|
674
|
+
|
675
|
+
|
676
|
+
def _AuthConfig_to_mldev(
|
677
|
+
api_client: BaseApiClient,
|
678
|
+
from_object: Union[dict[str, Any], object],
|
679
|
+
parent_object: Optional[dict[str, Any]] = None,
|
680
|
+
) -> dict[str, Any]:
|
681
|
+
to_object: dict[str, Any] = {}
|
682
|
+
if getv(from_object, ['api_key_config']) is not None:
|
683
|
+
raise ValueError('api_key_config parameter is not supported in Gemini API.')
|
684
|
+
|
685
|
+
if getv(from_object, ['auth_type']) is not None:
|
686
|
+
setv(to_object, ['authType'], getv(from_object, ['auth_type']))
|
687
|
+
|
688
|
+
if getv(from_object, ['google_service_account_config']) is not None:
|
689
|
+
setv(
|
690
|
+
to_object,
|
691
|
+
['googleServiceAccountConfig'],
|
692
|
+
getv(from_object, ['google_service_account_config']),
|
693
|
+
)
|
694
|
+
|
695
|
+
if getv(from_object, ['http_basic_auth_config']) is not None:
|
696
|
+
setv(
|
697
|
+
to_object,
|
698
|
+
['httpBasicAuthConfig'],
|
699
|
+
getv(from_object, ['http_basic_auth_config']),
|
700
|
+
)
|
701
|
+
|
702
|
+
if getv(from_object, ['oauth_config']) is not None:
|
703
|
+
setv(to_object, ['oauthConfig'], getv(from_object, ['oauth_config']))
|
704
|
+
|
705
|
+
if getv(from_object, ['oidc_config']) is not None:
|
706
|
+
setv(to_object, ['oidcConfig'], getv(from_object, ['oidc_config']))
|
707
|
+
|
708
|
+
return to_object
|
709
|
+
|
710
|
+
|
711
|
+
def _AuthConfig_to_vertex(
|
712
|
+
api_client: BaseApiClient,
|
713
|
+
from_object: Union[dict[str, Any], object],
|
714
|
+
parent_object: Optional[dict[str, Any]] = None,
|
715
|
+
) -> dict[str, Any]:
|
716
|
+
to_object: dict[str, Any] = {}
|
717
|
+
if getv(from_object, ['api_key_config']) is not None:
|
718
|
+
setv(
|
719
|
+
to_object,
|
720
|
+
['apiKeyConfig'],
|
721
|
+
_ApiKeyConfig_to_vertex(
|
722
|
+
api_client, getv(from_object, ['api_key_config']), to_object
|
723
|
+
),
|
724
|
+
)
|
725
|
+
|
726
|
+
if getv(from_object, ['auth_type']) is not None:
|
727
|
+
setv(to_object, ['authType'], getv(from_object, ['auth_type']))
|
728
|
+
|
729
|
+
if getv(from_object, ['google_service_account_config']) is not None:
|
730
|
+
setv(
|
731
|
+
to_object,
|
732
|
+
['googleServiceAccountConfig'],
|
733
|
+
getv(from_object, ['google_service_account_config']),
|
734
|
+
)
|
735
|
+
|
736
|
+
if getv(from_object, ['http_basic_auth_config']) is not None:
|
737
|
+
setv(
|
738
|
+
to_object,
|
739
|
+
['httpBasicAuthConfig'],
|
740
|
+
getv(from_object, ['http_basic_auth_config']),
|
741
|
+
)
|
742
|
+
|
743
|
+
if getv(from_object, ['oauth_config']) is not None:
|
744
|
+
setv(to_object, ['oauthConfig'], getv(from_object, ['oauth_config']))
|
745
|
+
|
746
|
+
if getv(from_object, ['oidc_config']) is not None:
|
747
|
+
setv(to_object, ['oidcConfig'], getv(from_object, ['oidc_config']))
|
748
|
+
|
749
|
+
return to_object
|
750
|
+
|
751
|
+
|
752
|
+
def _GoogleMaps_to_mldev(
|
753
|
+
api_client: BaseApiClient,
|
754
|
+
from_object: Union[dict[str, Any], object],
|
755
|
+
parent_object: Optional[dict[str, Any]] = None,
|
756
|
+
) -> dict[str, Any]:
|
757
|
+
to_object: dict[str, Any] = {}
|
758
|
+
if getv(from_object, ['auth_config']) is not None:
|
759
|
+
raise ValueError('auth_config parameter is not supported in Gemini API.')
|
760
|
+
|
761
|
+
return to_object
|
762
|
+
|
763
|
+
|
764
|
+
def _GoogleMaps_to_vertex(
|
765
|
+
api_client: BaseApiClient,
|
766
|
+
from_object: Union[dict[str, Any], object],
|
767
|
+
parent_object: Optional[dict[str, Any]] = None,
|
768
|
+
) -> dict[str, Any]:
|
769
|
+
to_object: dict[str, Any] = {}
|
770
|
+
if getv(from_object, ['auth_config']) is not None:
|
771
|
+
setv(
|
772
|
+
to_object,
|
773
|
+
['authConfig'],
|
774
|
+
_AuthConfig_to_vertex(
|
775
|
+
api_client, getv(from_object, ['auth_config']), to_object
|
776
|
+
),
|
777
|
+
)
|
778
|
+
|
779
|
+
return to_object
|
780
|
+
|
781
|
+
|
782
|
+
def _UrlContext_to_mldev(
|
783
|
+
api_client: BaseApiClient,
|
784
|
+
from_object: Union[dict[str, Any], object],
|
785
|
+
parent_object: Optional[dict[str, Any]] = None,
|
786
|
+
) -> dict[str, Any]:
|
787
|
+
to_object: dict[str, Any] = {}
|
788
|
+
|
789
|
+
return to_object
|
790
|
+
|
791
|
+
|
792
|
+
def _UrlContext_to_vertex(
|
793
|
+
api_client: BaseApiClient,
|
794
|
+
from_object: Union[dict[str, Any], object],
|
795
|
+
parent_object: Optional[dict[str, Any]] = None,
|
796
|
+
) -> dict[str, Any]:
|
797
|
+
to_object: dict[str, Any] = {}
|
798
|
+
|
799
|
+
return to_object
|
800
|
+
|
801
|
+
|
802
|
+
def _Tool_to_mldev(
|
803
|
+
api_client: BaseApiClient,
|
804
|
+
from_object: Union[dict[str, Any], object],
|
805
|
+
parent_object: Optional[dict[str, Any]] = None,
|
806
|
+
) -> dict[str, Any]:
|
807
|
+
to_object: dict[str, Any] = {}
|
808
|
+
if getv(from_object, ['function_declarations']) is not None:
|
809
|
+
setv(
|
810
|
+
to_object,
|
811
|
+
['functionDeclarations'],
|
812
|
+
[
|
813
|
+
_FunctionDeclaration_to_mldev(api_client, item, to_object)
|
814
|
+
for item in getv(from_object, ['function_declarations'])
|
815
|
+
],
|
816
|
+
)
|
817
|
+
|
818
|
+
if getv(from_object, ['retrieval']) is not None:
|
819
|
+
raise ValueError('retrieval parameter is not supported in Gemini API.')
|
820
|
+
|
821
|
+
if getv(from_object, ['google_search']) is not None:
|
822
|
+
setv(
|
823
|
+
to_object,
|
824
|
+
['googleSearch'],
|
825
|
+
_GoogleSearch_to_mldev(
|
826
|
+
api_client, getv(from_object, ['google_search']), to_object
|
827
|
+
),
|
828
|
+
)
|
829
|
+
|
830
|
+
if getv(from_object, ['google_search_retrieval']) is not None:
|
831
|
+
setv(
|
832
|
+
to_object,
|
833
|
+
['googleSearchRetrieval'],
|
834
|
+
_GoogleSearchRetrieval_to_mldev(
|
835
|
+
api_client,
|
836
|
+
getv(from_object, ['google_search_retrieval']),
|
837
|
+
to_object,
|
838
|
+
),
|
839
|
+
)
|
840
|
+
|
841
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
842
|
+
raise ValueError(
|
843
|
+
'enterprise_web_search parameter is not supported in Gemini API.'
|
844
|
+
)
|
845
|
+
|
846
|
+
if getv(from_object, ['google_maps']) is not None:
|
847
|
+
raise ValueError('google_maps parameter is not supported in Gemini API.')
|
848
|
+
|
849
|
+
if getv(from_object, ['url_context']) is not None:
|
850
|
+
setv(
|
851
|
+
to_object,
|
852
|
+
['urlContext'],
|
853
|
+
_UrlContext_to_mldev(
|
854
|
+
api_client, getv(from_object, ['url_context']), to_object
|
855
|
+
),
|
856
|
+
)
|
857
|
+
|
858
|
+
if getv(from_object, ['code_execution']) is not None:
|
859
|
+
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
860
|
+
|
861
|
+
return to_object
|
862
|
+
|
863
|
+
|
864
|
+
def _Tool_to_vertex(
|
865
|
+
api_client: BaseApiClient,
|
866
|
+
from_object: Union[dict[str, Any], object],
|
867
|
+
parent_object: Optional[dict[str, Any]] = None,
|
868
|
+
) -> dict[str, Any]:
|
869
|
+
to_object: dict[str, Any] = {}
|
870
|
+
if getv(from_object, ['function_declarations']) is not None:
|
871
|
+
setv(
|
872
|
+
to_object,
|
873
|
+
['functionDeclarations'],
|
874
|
+
[
|
875
|
+
_FunctionDeclaration_to_vertex(api_client, item, to_object)
|
876
|
+
for item in getv(from_object, ['function_declarations'])
|
877
|
+
],
|
878
|
+
)
|
879
|
+
|
880
|
+
if getv(from_object, ['retrieval']) is not None:
|
881
|
+
setv(to_object, ['retrieval'], getv(from_object, ['retrieval']))
|
882
|
+
|
883
|
+
if getv(from_object, ['google_search']) is not None:
|
884
|
+
setv(
|
885
|
+
to_object,
|
886
|
+
['googleSearch'],
|
887
|
+
_GoogleSearch_to_vertex(
|
888
|
+
api_client, getv(from_object, ['google_search']), to_object
|
889
|
+
),
|
890
|
+
)
|
891
|
+
|
892
|
+
if getv(from_object, ['google_search_retrieval']) is not None:
|
893
|
+
setv(
|
894
|
+
to_object,
|
895
|
+
['googleSearchRetrieval'],
|
896
|
+
_GoogleSearchRetrieval_to_vertex(
|
897
|
+
api_client,
|
898
|
+
getv(from_object, ['google_search_retrieval']),
|
899
|
+
to_object,
|
900
|
+
),
|
901
|
+
)
|
902
|
+
|
903
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
904
|
+
setv(
|
905
|
+
to_object,
|
906
|
+
['enterpriseWebSearch'],
|
907
|
+
_EnterpriseWebSearch_to_vertex(
|
908
|
+
api_client, getv(from_object, ['enterprise_web_search']), to_object
|
909
|
+
),
|
910
|
+
)
|
911
|
+
|
912
|
+
if getv(from_object, ['google_maps']) is not None:
|
913
|
+
setv(
|
914
|
+
to_object,
|
915
|
+
['googleMaps'],
|
916
|
+
_GoogleMaps_to_vertex(
|
917
|
+
api_client, getv(from_object, ['google_maps']), to_object
|
918
|
+
),
|
919
|
+
)
|
920
|
+
|
921
|
+
if getv(from_object, ['url_context']) is not None:
|
922
|
+
raise ValueError('url_context parameter is not supported in Vertex AI.')
|
923
|
+
|
924
|
+
if getv(from_object, ['code_execution']) is not None:
|
925
|
+
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
926
|
+
|
927
|
+
return to_object
|
928
|
+
|
929
|
+
|
930
|
+
def _SessionResumptionConfig_to_mldev(
|
931
|
+
api_client: BaseApiClient,
|
932
|
+
from_object: Union[dict[str, Any], object],
|
933
|
+
parent_object: Optional[dict[str, Any]] = None,
|
934
|
+
) -> dict[str, Any]:
|
935
|
+
to_object: dict[str, Any] = {}
|
936
|
+
if getv(from_object, ['handle']) is not None:
|
937
|
+
setv(to_object, ['handle'], getv(from_object, ['handle']))
|
938
|
+
|
939
|
+
if getv(from_object, ['transparent']) is not None:
|
940
|
+
raise ValueError('transparent parameter is not supported in Gemini API.')
|
941
|
+
|
942
|
+
return to_object
|
943
|
+
|
944
|
+
|
945
|
+
def _SessionResumptionConfig_to_vertex(
|
946
|
+
api_client: BaseApiClient,
|
947
|
+
from_object: Union[dict[str, Any], object],
|
948
|
+
parent_object: Optional[dict[str, Any]] = None,
|
949
|
+
) -> dict[str, Any]:
|
950
|
+
to_object: dict[str, Any] = {}
|
951
|
+
if getv(from_object, ['handle']) is not None:
|
952
|
+
setv(to_object, ['handle'], getv(from_object, ['handle']))
|
953
|
+
|
954
|
+
if getv(from_object, ['transparent']) is not None:
|
955
|
+
setv(to_object, ['transparent'], getv(from_object, ['transparent']))
|
956
|
+
|
957
|
+
return to_object
|
958
|
+
|
959
|
+
|
960
|
+
def _AudioTranscriptionConfig_to_mldev(
|
961
|
+
api_client: BaseApiClient,
|
962
|
+
from_object: Union[dict[str, Any], object],
|
963
|
+
parent_object: Optional[dict[str, Any]] = None,
|
964
|
+
) -> dict[str, Any]:
|
965
|
+
to_object: dict[str, Any] = {}
|
966
|
+
|
967
|
+
return to_object
|
968
|
+
|
969
|
+
|
970
|
+
def _AudioTranscriptionConfig_to_vertex(
|
971
|
+
api_client: BaseApiClient,
|
972
|
+
from_object: Union[dict[str, Any], object],
|
973
|
+
parent_object: Optional[dict[str, Any]] = None,
|
974
|
+
) -> dict[str, Any]:
|
975
|
+
to_object: dict[str, Any] = {}
|
976
|
+
|
977
|
+
return to_object
|
978
|
+
|
979
|
+
|
980
|
+
def _AutomaticActivityDetection_to_mldev(
|
981
|
+
api_client: BaseApiClient,
|
982
|
+
from_object: Union[dict[str, Any], object],
|
983
|
+
parent_object: Optional[dict[str, Any]] = None,
|
984
|
+
) -> dict[str, Any]:
|
985
|
+
to_object: dict[str, Any] = {}
|
986
|
+
if getv(from_object, ['disabled']) is not None:
|
987
|
+
setv(to_object, ['disabled'], getv(from_object, ['disabled']))
|
988
|
+
|
989
|
+
if getv(from_object, ['start_of_speech_sensitivity']) is not None:
|
990
|
+
setv(
|
991
|
+
to_object,
|
992
|
+
['startOfSpeechSensitivity'],
|
993
|
+
getv(from_object, ['start_of_speech_sensitivity']),
|
994
|
+
)
|
995
|
+
|
996
|
+
if getv(from_object, ['end_of_speech_sensitivity']) is not None:
|
997
|
+
setv(
|
998
|
+
to_object,
|
999
|
+
['endOfSpeechSensitivity'],
|
1000
|
+
getv(from_object, ['end_of_speech_sensitivity']),
|
1001
|
+
)
|
1002
|
+
|
1003
|
+
if getv(from_object, ['prefix_padding_ms']) is not None:
|
1004
|
+
setv(
|
1005
|
+
to_object, ['prefixPaddingMs'], getv(from_object, ['prefix_padding_ms'])
|
1006
|
+
)
|
1007
|
+
|
1008
|
+
if getv(from_object, ['silence_duration_ms']) is not None:
|
1009
|
+
setv(
|
1010
|
+
to_object,
|
1011
|
+
['silenceDurationMs'],
|
1012
|
+
getv(from_object, ['silence_duration_ms']),
|
1013
|
+
)
|
1014
|
+
|
1015
|
+
return to_object
|
1016
|
+
|
1017
|
+
|
1018
|
+
def _AutomaticActivityDetection_to_vertex(
|
1019
|
+
api_client: BaseApiClient,
|
1020
|
+
from_object: Union[dict[str, Any], object],
|
1021
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1022
|
+
) -> dict[str, Any]:
|
1023
|
+
to_object: dict[str, Any] = {}
|
1024
|
+
if getv(from_object, ['disabled']) is not None:
|
1025
|
+
setv(to_object, ['disabled'], getv(from_object, ['disabled']))
|
1026
|
+
|
1027
|
+
if getv(from_object, ['start_of_speech_sensitivity']) is not None:
|
1028
|
+
setv(
|
1029
|
+
to_object,
|
1030
|
+
['startOfSpeechSensitivity'],
|
1031
|
+
getv(from_object, ['start_of_speech_sensitivity']),
|
1032
|
+
)
|
1033
|
+
|
1034
|
+
if getv(from_object, ['end_of_speech_sensitivity']) is not None:
|
1035
|
+
setv(
|
1036
|
+
to_object,
|
1037
|
+
['endOfSpeechSensitivity'],
|
1038
|
+
getv(from_object, ['end_of_speech_sensitivity']),
|
1039
|
+
)
|
1040
|
+
|
1041
|
+
if getv(from_object, ['prefix_padding_ms']) is not None:
|
1042
|
+
setv(
|
1043
|
+
to_object, ['prefixPaddingMs'], getv(from_object, ['prefix_padding_ms'])
|
1044
|
+
)
|
1045
|
+
|
1046
|
+
if getv(from_object, ['silence_duration_ms']) is not None:
|
1047
|
+
setv(
|
1048
|
+
to_object,
|
1049
|
+
['silenceDurationMs'],
|
1050
|
+
getv(from_object, ['silence_duration_ms']),
|
1051
|
+
)
|
1052
|
+
|
1053
|
+
return to_object
|
1054
|
+
|
1055
|
+
|
1056
|
+
def _RealtimeInputConfig_to_mldev(
|
1057
|
+
api_client: BaseApiClient,
|
1058
|
+
from_object: Union[dict[str, Any], object],
|
1059
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1060
|
+
) -> dict[str, Any]:
|
1061
|
+
to_object: dict[str, Any] = {}
|
1062
|
+
if getv(from_object, ['automatic_activity_detection']) is not None:
|
1063
|
+
setv(
|
1064
|
+
to_object,
|
1065
|
+
['automaticActivityDetection'],
|
1066
|
+
_AutomaticActivityDetection_to_mldev(
|
1067
|
+
api_client,
|
1068
|
+
getv(from_object, ['automatic_activity_detection']),
|
1069
|
+
to_object,
|
1070
|
+
),
|
1071
|
+
)
|
1072
|
+
|
1073
|
+
if getv(from_object, ['activity_handling']) is not None:
|
1074
|
+
setv(
|
1075
|
+
to_object,
|
1076
|
+
['activityHandling'],
|
1077
|
+
getv(from_object, ['activity_handling']),
|
1078
|
+
)
|
1079
|
+
|
1080
|
+
if getv(from_object, ['turn_coverage']) is not None:
|
1081
|
+
setv(to_object, ['turnCoverage'], getv(from_object, ['turn_coverage']))
|
1082
|
+
|
1083
|
+
return to_object
|
1084
|
+
|
1085
|
+
|
1086
|
+
def _RealtimeInputConfig_to_vertex(
|
1087
|
+
api_client: BaseApiClient,
|
1088
|
+
from_object: Union[dict[str, Any], object],
|
1089
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1090
|
+
) -> dict[str, Any]:
|
1091
|
+
to_object: dict[str, Any] = {}
|
1092
|
+
if getv(from_object, ['automatic_activity_detection']) is not None:
|
1093
|
+
setv(
|
1094
|
+
to_object,
|
1095
|
+
['automaticActivityDetection'],
|
1096
|
+
_AutomaticActivityDetection_to_vertex(
|
1097
|
+
api_client,
|
1098
|
+
getv(from_object, ['automatic_activity_detection']),
|
1099
|
+
to_object,
|
1100
|
+
),
|
1101
|
+
)
|
1102
|
+
|
1103
|
+
if getv(from_object, ['activity_handling']) is not None:
|
1104
|
+
setv(
|
1105
|
+
to_object,
|
1106
|
+
['activityHandling'],
|
1107
|
+
getv(from_object, ['activity_handling']),
|
1108
|
+
)
|
1109
|
+
|
1110
|
+
if getv(from_object, ['turn_coverage']) is not None:
|
1111
|
+
setv(to_object, ['turnCoverage'], getv(from_object, ['turn_coverage']))
|
1112
|
+
|
1113
|
+
return to_object
|
1114
|
+
|
1115
|
+
|
1116
|
+
def _SlidingWindow_to_mldev(
|
1117
|
+
api_client: BaseApiClient,
|
1118
|
+
from_object: Union[dict[str, Any], object],
|
1119
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1120
|
+
) -> dict[str, Any]:
|
1121
|
+
to_object: dict[str, Any] = {}
|
1122
|
+
if getv(from_object, ['target_tokens']) is not None:
|
1123
|
+
setv(to_object, ['targetTokens'], getv(from_object, ['target_tokens']))
|
1124
|
+
|
1125
|
+
return to_object
|
1126
|
+
|
1127
|
+
|
1128
|
+
def _SlidingWindow_to_vertex(
|
1129
|
+
api_client: BaseApiClient,
|
1130
|
+
from_object: Union[dict[str, Any], object],
|
1131
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1132
|
+
) -> dict[str, Any]:
|
1133
|
+
to_object: dict[str, Any] = {}
|
1134
|
+
if getv(from_object, ['target_tokens']) is not None:
|
1135
|
+
setv(to_object, ['targetTokens'], getv(from_object, ['target_tokens']))
|
1136
|
+
|
1137
|
+
return to_object
|
1138
|
+
|
1139
|
+
|
1140
|
+
def _ContextWindowCompressionConfig_to_mldev(
|
1141
|
+
api_client: BaseApiClient,
|
1142
|
+
from_object: Union[dict[str, Any], object],
|
1143
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1144
|
+
) -> dict[str, Any]:
|
1145
|
+
to_object: dict[str, Any] = {}
|
1146
|
+
if getv(from_object, ['trigger_tokens']) is not None:
|
1147
|
+
setv(to_object, ['triggerTokens'], getv(from_object, ['trigger_tokens']))
|
1148
|
+
|
1149
|
+
if getv(from_object, ['sliding_window']) is not None:
|
1150
|
+
setv(
|
1151
|
+
to_object,
|
1152
|
+
['slidingWindow'],
|
1153
|
+
_SlidingWindow_to_mldev(
|
1154
|
+
api_client, getv(from_object, ['sliding_window']), to_object
|
1155
|
+
),
|
1156
|
+
)
|
1157
|
+
|
1158
|
+
return to_object
|
1159
|
+
|
1160
|
+
|
1161
|
+
def _ContextWindowCompressionConfig_to_vertex(
|
1162
|
+
api_client: BaseApiClient,
|
1163
|
+
from_object: Union[dict[str, Any], object],
|
1164
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1165
|
+
) -> dict[str, Any]:
|
1166
|
+
to_object: dict[str, Any] = {}
|
1167
|
+
if getv(from_object, ['trigger_tokens']) is not None:
|
1168
|
+
setv(to_object, ['triggerTokens'], getv(from_object, ['trigger_tokens']))
|
1169
|
+
|
1170
|
+
if getv(from_object, ['sliding_window']) is not None:
|
1171
|
+
setv(
|
1172
|
+
to_object,
|
1173
|
+
['slidingWindow'],
|
1174
|
+
_SlidingWindow_to_vertex(
|
1175
|
+
api_client, getv(from_object, ['sliding_window']), to_object
|
1176
|
+
),
|
1177
|
+
)
|
1178
|
+
|
1179
|
+
return to_object
|
1180
|
+
|
1181
|
+
|
1182
|
+
def _ProactivityConfig_to_mldev(
|
1183
|
+
api_client: BaseApiClient,
|
1184
|
+
from_object: Union[dict[str, Any], object],
|
1185
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1186
|
+
) -> dict[str, Any]:
|
1187
|
+
to_object: dict[str, Any] = {}
|
1188
|
+
if getv(from_object, ['proactive_audio']) is not None:
|
1189
|
+
setv(to_object, ['proactiveAudio'], getv(from_object, ['proactive_audio']))
|
1190
|
+
|
1191
|
+
return to_object
|
1192
|
+
|
1193
|
+
|
1194
|
+
def _ProactivityConfig_to_vertex(
|
1195
|
+
api_client: BaseApiClient,
|
1196
|
+
from_object: Union[dict[str, Any], object],
|
1197
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1198
|
+
) -> dict[str, Any]:
|
1199
|
+
to_object: dict[str, Any] = {}
|
1200
|
+
if getv(from_object, ['proactive_audio']) is not None:
|
1201
|
+
setv(to_object, ['proactiveAudio'], getv(from_object, ['proactive_audio']))
|
1202
|
+
|
1203
|
+
return to_object
|
1204
|
+
|
1205
|
+
|
1206
|
+
def _LiveConnectConfig_to_mldev(
|
1207
|
+
api_client: BaseApiClient,
|
1208
|
+
from_object: Union[dict[str, Any], object],
|
1209
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1210
|
+
) -> dict[str, Any]:
|
1211
|
+
to_object: dict[str, Any] = {}
|
1212
|
+
|
1213
|
+
if getv(from_object, ['generation_config']) is not None:
|
1214
|
+
setv(
|
1215
|
+
parent_object,
|
1216
|
+
['setup', 'generationConfig'],
|
1217
|
+
getv(from_object, ['generation_config']),
|
1218
|
+
)
|
1219
|
+
|
1220
|
+
if getv(from_object, ['response_modalities']) is not None:
|
1221
|
+
setv(
|
1222
|
+
parent_object,
|
1223
|
+
['setup', 'generationConfig', 'responseModalities'],
|
1224
|
+
getv(from_object, ['response_modalities']),
|
1225
|
+
)
|
1226
|
+
|
1227
|
+
if getv(from_object, ['temperature']) is not None:
|
1228
|
+
setv(
|
1229
|
+
parent_object,
|
1230
|
+
['setup', 'generationConfig', 'temperature'],
|
1231
|
+
getv(from_object, ['temperature']),
|
1232
|
+
)
|
1233
|
+
|
1234
|
+
if getv(from_object, ['top_p']) is not None:
|
1235
|
+
setv(
|
1236
|
+
parent_object,
|
1237
|
+
['setup', 'generationConfig', 'topP'],
|
1238
|
+
getv(from_object, ['top_p']),
|
1239
|
+
)
|
1240
|
+
|
1241
|
+
if getv(from_object, ['top_k']) is not None:
|
1242
|
+
setv(
|
1243
|
+
parent_object,
|
1244
|
+
['setup', 'generationConfig', 'topK'],
|
1245
|
+
getv(from_object, ['top_k']),
|
1246
|
+
)
|
1247
|
+
|
1248
|
+
if getv(from_object, ['max_output_tokens']) is not None:
|
1249
|
+
setv(
|
1250
|
+
parent_object,
|
1251
|
+
['setup', 'generationConfig', 'maxOutputTokens'],
|
1252
|
+
getv(from_object, ['max_output_tokens']),
|
1253
|
+
)
|
1254
|
+
|
1255
|
+
if getv(from_object, ['media_resolution']) is not None:
|
1256
|
+
setv(
|
1257
|
+
parent_object,
|
1258
|
+
['setup', 'generationConfig', 'mediaResolution'],
|
1259
|
+
getv(from_object, ['media_resolution']),
|
1260
|
+
)
|
1261
|
+
|
1262
|
+
if getv(from_object, ['seed']) is not None:
|
1263
|
+
setv(
|
1264
|
+
parent_object,
|
1265
|
+
['setup', 'generationConfig', 'seed'],
|
1266
|
+
getv(from_object, ['seed']),
|
1267
|
+
)
|
1268
|
+
|
1269
|
+
if getv(from_object, ['speech_config']) is not None:
|
1270
|
+
setv(
|
1271
|
+
parent_object,
|
1272
|
+
['setup', 'generationConfig', 'speechConfig'],
|
1273
|
+
_SpeechConfig_to_mldev(
|
1274
|
+
api_client,
|
1275
|
+
t.t_live_speech_config(
|
1276
|
+
api_client, getv(from_object, ['speech_config'])
|
1277
|
+
),
|
1278
|
+
to_object,
|
1279
|
+
),
|
1280
|
+
)
|
1281
|
+
|
1282
|
+
if getv(from_object, ['enable_affective_dialog']) is not None:
|
1283
|
+
setv(
|
1284
|
+
parent_object,
|
1285
|
+
['setup', 'generationConfig', 'enableAffectiveDialog'],
|
1286
|
+
getv(from_object, ['enable_affective_dialog']),
|
1287
|
+
)
|
1288
|
+
|
1289
|
+
if getv(from_object, ['system_instruction']) is not None:
|
1290
|
+
setv(
|
1291
|
+
parent_object,
|
1292
|
+
['setup', 'systemInstruction'],
|
1293
|
+
_Content_to_mldev(
|
1294
|
+
api_client,
|
1295
|
+
t.t_content(api_client, getv(from_object, ['system_instruction'])),
|
1296
|
+
to_object,
|
1297
|
+
),
|
1298
|
+
)
|
1299
|
+
|
1300
|
+
if getv(from_object, ['tools']) is not None:
|
1301
|
+
setv(
|
1302
|
+
parent_object,
|
1303
|
+
['setup', 'tools'],
|
1304
|
+
[
|
1305
|
+
_Tool_to_mldev(api_client, t.t_tool(api_client, item), to_object)
|
1306
|
+
for item in t.t_tools(api_client, getv(from_object, ['tools']))
|
1307
|
+
],
|
1308
|
+
)
|
1309
|
+
|
1310
|
+
if getv(from_object, ['session_resumption']) is not None:
|
1311
|
+
setv(
|
1312
|
+
parent_object,
|
1313
|
+
['setup', 'sessionResumption'],
|
1314
|
+
_SessionResumptionConfig_to_mldev(
|
1315
|
+
api_client, getv(from_object, ['session_resumption']), to_object
|
1316
|
+
),
|
1317
|
+
)
|
1318
|
+
|
1319
|
+
if getv(from_object, ['input_audio_transcription']) is not None:
|
1320
|
+
setv(
|
1321
|
+
parent_object,
|
1322
|
+
['setup', 'inputAudioTranscription'],
|
1323
|
+
_AudioTranscriptionConfig_to_mldev(
|
1324
|
+
api_client,
|
1325
|
+
getv(from_object, ['input_audio_transcription']),
|
1326
|
+
to_object,
|
1327
|
+
),
|
1328
|
+
)
|
1329
|
+
|
1330
|
+
if getv(from_object, ['output_audio_transcription']) is not None:
|
1331
|
+
setv(
|
1332
|
+
parent_object,
|
1333
|
+
['setup', 'outputAudioTranscription'],
|
1334
|
+
_AudioTranscriptionConfig_to_mldev(
|
1335
|
+
api_client,
|
1336
|
+
getv(from_object, ['output_audio_transcription']),
|
1337
|
+
to_object,
|
1338
|
+
),
|
1339
|
+
)
|
1340
|
+
|
1341
|
+
if getv(from_object, ['realtime_input_config']) is not None:
|
1342
|
+
setv(
|
1343
|
+
parent_object,
|
1344
|
+
['setup', 'realtimeInputConfig'],
|
1345
|
+
_RealtimeInputConfig_to_mldev(
|
1346
|
+
api_client, getv(from_object, ['realtime_input_config']), to_object
|
1347
|
+
),
|
1348
|
+
)
|
1349
|
+
|
1350
|
+
if getv(from_object, ['context_window_compression']) is not None:
|
1351
|
+
setv(
|
1352
|
+
parent_object,
|
1353
|
+
['setup', 'contextWindowCompression'],
|
1354
|
+
_ContextWindowCompressionConfig_to_mldev(
|
1355
|
+
api_client,
|
1356
|
+
getv(from_object, ['context_window_compression']),
|
1357
|
+
to_object,
|
1358
|
+
),
|
1359
|
+
)
|
1360
|
+
|
1361
|
+
if getv(from_object, ['proactivity']) is not None:
|
1362
|
+
setv(
|
1363
|
+
parent_object,
|
1364
|
+
['setup', 'proactivity'],
|
1365
|
+
_ProactivityConfig_to_mldev(
|
1366
|
+
api_client, getv(from_object, ['proactivity']), to_object
|
1367
|
+
),
|
1368
|
+
)
|
1369
|
+
|
1370
|
+
return to_object
|
1371
|
+
|
1372
|
+
|
1373
|
+
def _LiveConnectConfig_to_vertex(
|
1374
|
+
api_client: BaseApiClient,
|
1375
|
+
from_object: Union[dict[str, Any], object],
|
1376
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1377
|
+
) -> dict[str, Any]:
|
1378
|
+
to_object: dict[str, Any] = {}
|
1379
|
+
|
1380
|
+
if getv(from_object, ['generation_config']) is not None:
|
1381
|
+
setv(
|
1382
|
+
parent_object,
|
1383
|
+
['setup', 'generationConfig'],
|
1384
|
+
getv(from_object, ['generation_config']),
|
1385
|
+
)
|
1386
|
+
|
1387
|
+
if getv(from_object, ['response_modalities']) is not None:
|
1388
|
+
setv(
|
1389
|
+
parent_object,
|
1390
|
+
['setup', 'generationConfig', 'responseModalities'],
|
1391
|
+
getv(from_object, ['response_modalities']),
|
1392
|
+
)
|
1393
|
+
|
1394
|
+
if getv(from_object, ['temperature']) is not None:
|
1395
|
+
setv(
|
1396
|
+
parent_object,
|
1397
|
+
['setup', 'generationConfig', 'temperature'],
|
1398
|
+
getv(from_object, ['temperature']),
|
1399
|
+
)
|
1400
|
+
|
1401
|
+
if getv(from_object, ['top_p']) is not None:
|
1402
|
+
setv(
|
1403
|
+
parent_object,
|
1404
|
+
['setup', 'generationConfig', 'topP'],
|
1405
|
+
getv(from_object, ['top_p']),
|
1406
|
+
)
|
1407
|
+
|
1408
|
+
if getv(from_object, ['top_k']) is not None:
|
1409
|
+
setv(
|
1410
|
+
parent_object,
|
1411
|
+
['setup', 'generationConfig', 'topK'],
|
1412
|
+
getv(from_object, ['top_k']),
|
1413
|
+
)
|
1414
|
+
|
1415
|
+
if getv(from_object, ['max_output_tokens']) is not None:
|
1416
|
+
setv(
|
1417
|
+
parent_object,
|
1418
|
+
['setup', 'generationConfig', 'maxOutputTokens'],
|
1419
|
+
getv(from_object, ['max_output_tokens']),
|
1420
|
+
)
|
1421
|
+
|
1422
|
+
if getv(from_object, ['media_resolution']) is not None:
|
1423
|
+
setv(
|
1424
|
+
parent_object,
|
1425
|
+
['setup', 'generationConfig', 'mediaResolution'],
|
1426
|
+
getv(from_object, ['media_resolution']),
|
1427
|
+
)
|
1428
|
+
|
1429
|
+
if getv(from_object, ['seed']) is not None:
|
1430
|
+
setv(
|
1431
|
+
parent_object,
|
1432
|
+
['setup', 'generationConfig', 'seed'],
|
1433
|
+
getv(from_object, ['seed']),
|
1434
|
+
)
|
1435
|
+
|
1436
|
+
if getv(from_object, ['speech_config']) is not None:
|
1437
|
+
setv(
|
1438
|
+
parent_object,
|
1439
|
+
['setup', 'generationConfig', 'speechConfig'],
|
1440
|
+
_SpeechConfig_to_vertex(
|
1441
|
+
api_client,
|
1442
|
+
t.t_live_speech_config(
|
1443
|
+
api_client, getv(from_object, ['speech_config'])
|
1444
|
+
),
|
1445
|
+
to_object,
|
1446
|
+
),
|
1447
|
+
)
|
1448
|
+
|
1449
|
+
if getv(from_object, ['enable_affective_dialog']) is not None:
|
1450
|
+
setv(
|
1451
|
+
parent_object,
|
1452
|
+
['setup', 'generationConfig', 'enableAffectiveDialog'],
|
1453
|
+
getv(from_object, ['enable_affective_dialog']),
|
1454
|
+
)
|
1455
|
+
|
1456
|
+
if getv(from_object, ['system_instruction']) is not None:
|
1457
|
+
setv(
|
1458
|
+
parent_object,
|
1459
|
+
['setup', 'systemInstruction'],
|
1460
|
+
_Content_to_vertex(
|
1461
|
+
api_client,
|
1462
|
+
t.t_content(api_client, getv(from_object, ['system_instruction'])),
|
1463
|
+
to_object,
|
1464
|
+
),
|
1465
|
+
)
|
1466
|
+
|
1467
|
+
if getv(from_object, ['tools']) is not None:
|
1468
|
+
setv(
|
1469
|
+
parent_object,
|
1470
|
+
['setup', 'tools'],
|
1471
|
+
[
|
1472
|
+
_Tool_to_vertex(api_client, t.t_tool(api_client, item), to_object)
|
1473
|
+
for item in t.t_tools(api_client, getv(from_object, ['tools']))
|
1474
|
+
],
|
1475
|
+
)
|
1476
|
+
|
1477
|
+
if getv(from_object, ['session_resumption']) is not None:
|
1478
|
+
setv(
|
1479
|
+
parent_object,
|
1480
|
+
['setup', 'sessionResumption'],
|
1481
|
+
_SessionResumptionConfig_to_vertex(
|
1482
|
+
api_client, getv(from_object, ['session_resumption']), to_object
|
1483
|
+
),
|
1484
|
+
)
|
1485
|
+
|
1486
|
+
if getv(from_object, ['input_audio_transcription']) is not None:
|
1487
|
+
setv(
|
1488
|
+
parent_object,
|
1489
|
+
['setup', 'inputAudioTranscription'],
|
1490
|
+
_AudioTranscriptionConfig_to_vertex(
|
1491
|
+
api_client,
|
1492
|
+
getv(from_object, ['input_audio_transcription']),
|
1493
|
+
to_object,
|
1494
|
+
),
|
1495
|
+
)
|
1496
|
+
|
1497
|
+
if getv(from_object, ['output_audio_transcription']) is not None:
|
1498
|
+
setv(
|
1499
|
+
parent_object,
|
1500
|
+
['setup', 'outputAudioTranscription'],
|
1501
|
+
_AudioTranscriptionConfig_to_vertex(
|
1502
|
+
api_client,
|
1503
|
+
getv(from_object, ['output_audio_transcription']),
|
1504
|
+
to_object,
|
1505
|
+
),
|
1506
|
+
)
|
1507
|
+
|
1508
|
+
if getv(from_object, ['realtime_input_config']) is not None:
|
1509
|
+
setv(
|
1510
|
+
parent_object,
|
1511
|
+
['setup', 'realtimeInputConfig'],
|
1512
|
+
_RealtimeInputConfig_to_vertex(
|
1513
|
+
api_client, getv(from_object, ['realtime_input_config']), to_object
|
1514
|
+
),
|
1515
|
+
)
|
1516
|
+
|
1517
|
+
if getv(from_object, ['context_window_compression']) is not None:
|
1518
|
+
setv(
|
1519
|
+
parent_object,
|
1520
|
+
['setup', 'contextWindowCompression'],
|
1521
|
+
_ContextWindowCompressionConfig_to_vertex(
|
1522
|
+
api_client,
|
1523
|
+
getv(from_object, ['context_window_compression']),
|
1524
|
+
to_object,
|
1525
|
+
),
|
1526
|
+
)
|
1527
|
+
|
1528
|
+
if getv(from_object, ['proactivity']) is not None:
|
1529
|
+
setv(
|
1530
|
+
parent_object,
|
1531
|
+
['setup', 'proactivity'],
|
1532
|
+
_ProactivityConfig_to_vertex(
|
1533
|
+
api_client, getv(from_object, ['proactivity']), to_object
|
1534
|
+
),
|
1535
|
+
)
|
1536
|
+
|
1537
|
+
return to_object
|
1538
|
+
|
1539
|
+
|
1540
|
+
def _LiveEphemeralParameters_to_mldev(
|
1541
|
+
api_client: BaseApiClient,
|
1542
|
+
from_object: Union[dict[str, Any], object],
|
1543
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1544
|
+
) -> dict[str, Any]:
|
1545
|
+
to_object: dict[str, Any] = {}
|
1546
|
+
if getv(from_object, ['model']) is not None:
|
1547
|
+
setv(
|
1548
|
+
to_object,
|
1549
|
+
['setup', 'model'],
|
1550
|
+
t.t_model(api_client, getv(from_object, ['model'])),
|
1551
|
+
)
|
1552
|
+
|
1553
|
+
if getv(from_object, ['config']) is not None:
|
1554
|
+
setv(
|
1555
|
+
to_object,
|
1556
|
+
['config'],
|
1557
|
+
_LiveConnectConfig_to_mldev(
|
1558
|
+
api_client, getv(from_object, ['config']), to_object
|
1559
|
+
),
|
1560
|
+
)
|
1561
|
+
|
1562
|
+
return to_object
|
1563
|
+
|
1564
|
+
|
1565
|
+
def _LiveEphemeralParameters_to_vertex(
|
1566
|
+
api_client: BaseApiClient,
|
1567
|
+
from_object: Union[dict[str, Any], object],
|
1568
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1569
|
+
) -> dict[str, Any]:
|
1570
|
+
to_object: dict[str, Any] = {}
|
1571
|
+
if getv(from_object, ['model']) is not None:
|
1572
|
+
raise ValueError('model parameter is not supported in Vertex AI.')
|
1573
|
+
|
1574
|
+
if getv(from_object, ['config']) is not None:
|
1575
|
+
raise ValueError('config parameter is not supported in Vertex AI.')
|
1576
|
+
|
1577
|
+
return to_object
|
1578
|
+
|
1579
|
+
|
1580
|
+
def _CreateAuthTokenConfig_to_mldev(
|
1581
|
+
api_client: BaseApiClient,
|
1582
|
+
from_object: Union[dict[str, Any], object],
|
1583
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1584
|
+
) -> dict[str, Any]:
|
1585
|
+
to_object: dict[str, Any] = {}
|
1586
|
+
|
1587
|
+
if getv(from_object, ['expire_time']) is not None:
|
1588
|
+
setv(parent_object, ['expireTime'], getv(from_object, ['expire_time']))
|
1589
|
+
|
1590
|
+
if getv(from_object, ['new_session_expire_time']) is not None:
|
1591
|
+
setv(
|
1592
|
+
parent_object,
|
1593
|
+
['newSessionExpireTime'],
|
1594
|
+
getv(from_object, ['new_session_expire_time']),
|
1595
|
+
)
|
1596
|
+
|
1597
|
+
if getv(from_object, ['uses']) is not None:
|
1598
|
+
setv(parent_object, ['uses'], getv(from_object, ['uses']))
|
1599
|
+
|
1600
|
+
if getv(from_object, ['live_ephemeral_parameters']) is not None:
|
1601
|
+
setv(
|
1602
|
+
parent_object,
|
1603
|
+
['bidiGenerateContentSetup'],
|
1604
|
+
_LiveEphemeralParameters_to_mldev(
|
1605
|
+
api_client,
|
1606
|
+
getv(from_object, ['live_ephemeral_parameters']),
|
1607
|
+
to_object,
|
1608
|
+
),
|
1609
|
+
)
|
1610
|
+
|
1611
|
+
if getv(from_object, ['lock_additional_fields']) is not None:
|
1612
|
+
setv(
|
1613
|
+
parent_object,
|
1614
|
+
['fieldMask'],
|
1615
|
+
getv(from_object, ['lock_additional_fields']),
|
1616
|
+
)
|
1617
|
+
|
1618
|
+
return to_object
|
1619
|
+
|
1620
|
+
|
1621
|
+
def _CreateAuthTokenConfig_to_vertex(
|
1622
|
+
api_client: BaseApiClient,
|
1623
|
+
from_object: Union[dict[str, Any], object],
|
1624
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1625
|
+
) -> dict[str, Any]:
|
1626
|
+
to_object: dict[str, Any] = {}
|
1627
|
+
|
1628
|
+
if getv(from_object, ['expire_time']) is not None:
|
1629
|
+
raise ValueError('expire_time parameter is not supported in Vertex AI.')
|
1630
|
+
|
1631
|
+
if getv(from_object, ['new_session_expire_time']) is not None:
|
1632
|
+
raise ValueError(
|
1633
|
+
'new_session_expire_time parameter is not supported in Vertex AI.'
|
1634
|
+
)
|
1635
|
+
|
1636
|
+
if getv(from_object, ['uses']) is not None:
|
1637
|
+
raise ValueError('uses parameter is not supported in Vertex AI.')
|
1638
|
+
|
1639
|
+
if getv(from_object, ['live_ephemeral_parameters']) is not None:
|
1640
|
+
raise ValueError(
|
1641
|
+
'live_ephemeral_parameters parameter is not supported in Vertex AI.'
|
1642
|
+
)
|
1643
|
+
|
1644
|
+
if getv(from_object, ['lock_additional_fields']) is not None:
|
1645
|
+
raise ValueError(
|
1646
|
+
'lock_additional_fields parameter is not supported in Vertex AI.'
|
1647
|
+
)
|
1648
|
+
|
1649
|
+
return to_object
|
1650
|
+
|
1651
|
+
|
1652
|
+
def _CreateAuthTokenParameters_to_mldev(
|
1653
|
+
api_client: BaseApiClient,
|
1654
|
+
from_object: Union[dict[str, Any], object],
|
1655
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1656
|
+
) -> dict[str, Any]:
|
1657
|
+
to_object: dict[str, Any] = {}
|
1658
|
+
if getv(from_object, ['config']) is not None:
|
1659
|
+
setv(
|
1660
|
+
to_object,
|
1661
|
+
['config'],
|
1662
|
+
_CreateAuthTokenConfig_to_mldev(
|
1663
|
+
api_client, getv(from_object, ['config']), to_object
|
1664
|
+
),
|
1665
|
+
)
|
1666
|
+
|
1667
|
+
return to_object
|
1668
|
+
|
1669
|
+
|
1670
|
+
def _CreateAuthTokenParameters_to_vertex(
|
1671
|
+
api_client: BaseApiClient,
|
1672
|
+
from_object: Union[dict[str, Any], object],
|
1673
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1674
|
+
) -> dict[str, Any]:
|
1675
|
+
to_object: dict[str, Any] = {}
|
1676
|
+
if getv(from_object, ['config']) is not None:
|
1677
|
+
raise ValueError('config parameter is not supported in Vertex AI.')
|
1678
|
+
|
1679
|
+
return to_object
|
1680
|
+
|
1681
|
+
|
1682
|
+
def _AuthToken_from_mldev(
|
1683
|
+
api_client: BaseApiClient,
|
1684
|
+
from_object: Union[dict[str, Any], object],
|
1685
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1686
|
+
) -> dict[str, Any]:
|
1687
|
+
to_object: dict[str, Any] = {}
|
1688
|
+
if getv(from_object, ['name']) is not None:
|
1689
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
1690
|
+
|
1691
|
+
return to_object
|
1692
|
+
|
1693
|
+
|
1694
|
+
def _AuthToken_from_vertex(
|
1695
|
+
api_client: BaseApiClient,
|
1696
|
+
from_object: Union[dict[str, Any], object],
|
1697
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1698
|
+
) -> dict[str, Any]:
|
1699
|
+
to_object: dict[str, Any] = {}
|
1700
|
+
|
1701
|
+
return to_object
|