google-genai 1.41.0__py3-none-any.whl → 1.43.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- google/genai/_api_client.py +2 -1
- google/genai/_common.py +213 -77
- google/genai/_live_converters.py +717 -3098
- google/genai/_replay_api_client.py +9 -5
- google/genai/_tokens_converters.py +23 -434
- google/genai/_transformers.py +42 -12
- google/genai/batches.py +125 -1054
- google/genai/caches.py +69 -847
- google/genai/errors.py +9 -2
- google/genai/files.py +12 -171
- google/genai/live.py +10 -11
- google/genai/live_music.py +24 -27
- google/genai/models.py +333 -1828
- google/genai/operations.py +6 -32
- google/genai/tokens.py +2 -12
- google/genai/tunings.py +18 -197
- google/genai/types.py +154 -3
- google/genai/version.py +1 -1
- {google_genai-1.41.0.dist-info → google_genai-1.43.0.dist-info}/METADATA +40 -38
- google_genai-1.43.0.dist-info/RECORD +39 -0
- google_genai-1.41.0.dist-info/RECORD +0 -39
- {google_genai-1.41.0.dist-info → google_genai-1.43.0.dist-info}/WHEEL +0 -0
- {google_genai-1.41.0.dist-info → google_genai-1.43.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.41.0.dist-info → google_genai-1.43.0.dist-info}/top_level.txt +0 -0
google/genai/_live_converters.py
CHANGED
@@ -23,3559 +23,1320 @@ 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 _Blob_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, ['display_name']) is not None:
|
32
|
+
raise ValueError('display_name parameter is not supported in Gemini API.')
|
31
33
|
|
32
|
-
|
33
|
-
|
34
|
+
if getv(from_object, ['data']) is not None:
|
35
|
+
setv(to_object, ['data'], getv(from_object, ['data']))
|
34
36
|
|
35
|
-
|
36
|
-
|
37
|
-
parent_object: Optional[dict[str, Any]] = None,
|
38
|
-
) -> dict[str, Any]:
|
39
|
-
to_object: dict[str, Any] = {}
|
37
|
+
if getv(from_object, ['mime_type']) is not None:
|
38
|
+
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
40
39
|
|
41
40
|
return to_object
|
42
41
|
|
43
42
|
|
44
|
-
def
|
43
|
+
def _Content_to_mldev(
|
45
44
|
from_object: Union[dict[str, Any], object],
|
46
45
|
parent_object: Optional[dict[str, Any]] = None,
|
47
46
|
) -> dict[str, Any]:
|
48
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']))
|
49
60
|
|
50
61
|
return to_object
|
51
62
|
|
52
63
|
|
53
|
-
def
|
64
|
+
def _FileData_to_mldev(
|
54
65
|
from_object: Union[dict[str, Any], object],
|
55
66
|
parent_object: Optional[dict[str, Any]] = None,
|
56
67
|
) -> dict[str, Any]:
|
57
68
|
to_object: dict[str, Any] = {}
|
69
|
+
if getv(from_object, ['display_name']) is not None:
|
70
|
+
raise ValueError('display_name parameter is not supported in Gemini API.')
|
58
71
|
|
59
|
-
|
60
|
-
|
72
|
+
if getv(from_object, ['file_uri']) is not None:
|
73
|
+
setv(to_object, ['fileUri'], getv(from_object, ['file_uri']))
|
61
74
|
|
62
|
-
|
63
|
-
|
64
|
-
parent_object: Optional[dict[str, Any]] = None,
|
65
|
-
) -> dict[str, Any]:
|
66
|
-
to_object: dict[str, Any] = {}
|
67
|
-
if getv(from_object, ['api_key_string']) is not None:
|
68
|
-
setv(to_object, ['apiKeyString'], getv(from_object, ['api_key_string']))
|
75
|
+
if getv(from_object, ['mime_type']) is not None:
|
76
|
+
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
69
77
|
|
70
78
|
return to_object
|
71
79
|
|
72
80
|
|
73
|
-
def
|
81
|
+
def _FunctionDeclaration_to_vertex(
|
74
82
|
from_object: Union[dict[str, Any], object],
|
75
83
|
parent_object: Optional[dict[str, Any]] = None,
|
76
84
|
) -> dict[str, Any]:
|
77
85
|
to_object: dict[str, Any] = {}
|
78
|
-
if getv(from_object, ['
|
79
|
-
|
86
|
+
if getv(from_object, ['behavior']) is not None:
|
87
|
+
raise ValueError('behavior parameter is not supported in Vertex AI.')
|
88
|
+
|
89
|
+
if getv(from_object, ['description']) is not None:
|
90
|
+
setv(to_object, ['description'], getv(from_object, ['description']))
|
91
|
+
|
92
|
+
if getv(from_object, ['name']) is not None:
|
93
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
80
94
|
|
81
|
-
if getv(from_object, ['
|
82
|
-
setv(to_object, ['
|
95
|
+
if getv(from_object, ['parameters']) is not None:
|
96
|
+
setv(to_object, ['parameters'], getv(from_object, ['parameters']))
|
83
97
|
|
84
|
-
if getv(from_object, ['
|
98
|
+
if getv(from_object, ['parameters_json_schema']) is not None:
|
85
99
|
setv(
|
86
100
|
to_object,
|
87
|
-
['
|
88
|
-
|
89
|
-
getv(from_object, ['sourceMetadata']), to_object
|
90
|
-
),
|
101
|
+
['parametersJsonSchema'],
|
102
|
+
getv(from_object, ['parameters_json_schema']),
|
91
103
|
)
|
92
104
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
def _AudioTranscriptionConfig_to_mldev(
|
97
|
-
from_object: Union[dict[str, Any], object],
|
98
|
-
parent_object: Optional[dict[str, Any]] = None,
|
99
|
-
) -> dict[str, Any]:
|
100
|
-
to_object: dict[str, Any] = {}
|
101
|
-
|
102
|
-
return to_object
|
103
|
-
|
105
|
+
if getv(from_object, ['response']) is not None:
|
106
|
+
setv(to_object, ['response'], getv(from_object, ['response']))
|
104
107
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
108
|
+
if getv(from_object, ['response_json_schema']) is not None:
|
109
|
+
setv(
|
110
|
+
to_object,
|
111
|
+
['responseJsonSchema'],
|
112
|
+
getv(from_object, ['response_json_schema']),
|
113
|
+
)
|
110
114
|
|
111
115
|
return to_object
|
112
116
|
|
113
117
|
|
114
|
-
def
|
118
|
+
def _GenerationConfig_to_vertex(
|
115
119
|
from_object: Union[dict[str, Any], object],
|
116
120
|
parent_object: Optional[dict[str, Any]] = None,
|
117
121
|
) -> dict[str, Any]:
|
118
122
|
to_object: dict[str, Any] = {}
|
119
|
-
if getv(from_object, ['
|
123
|
+
if getv(from_object, ['model_selection_config']) is not None:
|
120
124
|
setv(
|
121
125
|
to_object,
|
122
|
-
['
|
123
|
-
|
124
|
-
getv(from_object, ['api_key_config']), to_object
|
125
|
-
),
|
126
|
+
['modelConfig'],
|
127
|
+
getv(from_object, ['model_selection_config']),
|
126
128
|
)
|
127
129
|
|
128
|
-
if getv(from_object, ['
|
129
|
-
setv(to_object, ['
|
130
|
+
if getv(from_object, ['audio_timestamp']) is not None:
|
131
|
+
setv(to_object, ['audioTimestamp'], getv(from_object, ['audio_timestamp']))
|
132
|
+
|
133
|
+
if getv(from_object, ['candidate_count']) is not None:
|
134
|
+
setv(to_object, ['candidateCount'], getv(from_object, ['candidate_count']))
|
130
135
|
|
131
|
-
if getv(from_object, ['
|
136
|
+
if getv(from_object, ['enable_affective_dialog']) is not None:
|
132
137
|
setv(
|
133
138
|
to_object,
|
134
|
-
['
|
135
|
-
getv(from_object, ['
|
139
|
+
['enableAffectiveDialog'],
|
140
|
+
getv(from_object, ['enable_affective_dialog']),
|
136
141
|
)
|
137
142
|
|
138
|
-
if getv(from_object, ['
|
143
|
+
if getv(from_object, ['frequency_penalty']) is not None:
|
139
144
|
setv(
|
140
145
|
to_object,
|
141
|
-
['
|
142
|
-
getv(from_object, ['
|
146
|
+
['frequencyPenalty'],
|
147
|
+
getv(from_object, ['frequency_penalty']),
|
143
148
|
)
|
144
149
|
|
145
|
-
if getv(from_object, ['
|
146
|
-
setv(to_object, ['
|
147
|
-
|
148
|
-
if getv(from_object, ['oidc_config']) is not None:
|
149
|
-
setv(to_object, ['oidcConfig'], getv(from_object, ['oidc_config']))
|
150
|
-
|
151
|
-
return to_object
|
152
|
-
|
153
|
-
|
154
|
-
def _AutomaticActivityDetection_to_mldev(
|
155
|
-
from_object: Union[dict[str, Any], object],
|
156
|
-
parent_object: Optional[dict[str, Any]] = None,
|
157
|
-
) -> dict[str, Any]:
|
158
|
-
to_object: dict[str, Any] = {}
|
159
|
-
if getv(from_object, ['disabled']) is not None:
|
160
|
-
setv(to_object, ['disabled'], getv(from_object, ['disabled']))
|
150
|
+
if getv(from_object, ['logprobs']) is not None:
|
151
|
+
setv(to_object, ['logprobs'], getv(from_object, ['logprobs']))
|
161
152
|
|
162
|
-
if getv(from_object, ['
|
153
|
+
if getv(from_object, ['max_output_tokens']) is not None:
|
163
154
|
setv(
|
164
|
-
to_object,
|
165
|
-
['startOfSpeechSensitivity'],
|
166
|
-
getv(from_object, ['start_of_speech_sensitivity']),
|
155
|
+
to_object, ['maxOutputTokens'], getv(from_object, ['max_output_tokens'])
|
167
156
|
)
|
168
157
|
|
169
|
-
if getv(from_object, ['
|
158
|
+
if getv(from_object, ['media_resolution']) is not None:
|
170
159
|
setv(
|
171
|
-
to_object,
|
172
|
-
['endOfSpeechSensitivity'],
|
173
|
-
getv(from_object, ['end_of_speech_sensitivity']),
|
160
|
+
to_object, ['mediaResolution'], getv(from_object, ['media_resolution'])
|
174
161
|
)
|
175
162
|
|
176
|
-
if getv(from_object, ['
|
163
|
+
if getv(from_object, ['presence_penalty']) is not None:
|
177
164
|
setv(
|
178
|
-
to_object, ['
|
165
|
+
to_object, ['presencePenalty'], getv(from_object, ['presence_penalty'])
|
179
166
|
)
|
180
167
|
|
181
|
-
if getv(from_object, ['
|
168
|
+
if getv(from_object, ['response_json_schema']) is not None:
|
182
169
|
setv(
|
183
170
|
to_object,
|
184
|
-
['
|
185
|
-
getv(from_object, ['
|
171
|
+
['responseJsonSchema'],
|
172
|
+
getv(from_object, ['response_json_schema']),
|
186
173
|
)
|
187
174
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
def _AutomaticActivityDetection_to_vertex(
|
192
|
-
from_object: Union[dict[str, Any], object],
|
193
|
-
parent_object: Optional[dict[str, Any]] = None,
|
194
|
-
) -> dict[str, Any]:
|
195
|
-
to_object: dict[str, Any] = {}
|
196
|
-
if getv(from_object, ['disabled']) is not None:
|
197
|
-
setv(to_object, ['disabled'], getv(from_object, ['disabled']))
|
198
|
-
|
199
|
-
if getv(from_object, ['start_of_speech_sensitivity']) is not None:
|
175
|
+
if getv(from_object, ['response_logprobs']) is not None:
|
200
176
|
setv(
|
201
177
|
to_object,
|
202
|
-
['
|
203
|
-
getv(from_object, ['
|
178
|
+
['responseLogprobs'],
|
179
|
+
getv(from_object, ['response_logprobs']),
|
204
180
|
)
|
205
181
|
|
206
|
-
if getv(from_object, ['
|
182
|
+
if getv(from_object, ['response_mime_type']) is not None:
|
207
183
|
setv(
|
208
184
|
to_object,
|
209
|
-
['
|
210
|
-
getv(from_object, ['
|
185
|
+
['responseMimeType'],
|
186
|
+
getv(from_object, ['response_mime_type']),
|
211
187
|
)
|
212
188
|
|
213
|
-
if getv(from_object, ['
|
189
|
+
if getv(from_object, ['response_modalities']) is not None:
|
214
190
|
setv(
|
215
|
-
to_object,
|
191
|
+
to_object,
|
192
|
+
['responseModalities'],
|
193
|
+
getv(from_object, ['response_modalities']),
|
216
194
|
)
|
217
195
|
|
218
|
-
if getv(from_object, ['
|
196
|
+
if getv(from_object, ['response_schema']) is not None:
|
197
|
+
setv(to_object, ['responseSchema'], getv(from_object, ['response_schema']))
|
198
|
+
|
199
|
+
if getv(from_object, ['routing_config']) is not None:
|
200
|
+
setv(to_object, ['routingConfig'], getv(from_object, ['routing_config']))
|
201
|
+
|
202
|
+
if getv(from_object, ['seed']) is not None:
|
203
|
+
setv(to_object, ['seed'], getv(from_object, ['seed']))
|
204
|
+
|
205
|
+
if getv(from_object, ['speech_config']) is not None:
|
219
206
|
setv(
|
220
207
|
to_object,
|
221
|
-
['
|
222
|
-
|
208
|
+
['speechConfig'],
|
209
|
+
_SpeechConfig_to_vertex(
|
210
|
+
getv(from_object, ['speech_config']), to_object
|
211
|
+
),
|
223
212
|
)
|
224
213
|
|
225
|
-
|
214
|
+
if getv(from_object, ['stop_sequences']) is not None:
|
215
|
+
setv(to_object, ['stopSequences'], getv(from_object, ['stop_sequences']))
|
226
216
|
|
217
|
+
if getv(from_object, ['temperature']) is not None:
|
218
|
+
setv(to_object, ['temperature'], getv(from_object, ['temperature']))
|
227
219
|
|
228
|
-
|
229
|
-
|
230
|
-
parent_object: Optional[dict[str, Any]] = None,
|
231
|
-
) -> dict[str, Any]:
|
232
|
-
to_object: dict[str, Any] = {}
|
220
|
+
if getv(from_object, ['thinking_config']) is not None:
|
221
|
+
setv(to_object, ['thinkingConfig'], getv(from_object, ['thinking_config']))
|
233
222
|
|
234
|
-
if getv(from_object, ['
|
235
|
-
setv(to_object, ['
|
223
|
+
if getv(from_object, ['top_k']) is not None:
|
224
|
+
setv(to_object, ['topK'], getv(from_object, ['top_k']))
|
236
225
|
|
237
|
-
if getv(from_object, ['
|
238
|
-
setv(to_object, ['
|
226
|
+
if getv(from_object, ['top_p']) is not None:
|
227
|
+
setv(to_object, ['topP'], getv(from_object, ['top_p']))
|
239
228
|
|
240
229
|
return to_object
|
241
230
|
|
242
231
|
|
243
|
-
def
|
232
|
+
def _GoogleMaps_to_mldev(
|
244
233
|
from_object: Union[dict[str, Any], object],
|
245
234
|
parent_object: Optional[dict[str, Any]] = None,
|
246
235
|
) -> dict[str, Any]:
|
247
236
|
to_object: dict[str, Any] = {}
|
248
|
-
if getv(from_object, ['
|
249
|
-
|
250
|
-
|
251
|
-
if getv(from_object, ['data']) is not None:
|
252
|
-
setv(to_object, ['data'], getv(from_object, ['data']))
|
237
|
+
if getv(from_object, ['auth_config']) is not None:
|
238
|
+
raise ValueError('auth_config parameter is not supported in Gemini API.')
|
253
239
|
|
254
|
-
if getv(from_object, ['
|
255
|
-
setv(to_object, ['
|
240
|
+
if getv(from_object, ['enable_widget']) is not None:
|
241
|
+
setv(to_object, ['enableWidget'], getv(from_object, ['enable_widget']))
|
256
242
|
|
257
243
|
return to_object
|
258
244
|
|
259
245
|
|
260
|
-
def
|
246
|
+
def _GoogleSearch_to_mldev(
|
261
247
|
from_object: Union[dict[str, Any], object],
|
262
248
|
parent_object: Optional[dict[str, Any]] = None,
|
263
249
|
) -> dict[str, Any]:
|
264
250
|
to_object: dict[str, Any] = {}
|
265
|
-
if getv(from_object, ['
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
setv(to_object, ['data'], getv(from_object, ['data']))
|
251
|
+
if getv(from_object, ['time_range_filter']) is not None:
|
252
|
+
setv(
|
253
|
+
to_object, ['timeRangeFilter'], getv(from_object, ['time_range_filter'])
|
254
|
+
)
|
270
255
|
|
271
|
-
if getv(from_object, ['
|
272
|
-
|
256
|
+
if getv(from_object, ['exclude_domains']) is not None:
|
257
|
+
raise ValueError(
|
258
|
+
'exclude_domains parameter is not supported in Gemini API.'
|
259
|
+
)
|
273
260
|
|
274
261
|
return to_object
|
275
262
|
|
276
263
|
|
277
|
-
def
|
264
|
+
def _LiveClientContent_to_mldev(
|
278
265
|
from_object: Union[dict[str, Any], object],
|
279
266
|
parent_object: Optional[dict[str, Any]] = None,
|
280
267
|
) -> dict[str, Any]:
|
281
268
|
to_object: dict[str, Any] = {}
|
282
|
-
if getv(from_object, ['
|
283
|
-
setv(
|
284
|
-
|
285
|
-
|
286
|
-
|
269
|
+
if getv(from_object, ['turns']) is not None:
|
270
|
+
setv(
|
271
|
+
to_object,
|
272
|
+
['turns'],
|
273
|
+
[
|
274
|
+
_Content_to_mldev(item, to_object)
|
275
|
+
for item in getv(from_object, ['turns'])
|
276
|
+
],
|
277
|
+
)
|
287
278
|
|
288
|
-
if getv(from_object, ['
|
289
|
-
setv(to_object, ['
|
279
|
+
if getv(from_object, ['turn_complete']) is not None:
|
280
|
+
setv(to_object, ['turnComplete'], getv(from_object, ['turn_complete']))
|
290
281
|
|
291
282
|
return to_object
|
292
283
|
|
293
284
|
|
294
|
-
def
|
285
|
+
def _LiveClientMessage_to_mldev(
|
286
|
+
api_client: BaseApiClient,
|
295
287
|
from_object: Union[dict[str, Any], object],
|
296
288
|
parent_object: Optional[dict[str, Any]] = None,
|
297
289
|
) -> dict[str, Any]:
|
298
290
|
to_object: dict[str, Any] = {}
|
299
|
-
if getv(from_object, ['
|
300
|
-
setv(
|
291
|
+
if getv(from_object, ['setup']) is not None:
|
292
|
+
setv(
|
293
|
+
to_object,
|
294
|
+
['setup'],
|
295
|
+
_LiveClientSetup_to_mldev(
|
296
|
+
api_client, getv(from_object, ['setup']), to_object
|
297
|
+
),
|
298
|
+
)
|
299
|
+
|
300
|
+
if getv(from_object, ['client_content']) is not None:
|
301
|
+
setv(
|
302
|
+
to_object,
|
303
|
+
['clientContent'],
|
304
|
+
_LiveClientContent_to_mldev(
|
305
|
+
getv(from_object, ['client_content']), to_object
|
306
|
+
),
|
307
|
+
)
|
301
308
|
|
302
|
-
if getv(from_object, ['
|
309
|
+
if getv(from_object, ['realtime_input']) is not None:
|
303
310
|
setv(
|
304
311
|
to_object,
|
305
|
-
['
|
306
|
-
|
312
|
+
['realtimeInput'],
|
313
|
+
_LiveClientRealtimeInput_to_mldev(
|
314
|
+
getv(from_object, ['realtime_input']), to_object
|
315
|
+
),
|
307
316
|
)
|
308
317
|
|
318
|
+
if getv(from_object, ['tool_response']) is not None:
|
319
|
+
setv(to_object, ['toolResponse'], getv(from_object, ['tool_response']))
|
320
|
+
|
309
321
|
return to_object
|
310
322
|
|
311
323
|
|
312
|
-
def
|
324
|
+
def _LiveClientMessage_to_vertex(
|
325
|
+
api_client: BaseApiClient,
|
313
326
|
from_object: Union[dict[str, Any], object],
|
314
327
|
parent_object: Optional[dict[str, Any]] = None,
|
315
328
|
) -> dict[str, Any]:
|
316
329
|
to_object: dict[str, Any] = {}
|
317
|
-
if getv(from_object, ['
|
318
|
-
setv(
|
330
|
+
if getv(from_object, ['setup']) is not None:
|
331
|
+
setv(
|
332
|
+
to_object,
|
333
|
+
['setup'],
|
334
|
+
_LiveClientSetup_to_vertex(
|
335
|
+
api_client, getv(from_object, ['setup']), to_object
|
336
|
+
),
|
337
|
+
)
|
319
338
|
|
320
|
-
if getv(from_object, ['
|
339
|
+
if getv(from_object, ['client_content']) is not None:
|
340
|
+
setv(to_object, ['clientContent'], getv(from_object, ['client_content']))
|
341
|
+
|
342
|
+
if getv(from_object, ['realtime_input']) is not None:
|
321
343
|
setv(
|
322
344
|
to_object,
|
323
|
-
['
|
324
|
-
|
345
|
+
['realtimeInput'],
|
346
|
+
_LiveClientRealtimeInput_to_vertex(
|
347
|
+
getv(from_object, ['realtime_input']), to_object
|
348
|
+
),
|
325
349
|
)
|
326
350
|
|
351
|
+
if getv(from_object, ['tool_response']) is not None:
|
352
|
+
setv(to_object, ['toolResponse'], getv(from_object, ['tool_response']))
|
353
|
+
|
327
354
|
return to_object
|
328
355
|
|
329
356
|
|
330
|
-
def
|
357
|
+
def _LiveClientRealtimeInput_to_mldev(
|
331
358
|
from_object: Union[dict[str, Any], object],
|
332
359
|
parent_object: Optional[dict[str, Any]] = None,
|
333
360
|
) -> dict[str, Any]:
|
334
361
|
to_object: dict[str, Any] = {}
|
335
|
-
if getv(from_object, ['
|
362
|
+
if getv(from_object, ['media_chunks']) is not None:
|
336
363
|
setv(
|
337
364
|
to_object,
|
338
|
-
['
|
365
|
+
['mediaChunks'],
|
339
366
|
[
|
340
|
-
|
341
|
-
for item in getv(from_object, ['
|
367
|
+
_Blob_to_mldev(item, to_object)
|
368
|
+
for item in getv(from_object, ['media_chunks'])
|
342
369
|
],
|
343
370
|
)
|
344
371
|
|
345
|
-
if getv(from_object, ['
|
346
|
-
setv(
|
347
|
-
|
348
|
-
|
372
|
+
if getv(from_object, ['audio']) is not None:
|
373
|
+
setv(
|
374
|
+
to_object,
|
375
|
+
['audio'],
|
376
|
+
_Blob_to_mldev(getv(from_object, ['audio']), to_object),
|
377
|
+
)
|
349
378
|
|
379
|
+
if getv(from_object, ['audio_stream_end']) is not None:
|
380
|
+
setv(to_object, ['audioStreamEnd'], getv(from_object, ['audio_stream_end']))
|
350
381
|
|
351
|
-
|
352
|
-
from_object: Union[dict[str, Any], object],
|
353
|
-
parent_object: Optional[dict[str, Any]] = None,
|
354
|
-
) -> dict[str, Any]:
|
355
|
-
to_object: dict[str, Any] = {}
|
356
|
-
if getv(from_object, ['parts']) is not None:
|
382
|
+
if getv(from_object, ['video']) is not None:
|
357
383
|
setv(
|
358
384
|
to_object,
|
359
|
-
['
|
360
|
-
[
|
361
|
-
_Part_from_vertex(item, to_object)
|
362
|
-
for item in getv(from_object, ['parts'])
|
363
|
-
],
|
385
|
+
['video'],
|
386
|
+
_Blob_to_mldev(getv(from_object, ['video']), to_object),
|
364
387
|
)
|
365
388
|
|
366
|
-
if getv(from_object, ['
|
367
|
-
setv(to_object, ['
|
389
|
+
if getv(from_object, ['text']) is not None:
|
390
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
391
|
+
|
392
|
+
if getv(from_object, ['activity_start']) is not None:
|
393
|
+
setv(to_object, ['activityStart'], getv(from_object, ['activity_start']))
|
394
|
+
|
395
|
+
if getv(from_object, ['activity_end']) is not None:
|
396
|
+
setv(to_object, ['activityEnd'], getv(from_object, ['activity_end']))
|
368
397
|
|
369
398
|
return to_object
|
370
399
|
|
371
400
|
|
372
|
-
def
|
401
|
+
def _LiveClientRealtimeInput_to_vertex(
|
373
402
|
from_object: Union[dict[str, Any], object],
|
374
403
|
parent_object: Optional[dict[str, Any]] = None,
|
375
404
|
) -> dict[str, Any]:
|
376
405
|
to_object: dict[str, Any] = {}
|
377
|
-
if getv(from_object, ['
|
406
|
+
if getv(from_object, ['media_chunks']) is not None:
|
378
407
|
setv(
|
379
408
|
to_object,
|
380
|
-
['
|
381
|
-
[
|
382
|
-
_Part_to_mldev(item, to_object)
|
383
|
-
for item in getv(from_object, ['parts'])
|
384
|
-
],
|
385
|
-
)
|
386
|
-
|
387
|
-
if getv(from_object, ['role']) is not None:
|
388
|
-
setv(to_object, ['role'], getv(from_object, ['role']))
|
389
|
-
|
390
|
-
return to_object
|
391
|
-
|
392
|
-
|
393
|
-
def _Content_to_vertex(
|
394
|
-
from_object: Union[dict[str, Any], object],
|
395
|
-
parent_object: Optional[dict[str, Any]] = None,
|
396
|
-
) -> dict[str, Any]:
|
397
|
-
to_object: dict[str, Any] = {}
|
398
|
-
if getv(from_object, ['parts']) is not None:
|
399
|
-
setv(
|
400
|
-
to_object,
|
401
|
-
['parts'],
|
402
|
-
[
|
403
|
-
_Part_to_vertex(item, to_object)
|
404
|
-
for item in getv(from_object, ['parts'])
|
405
|
-
],
|
406
|
-
)
|
407
|
-
|
408
|
-
if getv(from_object, ['role']) is not None:
|
409
|
-
setv(to_object, ['role'], getv(from_object, ['role']))
|
410
|
-
|
411
|
-
return to_object
|
412
|
-
|
413
|
-
|
414
|
-
def _ContextWindowCompressionConfig_to_mldev(
|
415
|
-
from_object: Union[dict[str, Any], object],
|
416
|
-
parent_object: Optional[dict[str, Any]] = None,
|
417
|
-
) -> dict[str, Any]:
|
418
|
-
to_object: dict[str, Any] = {}
|
419
|
-
if getv(from_object, ['trigger_tokens']) is not None:
|
420
|
-
setv(to_object, ['triggerTokens'], getv(from_object, ['trigger_tokens']))
|
421
|
-
|
422
|
-
if getv(from_object, ['sliding_window']) is not None:
|
423
|
-
setv(
|
424
|
-
to_object,
|
425
|
-
['slidingWindow'],
|
426
|
-
_SlidingWindow_to_mldev(
|
427
|
-
getv(from_object, ['sliding_window']), to_object
|
428
|
-
),
|
429
|
-
)
|
430
|
-
|
431
|
-
return to_object
|
432
|
-
|
433
|
-
|
434
|
-
def _ContextWindowCompressionConfig_to_vertex(
|
435
|
-
from_object: Union[dict[str, Any], object],
|
436
|
-
parent_object: Optional[dict[str, Any]] = None,
|
437
|
-
) -> dict[str, Any]:
|
438
|
-
to_object: dict[str, Any] = {}
|
439
|
-
if getv(from_object, ['trigger_tokens']) is not None:
|
440
|
-
setv(to_object, ['triggerTokens'], getv(from_object, ['trigger_tokens']))
|
441
|
-
|
442
|
-
if getv(from_object, ['sliding_window']) is not None:
|
443
|
-
setv(
|
444
|
-
to_object,
|
445
|
-
['slidingWindow'],
|
446
|
-
_SlidingWindow_to_vertex(
|
447
|
-
getv(from_object, ['sliding_window']), to_object
|
448
|
-
),
|
449
|
-
)
|
450
|
-
|
451
|
-
return to_object
|
452
|
-
|
453
|
-
|
454
|
-
def _DynamicRetrievalConfig_to_mldev(
|
455
|
-
from_object: Union[dict[str, Any], object],
|
456
|
-
parent_object: Optional[dict[str, Any]] = None,
|
457
|
-
) -> dict[str, Any]:
|
458
|
-
to_object: dict[str, Any] = {}
|
459
|
-
if getv(from_object, ['mode']) is not None:
|
460
|
-
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
461
|
-
|
462
|
-
if getv(from_object, ['dynamic_threshold']) is not None:
|
463
|
-
setv(
|
464
|
-
to_object,
|
465
|
-
['dynamicThreshold'],
|
466
|
-
getv(from_object, ['dynamic_threshold']),
|
467
|
-
)
|
468
|
-
|
469
|
-
return to_object
|
470
|
-
|
471
|
-
|
472
|
-
def _DynamicRetrievalConfig_to_vertex(
|
473
|
-
from_object: Union[dict[str, Any], object],
|
474
|
-
parent_object: Optional[dict[str, Any]] = None,
|
475
|
-
) -> dict[str, Any]:
|
476
|
-
to_object: dict[str, Any] = {}
|
477
|
-
if getv(from_object, ['mode']) is not None:
|
478
|
-
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
479
|
-
|
480
|
-
if getv(from_object, ['dynamic_threshold']) is not None:
|
481
|
-
setv(
|
482
|
-
to_object,
|
483
|
-
['dynamicThreshold'],
|
484
|
-
getv(from_object, ['dynamic_threshold']),
|
485
|
-
)
|
486
|
-
|
487
|
-
return to_object
|
488
|
-
|
489
|
-
|
490
|
-
def _EnterpriseWebSearch_to_vertex(
|
491
|
-
from_object: Union[dict[str, Any], object],
|
492
|
-
parent_object: Optional[dict[str, Any]] = None,
|
493
|
-
) -> dict[str, Any]:
|
494
|
-
to_object: dict[str, Any] = {}
|
495
|
-
if getv(from_object, ['exclude_domains']) is not None:
|
496
|
-
setv(to_object, ['excludeDomains'], getv(from_object, ['exclude_domains']))
|
497
|
-
|
498
|
-
return to_object
|
499
|
-
|
500
|
-
|
501
|
-
def _FileData_from_mldev(
|
502
|
-
from_object: Union[dict[str, Any], object],
|
503
|
-
parent_object: Optional[dict[str, Any]] = None,
|
504
|
-
) -> dict[str, Any]:
|
505
|
-
to_object: dict[str, Any] = {}
|
506
|
-
|
507
|
-
if getv(from_object, ['fileUri']) is not None:
|
508
|
-
setv(to_object, ['file_uri'], getv(from_object, ['fileUri']))
|
509
|
-
|
510
|
-
if getv(from_object, ['mimeType']) is not None:
|
511
|
-
setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
|
512
|
-
|
513
|
-
return to_object
|
514
|
-
|
515
|
-
|
516
|
-
def _FileData_from_vertex(
|
517
|
-
from_object: Union[dict[str, Any], object],
|
518
|
-
parent_object: Optional[dict[str, Any]] = None,
|
519
|
-
) -> dict[str, Any]:
|
520
|
-
to_object: dict[str, Any] = {}
|
521
|
-
if getv(from_object, ['displayName']) is not None:
|
522
|
-
setv(to_object, ['display_name'], getv(from_object, ['displayName']))
|
523
|
-
|
524
|
-
if getv(from_object, ['fileUri']) is not None:
|
525
|
-
setv(to_object, ['file_uri'], getv(from_object, ['fileUri']))
|
526
|
-
|
527
|
-
if getv(from_object, ['mimeType']) is not None:
|
528
|
-
setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
|
529
|
-
|
530
|
-
return to_object
|
531
|
-
|
532
|
-
|
533
|
-
def _FileData_to_mldev(
|
534
|
-
from_object: Union[dict[str, Any], object],
|
535
|
-
parent_object: Optional[dict[str, Any]] = None,
|
536
|
-
) -> dict[str, Any]:
|
537
|
-
to_object: dict[str, Any] = {}
|
538
|
-
if getv(from_object, ['display_name']) is not None:
|
539
|
-
raise ValueError('display_name parameter is not supported in Gemini API.')
|
540
|
-
|
541
|
-
if getv(from_object, ['file_uri']) is not None:
|
542
|
-
setv(to_object, ['fileUri'], getv(from_object, ['file_uri']))
|
543
|
-
|
544
|
-
if getv(from_object, ['mime_type']) is not None:
|
545
|
-
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
546
|
-
|
547
|
-
return to_object
|
548
|
-
|
549
|
-
|
550
|
-
def _FileData_to_vertex(
|
551
|
-
from_object: Union[dict[str, Any], object],
|
552
|
-
parent_object: Optional[dict[str, Any]] = None,
|
553
|
-
) -> dict[str, Any]:
|
554
|
-
to_object: dict[str, Any] = {}
|
555
|
-
if getv(from_object, ['display_name']) is not None:
|
556
|
-
setv(to_object, ['displayName'], getv(from_object, ['display_name']))
|
557
|
-
|
558
|
-
if getv(from_object, ['file_uri']) is not None:
|
559
|
-
setv(to_object, ['fileUri'], getv(from_object, ['file_uri']))
|
560
|
-
|
561
|
-
if getv(from_object, ['mime_type']) is not None:
|
562
|
-
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
563
|
-
|
564
|
-
return to_object
|
565
|
-
|
566
|
-
|
567
|
-
def _FunctionCall_from_mldev(
|
568
|
-
from_object: Union[dict[str, Any], object],
|
569
|
-
parent_object: Optional[dict[str, Any]] = None,
|
570
|
-
) -> dict[str, Any]:
|
571
|
-
to_object: dict[str, Any] = {}
|
572
|
-
if getv(from_object, ['id']) is not None:
|
573
|
-
setv(to_object, ['id'], getv(from_object, ['id']))
|
574
|
-
|
575
|
-
if getv(from_object, ['args']) is not None:
|
576
|
-
setv(to_object, ['args'], getv(from_object, ['args']))
|
577
|
-
|
578
|
-
if getv(from_object, ['name']) is not None:
|
579
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
580
|
-
|
581
|
-
return to_object
|
582
|
-
|
583
|
-
|
584
|
-
def _FunctionCall_from_vertex(
|
585
|
-
from_object: Union[dict[str, Any], object],
|
586
|
-
parent_object: Optional[dict[str, Any]] = None,
|
587
|
-
) -> dict[str, Any]:
|
588
|
-
to_object: dict[str, Any] = {}
|
589
|
-
if getv(from_object, ['id']) is not None:
|
590
|
-
setv(to_object, ['id'], getv(from_object, ['id']))
|
591
|
-
|
592
|
-
if getv(from_object, ['args']) is not None:
|
593
|
-
setv(to_object, ['args'], getv(from_object, ['args']))
|
594
|
-
|
595
|
-
if getv(from_object, ['name']) is not None:
|
596
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
597
|
-
|
598
|
-
return to_object
|
599
|
-
|
600
|
-
|
601
|
-
def _FunctionCall_to_mldev(
|
602
|
-
from_object: Union[dict[str, Any], object],
|
603
|
-
parent_object: Optional[dict[str, Any]] = None,
|
604
|
-
) -> dict[str, Any]:
|
605
|
-
to_object: dict[str, Any] = {}
|
606
|
-
if getv(from_object, ['id']) is not None:
|
607
|
-
setv(to_object, ['id'], getv(from_object, ['id']))
|
608
|
-
|
609
|
-
if getv(from_object, ['args']) is not None:
|
610
|
-
setv(to_object, ['args'], getv(from_object, ['args']))
|
611
|
-
|
612
|
-
if getv(from_object, ['name']) is not None:
|
613
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
614
|
-
|
615
|
-
return to_object
|
616
|
-
|
617
|
-
|
618
|
-
def _FunctionCall_to_vertex(
|
619
|
-
from_object: Union[dict[str, Any], object],
|
620
|
-
parent_object: Optional[dict[str, Any]] = None,
|
621
|
-
) -> dict[str, Any]:
|
622
|
-
to_object: dict[str, Any] = {}
|
623
|
-
if getv(from_object, ['id']) is not None:
|
624
|
-
setv(to_object, ['id'], getv(from_object, ['id']))
|
625
|
-
|
626
|
-
if getv(from_object, ['args']) is not None:
|
627
|
-
setv(to_object, ['args'], getv(from_object, ['args']))
|
628
|
-
|
629
|
-
if getv(from_object, ['name']) is not None:
|
630
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
631
|
-
|
632
|
-
return to_object
|
633
|
-
|
634
|
-
|
635
|
-
def _FunctionDeclaration_to_mldev(
|
636
|
-
from_object: Union[dict[str, Any], object],
|
637
|
-
parent_object: Optional[dict[str, Any]] = None,
|
638
|
-
) -> dict[str, Any]:
|
639
|
-
to_object: dict[str, Any] = {}
|
640
|
-
if getv(from_object, ['behavior']) is not None:
|
641
|
-
setv(to_object, ['behavior'], getv(from_object, ['behavior']))
|
642
|
-
|
643
|
-
if getv(from_object, ['description']) is not None:
|
644
|
-
setv(to_object, ['description'], getv(from_object, ['description']))
|
645
|
-
|
646
|
-
if getv(from_object, ['name']) is not None:
|
647
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
648
|
-
|
649
|
-
if getv(from_object, ['parameters']) is not None:
|
650
|
-
setv(to_object, ['parameters'], getv(from_object, ['parameters']))
|
651
|
-
|
652
|
-
if getv(from_object, ['parameters_json_schema']) is not None:
|
653
|
-
setv(
|
654
|
-
to_object,
|
655
|
-
['parametersJsonSchema'],
|
656
|
-
getv(from_object, ['parameters_json_schema']),
|
657
|
-
)
|
658
|
-
|
659
|
-
if getv(from_object, ['response']) is not None:
|
660
|
-
setv(to_object, ['response'], getv(from_object, ['response']))
|
661
|
-
|
662
|
-
if getv(from_object, ['response_json_schema']) is not None:
|
663
|
-
setv(
|
664
|
-
to_object,
|
665
|
-
['responseJsonSchema'],
|
666
|
-
getv(from_object, ['response_json_schema']),
|
667
|
-
)
|
668
|
-
|
669
|
-
return to_object
|
670
|
-
|
671
|
-
|
672
|
-
def _FunctionDeclaration_to_vertex(
|
673
|
-
from_object: Union[dict[str, Any], object],
|
674
|
-
parent_object: Optional[dict[str, Any]] = None,
|
675
|
-
) -> dict[str, Any]:
|
676
|
-
to_object: dict[str, Any] = {}
|
677
|
-
if getv(from_object, ['behavior']) is not None:
|
678
|
-
raise ValueError('behavior parameter is not supported in Vertex AI.')
|
679
|
-
|
680
|
-
if getv(from_object, ['description']) is not None:
|
681
|
-
setv(to_object, ['description'], getv(from_object, ['description']))
|
682
|
-
|
683
|
-
if getv(from_object, ['name']) is not None:
|
684
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
685
|
-
|
686
|
-
if getv(from_object, ['parameters']) is not None:
|
687
|
-
setv(to_object, ['parameters'], getv(from_object, ['parameters']))
|
688
|
-
|
689
|
-
if getv(from_object, ['parameters_json_schema']) is not None:
|
690
|
-
setv(
|
691
|
-
to_object,
|
692
|
-
['parametersJsonSchema'],
|
693
|
-
getv(from_object, ['parameters_json_schema']),
|
694
|
-
)
|
695
|
-
|
696
|
-
if getv(from_object, ['response']) is not None:
|
697
|
-
setv(to_object, ['response'], getv(from_object, ['response']))
|
698
|
-
|
699
|
-
if getv(from_object, ['response_json_schema']) is not None:
|
700
|
-
setv(
|
701
|
-
to_object,
|
702
|
-
['responseJsonSchema'],
|
703
|
-
getv(from_object, ['response_json_schema']),
|
704
|
-
)
|
705
|
-
|
706
|
-
return to_object
|
707
|
-
|
708
|
-
|
709
|
-
def _FunctionResponseBlob_to_mldev(
|
710
|
-
from_object: Union[dict[str, Any], object],
|
711
|
-
parent_object: Optional[dict[str, Any]] = None,
|
712
|
-
) -> dict[str, Any]:
|
713
|
-
to_object: dict[str, Any] = {}
|
714
|
-
if getv(from_object, ['mime_type']) is not None:
|
715
|
-
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
716
|
-
|
717
|
-
if getv(from_object, ['data']) is not None:
|
718
|
-
setv(to_object, ['data'], getv(from_object, ['data']))
|
719
|
-
|
720
|
-
return to_object
|
721
|
-
|
722
|
-
|
723
|
-
def _FunctionResponseBlob_to_vertex(
|
724
|
-
from_object: Union[dict[str, Any], object],
|
725
|
-
parent_object: Optional[dict[str, Any]] = None,
|
726
|
-
) -> dict[str, Any]:
|
727
|
-
to_object: dict[str, Any] = {}
|
728
|
-
if getv(from_object, ['mime_type']) is not None:
|
729
|
-
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
730
|
-
|
731
|
-
if getv(from_object, ['data']) is not None:
|
732
|
-
setv(to_object, ['data'], getv(from_object, ['data']))
|
733
|
-
|
734
|
-
return to_object
|
735
|
-
|
736
|
-
|
737
|
-
def _FunctionResponseFileData_to_mldev(
|
738
|
-
from_object: Union[dict[str, Any], object],
|
739
|
-
parent_object: Optional[dict[str, Any]] = None,
|
740
|
-
) -> dict[str, Any]:
|
741
|
-
to_object: dict[str, Any] = {}
|
742
|
-
if getv(from_object, ['file_uri']) is not None:
|
743
|
-
setv(to_object, ['fileUri'], getv(from_object, ['file_uri']))
|
744
|
-
|
745
|
-
if getv(from_object, ['mime_type']) is not None:
|
746
|
-
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
747
|
-
|
748
|
-
return to_object
|
749
|
-
|
750
|
-
|
751
|
-
def _FunctionResponseFileData_to_vertex(
|
752
|
-
from_object: Union[dict[str, Any], object],
|
753
|
-
parent_object: Optional[dict[str, Any]] = None,
|
754
|
-
) -> dict[str, Any]:
|
755
|
-
to_object: dict[str, Any] = {}
|
756
|
-
if getv(from_object, ['file_uri']) is not None:
|
757
|
-
setv(to_object, ['fileUri'], getv(from_object, ['file_uri']))
|
758
|
-
|
759
|
-
if getv(from_object, ['mime_type']) is not None:
|
760
|
-
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
761
|
-
|
762
|
-
return to_object
|
763
|
-
|
764
|
-
|
765
|
-
def _FunctionResponsePart_to_mldev(
|
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, ['inline_data']) is not None:
|
771
|
-
setv(
|
772
|
-
to_object,
|
773
|
-
['inlineData'],
|
774
|
-
_FunctionResponseBlob_to_mldev(
|
775
|
-
getv(from_object, ['inline_data']), to_object
|
776
|
-
),
|
777
|
-
)
|
778
|
-
|
779
|
-
if getv(from_object, ['file_data']) is not None:
|
780
|
-
setv(
|
781
|
-
to_object,
|
782
|
-
['fileData'],
|
783
|
-
_FunctionResponseFileData_to_mldev(
|
784
|
-
getv(from_object, ['file_data']), to_object
|
785
|
-
),
|
786
|
-
)
|
787
|
-
|
788
|
-
return to_object
|
789
|
-
|
790
|
-
|
791
|
-
def _FunctionResponsePart_to_vertex(
|
792
|
-
from_object: Union[dict[str, Any], object],
|
793
|
-
parent_object: Optional[dict[str, Any]] = None,
|
794
|
-
) -> dict[str, Any]:
|
795
|
-
to_object: dict[str, Any] = {}
|
796
|
-
if getv(from_object, ['inline_data']) is not None:
|
797
|
-
setv(
|
798
|
-
to_object,
|
799
|
-
['inlineData'],
|
800
|
-
_FunctionResponseBlob_to_vertex(
|
801
|
-
getv(from_object, ['inline_data']), to_object
|
802
|
-
),
|
803
|
-
)
|
804
|
-
|
805
|
-
if getv(from_object, ['file_data']) is not None:
|
806
|
-
setv(
|
807
|
-
to_object,
|
808
|
-
['fileData'],
|
809
|
-
_FunctionResponseFileData_to_vertex(
|
810
|
-
getv(from_object, ['file_data']), to_object
|
811
|
-
),
|
812
|
-
)
|
813
|
-
|
814
|
-
return to_object
|
815
|
-
|
816
|
-
|
817
|
-
def _FunctionResponse_to_mldev(
|
818
|
-
from_object: Union[dict[str, Any], object],
|
819
|
-
parent_object: Optional[dict[str, Any]] = None,
|
820
|
-
) -> dict[str, Any]:
|
821
|
-
to_object: dict[str, Any] = {}
|
822
|
-
if getv(from_object, ['will_continue']) is not None:
|
823
|
-
setv(to_object, ['willContinue'], getv(from_object, ['will_continue']))
|
824
|
-
|
825
|
-
if getv(from_object, ['scheduling']) is not None:
|
826
|
-
setv(to_object, ['scheduling'], getv(from_object, ['scheduling']))
|
827
|
-
|
828
|
-
if getv(from_object, ['parts']) is not None:
|
829
|
-
setv(
|
830
|
-
to_object,
|
831
|
-
['parts'],
|
832
|
-
[
|
833
|
-
_FunctionResponsePart_to_mldev(item, to_object)
|
834
|
-
for item in getv(from_object, ['parts'])
|
835
|
-
],
|
836
|
-
)
|
837
|
-
|
838
|
-
if getv(from_object, ['id']) is not None:
|
839
|
-
setv(to_object, ['id'], getv(from_object, ['id']))
|
840
|
-
|
841
|
-
if getv(from_object, ['name']) is not None:
|
842
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
843
|
-
|
844
|
-
if getv(from_object, ['response']) is not None:
|
845
|
-
setv(to_object, ['response'], getv(from_object, ['response']))
|
846
|
-
|
847
|
-
return to_object
|
848
|
-
|
849
|
-
|
850
|
-
def _FunctionResponse_to_vertex(
|
851
|
-
from_object: Union[dict[str, Any], object],
|
852
|
-
parent_object: Optional[dict[str, Any]] = None,
|
853
|
-
) -> dict[str, Any]:
|
854
|
-
to_object: dict[str, Any] = {}
|
855
|
-
if getv(from_object, ['will_continue']) is not None:
|
856
|
-
raise ValueError('will_continue parameter is not supported in Vertex AI.')
|
857
|
-
|
858
|
-
if getv(from_object, ['scheduling']) is not None:
|
859
|
-
raise ValueError('scheduling parameter is not supported in Vertex AI.')
|
860
|
-
|
861
|
-
if getv(from_object, ['parts']) is not None:
|
862
|
-
setv(
|
863
|
-
to_object,
|
864
|
-
['parts'],
|
865
|
-
[
|
866
|
-
_FunctionResponsePart_to_vertex(item, to_object)
|
867
|
-
for item in getv(from_object, ['parts'])
|
868
|
-
],
|
869
|
-
)
|
870
|
-
|
871
|
-
if getv(from_object, ['id']) is not None:
|
872
|
-
setv(to_object, ['id'], getv(from_object, ['id']))
|
873
|
-
|
874
|
-
if getv(from_object, ['name']) is not None:
|
875
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
876
|
-
|
877
|
-
if getv(from_object, ['response']) is not None:
|
878
|
-
setv(to_object, ['response'], getv(from_object, ['response']))
|
879
|
-
|
880
|
-
return to_object
|
881
|
-
|
882
|
-
|
883
|
-
def _GoogleMaps_to_vertex(
|
884
|
-
from_object: Union[dict[str, Any], object],
|
885
|
-
parent_object: Optional[dict[str, Any]] = None,
|
886
|
-
) -> dict[str, Any]:
|
887
|
-
to_object: dict[str, Any] = {}
|
888
|
-
if getv(from_object, ['auth_config']) is not None:
|
889
|
-
setv(
|
890
|
-
to_object,
|
891
|
-
['authConfig'],
|
892
|
-
_AuthConfig_to_vertex(getv(from_object, ['auth_config']), to_object),
|
893
|
-
)
|
894
|
-
|
895
|
-
return to_object
|
896
|
-
|
897
|
-
|
898
|
-
def _GoogleSearchRetrieval_to_mldev(
|
899
|
-
from_object: Union[dict[str, Any], object],
|
900
|
-
parent_object: Optional[dict[str, Any]] = None,
|
901
|
-
) -> dict[str, Any]:
|
902
|
-
to_object: dict[str, Any] = {}
|
903
|
-
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
904
|
-
setv(
|
905
|
-
to_object,
|
906
|
-
['dynamicRetrievalConfig'],
|
907
|
-
_DynamicRetrievalConfig_to_mldev(
|
908
|
-
getv(from_object, ['dynamic_retrieval_config']), to_object
|
909
|
-
),
|
910
|
-
)
|
911
|
-
|
912
|
-
return to_object
|
913
|
-
|
914
|
-
|
915
|
-
def _GoogleSearchRetrieval_to_vertex(
|
916
|
-
from_object: Union[dict[str, Any], object],
|
917
|
-
parent_object: Optional[dict[str, Any]] = None,
|
918
|
-
) -> dict[str, Any]:
|
919
|
-
to_object: dict[str, Any] = {}
|
920
|
-
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
921
|
-
setv(
|
922
|
-
to_object,
|
923
|
-
['dynamicRetrievalConfig'],
|
924
|
-
_DynamicRetrievalConfig_to_vertex(
|
925
|
-
getv(from_object, ['dynamic_retrieval_config']), to_object
|
926
|
-
),
|
927
|
-
)
|
928
|
-
|
929
|
-
return to_object
|
930
|
-
|
931
|
-
|
932
|
-
def _GoogleSearch_to_mldev(
|
933
|
-
from_object: Union[dict[str, Any], object],
|
934
|
-
parent_object: Optional[dict[str, Any]] = None,
|
935
|
-
) -> dict[str, Any]:
|
936
|
-
to_object: dict[str, Any] = {}
|
937
|
-
if getv(from_object, ['time_range_filter']) is not None:
|
938
|
-
setv(
|
939
|
-
to_object,
|
940
|
-
['timeRangeFilter'],
|
941
|
-
_Interval_to_mldev(getv(from_object, ['time_range_filter']), to_object),
|
942
|
-
)
|
943
|
-
|
944
|
-
if getv(from_object, ['exclude_domains']) is not None:
|
945
|
-
raise ValueError(
|
946
|
-
'exclude_domains parameter is not supported in Gemini API.'
|
947
|
-
)
|
948
|
-
|
949
|
-
return to_object
|
950
|
-
|
951
|
-
|
952
|
-
def _GoogleSearch_to_vertex(
|
953
|
-
from_object: Union[dict[str, Any], object],
|
954
|
-
parent_object: Optional[dict[str, Any]] = None,
|
955
|
-
) -> dict[str, Any]:
|
956
|
-
to_object: dict[str, Any] = {}
|
957
|
-
if getv(from_object, ['time_range_filter']) is not None:
|
958
|
-
setv(
|
959
|
-
to_object,
|
960
|
-
['timeRangeFilter'],
|
961
|
-
_Interval_to_vertex(
|
962
|
-
getv(from_object, ['time_range_filter']), to_object
|
963
|
-
),
|
964
|
-
)
|
965
|
-
|
966
|
-
if getv(from_object, ['exclude_domains']) is not None:
|
967
|
-
setv(to_object, ['excludeDomains'], getv(from_object, ['exclude_domains']))
|
968
|
-
|
969
|
-
return to_object
|
970
|
-
|
971
|
-
|
972
|
-
def _Interval_to_mldev(
|
973
|
-
from_object: Union[dict[str, Any], object],
|
974
|
-
parent_object: Optional[dict[str, Any]] = None,
|
975
|
-
) -> dict[str, Any]:
|
976
|
-
to_object: dict[str, Any] = {}
|
977
|
-
if getv(from_object, ['start_time']) is not None:
|
978
|
-
setv(to_object, ['startTime'], getv(from_object, ['start_time']))
|
979
|
-
|
980
|
-
if getv(from_object, ['end_time']) is not None:
|
981
|
-
setv(to_object, ['endTime'], getv(from_object, ['end_time']))
|
982
|
-
|
983
|
-
return to_object
|
984
|
-
|
985
|
-
|
986
|
-
def _Interval_to_vertex(
|
987
|
-
from_object: Union[dict[str, Any], object],
|
988
|
-
parent_object: Optional[dict[str, Any]] = None,
|
989
|
-
) -> dict[str, Any]:
|
990
|
-
to_object: dict[str, Any] = {}
|
991
|
-
if getv(from_object, ['start_time']) is not None:
|
992
|
-
setv(to_object, ['startTime'], getv(from_object, ['start_time']))
|
993
|
-
|
994
|
-
if getv(from_object, ['end_time']) is not None:
|
995
|
-
setv(to_object, ['endTime'], getv(from_object, ['end_time']))
|
996
|
-
|
997
|
-
return to_object
|
998
|
-
|
999
|
-
|
1000
|
-
def _LiveClientContent_to_mldev(
|
1001
|
-
from_object: Union[dict[str, Any], object],
|
1002
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1003
|
-
) -> dict[str, Any]:
|
1004
|
-
to_object: dict[str, Any] = {}
|
1005
|
-
if getv(from_object, ['turns']) is not None:
|
1006
|
-
setv(
|
1007
|
-
to_object,
|
1008
|
-
['turns'],
|
1009
|
-
[
|
1010
|
-
_Content_to_mldev(item, to_object)
|
1011
|
-
for item in getv(from_object, ['turns'])
|
1012
|
-
],
|
1013
|
-
)
|
1014
|
-
|
1015
|
-
if getv(from_object, ['turn_complete']) is not None:
|
1016
|
-
setv(to_object, ['turnComplete'], getv(from_object, ['turn_complete']))
|
1017
|
-
|
1018
|
-
return to_object
|
1019
|
-
|
1020
|
-
|
1021
|
-
def _LiveClientContent_to_vertex(
|
1022
|
-
from_object: Union[dict[str, Any], object],
|
1023
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1024
|
-
) -> dict[str, Any]:
|
1025
|
-
to_object: dict[str, Any] = {}
|
1026
|
-
if getv(from_object, ['turns']) is not None:
|
1027
|
-
setv(
|
1028
|
-
to_object,
|
1029
|
-
['turns'],
|
1030
|
-
[
|
1031
|
-
_Content_to_vertex(item, to_object)
|
1032
|
-
for item in getv(from_object, ['turns'])
|
1033
|
-
],
|
1034
|
-
)
|
1035
|
-
|
1036
|
-
if getv(from_object, ['turn_complete']) is not None:
|
1037
|
-
setv(to_object, ['turnComplete'], getv(from_object, ['turn_complete']))
|
1038
|
-
|
1039
|
-
return to_object
|
1040
|
-
|
1041
|
-
|
1042
|
-
def _LiveClientMessage_to_mldev(
|
1043
|
-
api_client: BaseApiClient,
|
1044
|
-
from_object: Union[dict[str, Any], object],
|
1045
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1046
|
-
) -> dict[str, Any]:
|
1047
|
-
to_object: dict[str, Any] = {}
|
1048
|
-
if getv(from_object, ['setup']) is not None:
|
1049
|
-
setv(
|
1050
|
-
to_object,
|
1051
|
-
['setup'],
|
1052
|
-
_LiveClientSetup_to_mldev(
|
1053
|
-
api_client, getv(from_object, ['setup']), to_object
|
1054
|
-
),
|
1055
|
-
)
|
1056
|
-
|
1057
|
-
if getv(from_object, ['client_content']) is not None:
|
1058
|
-
setv(
|
1059
|
-
to_object,
|
1060
|
-
['clientContent'],
|
1061
|
-
_LiveClientContent_to_mldev(
|
1062
|
-
getv(from_object, ['client_content']), to_object
|
1063
|
-
),
|
1064
|
-
)
|
1065
|
-
|
1066
|
-
if getv(from_object, ['realtime_input']) is not None:
|
1067
|
-
setv(
|
1068
|
-
to_object,
|
1069
|
-
['realtimeInput'],
|
1070
|
-
_LiveClientRealtimeInput_to_mldev(
|
1071
|
-
getv(from_object, ['realtime_input']), to_object
|
1072
|
-
),
|
1073
|
-
)
|
1074
|
-
|
1075
|
-
if getv(from_object, ['tool_response']) is not None:
|
1076
|
-
setv(
|
1077
|
-
to_object,
|
1078
|
-
['toolResponse'],
|
1079
|
-
_LiveClientToolResponse_to_mldev(
|
1080
|
-
getv(from_object, ['tool_response']), to_object
|
1081
|
-
),
|
1082
|
-
)
|
1083
|
-
|
1084
|
-
return to_object
|
1085
|
-
|
1086
|
-
|
1087
|
-
def _LiveClientMessage_to_vertex(
|
1088
|
-
api_client: BaseApiClient,
|
1089
|
-
from_object: Union[dict[str, Any], object],
|
1090
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1091
|
-
) -> dict[str, Any]:
|
1092
|
-
to_object: dict[str, Any] = {}
|
1093
|
-
if getv(from_object, ['setup']) is not None:
|
1094
|
-
setv(
|
1095
|
-
to_object,
|
1096
|
-
['setup'],
|
1097
|
-
_LiveClientSetup_to_vertex(
|
1098
|
-
api_client, getv(from_object, ['setup']), to_object
|
1099
|
-
),
|
1100
|
-
)
|
1101
|
-
|
1102
|
-
if getv(from_object, ['client_content']) is not None:
|
1103
|
-
setv(
|
1104
|
-
to_object,
|
1105
|
-
['clientContent'],
|
1106
|
-
_LiveClientContent_to_vertex(
|
1107
|
-
getv(from_object, ['client_content']), to_object
|
1108
|
-
),
|
1109
|
-
)
|
1110
|
-
|
1111
|
-
if getv(from_object, ['realtime_input']) is not None:
|
1112
|
-
setv(
|
1113
|
-
to_object,
|
1114
|
-
['realtimeInput'],
|
1115
|
-
_LiveClientRealtimeInput_to_vertex(
|
1116
|
-
getv(from_object, ['realtime_input']), to_object
|
1117
|
-
),
|
1118
|
-
)
|
1119
|
-
|
1120
|
-
if getv(from_object, ['tool_response']) is not None:
|
1121
|
-
setv(
|
1122
|
-
to_object,
|
1123
|
-
['toolResponse'],
|
1124
|
-
_LiveClientToolResponse_to_vertex(
|
1125
|
-
getv(from_object, ['tool_response']), to_object
|
1126
|
-
),
|
1127
|
-
)
|
1128
|
-
|
1129
|
-
return to_object
|
1130
|
-
|
1131
|
-
|
1132
|
-
def _LiveClientRealtimeInput_to_mldev(
|
1133
|
-
from_object: Union[dict[str, Any], object],
|
1134
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1135
|
-
) -> dict[str, Any]:
|
1136
|
-
to_object: dict[str, Any] = {}
|
1137
|
-
if getv(from_object, ['media_chunks']) is not None:
|
1138
|
-
setv(to_object, ['mediaChunks'], getv(from_object, ['media_chunks']))
|
1139
|
-
|
1140
|
-
if getv(from_object, ['audio']) is not None:
|
1141
|
-
setv(to_object, ['audio'], getv(from_object, ['audio']))
|
1142
|
-
|
1143
|
-
if getv(from_object, ['audio_stream_end']) is not None:
|
1144
|
-
setv(to_object, ['audioStreamEnd'], getv(from_object, ['audio_stream_end']))
|
1145
|
-
|
1146
|
-
if getv(from_object, ['video']) is not None:
|
1147
|
-
setv(to_object, ['video'], getv(from_object, ['video']))
|
1148
|
-
|
1149
|
-
if getv(from_object, ['text']) is not None:
|
1150
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
1151
|
-
|
1152
|
-
if getv(from_object, ['activity_start']) is not None:
|
1153
|
-
setv(
|
1154
|
-
to_object,
|
1155
|
-
['activityStart'],
|
1156
|
-
_ActivityStart_to_mldev(
|
1157
|
-
getv(from_object, ['activity_start']), to_object
|
1158
|
-
),
|
1159
|
-
)
|
1160
|
-
|
1161
|
-
if getv(from_object, ['activity_end']) is not None:
|
1162
|
-
setv(
|
1163
|
-
to_object,
|
1164
|
-
['activityEnd'],
|
1165
|
-
_ActivityEnd_to_mldev(getv(from_object, ['activity_end']), to_object),
|
1166
|
-
)
|
1167
|
-
|
1168
|
-
return to_object
|
1169
|
-
|
1170
|
-
|
1171
|
-
def _LiveClientRealtimeInput_to_vertex(
|
1172
|
-
from_object: Union[dict[str, Any], object],
|
1173
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1174
|
-
) -> dict[str, Any]:
|
1175
|
-
to_object: dict[str, Any] = {}
|
1176
|
-
if getv(from_object, ['media_chunks']) is not None:
|
1177
|
-
setv(to_object, ['mediaChunks'], getv(from_object, ['media_chunks']))
|
1178
|
-
|
1179
|
-
if getv(from_object, ['audio']) is not None:
|
1180
|
-
setv(to_object, ['audio'], getv(from_object, ['audio']))
|
1181
|
-
|
1182
|
-
if getv(from_object, ['audio_stream_end']) is not None:
|
1183
|
-
raise ValueError(
|
1184
|
-
'audio_stream_end parameter is not supported in Vertex AI.'
|
1185
|
-
)
|
1186
|
-
|
1187
|
-
if getv(from_object, ['video']) is not None:
|
1188
|
-
setv(to_object, ['video'], getv(from_object, ['video']))
|
1189
|
-
|
1190
|
-
if getv(from_object, ['text']) is not None:
|
1191
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
1192
|
-
|
1193
|
-
if getv(from_object, ['activity_start']) is not None:
|
1194
|
-
setv(
|
1195
|
-
to_object,
|
1196
|
-
['activityStart'],
|
1197
|
-
_ActivityStart_to_vertex(
|
1198
|
-
getv(from_object, ['activity_start']), to_object
|
1199
|
-
),
|
1200
|
-
)
|
1201
|
-
|
1202
|
-
if getv(from_object, ['activity_end']) is not None:
|
1203
|
-
setv(
|
1204
|
-
to_object,
|
1205
|
-
['activityEnd'],
|
1206
|
-
_ActivityEnd_to_vertex(getv(from_object, ['activity_end']), to_object),
|
1207
|
-
)
|
1208
|
-
|
1209
|
-
return to_object
|
1210
|
-
|
1211
|
-
|
1212
|
-
def _LiveClientSetup_to_mldev(
|
1213
|
-
api_client: BaseApiClient,
|
1214
|
-
from_object: Union[dict[str, Any], object],
|
1215
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1216
|
-
) -> dict[str, Any]:
|
1217
|
-
to_object: dict[str, Any] = {}
|
1218
|
-
if getv(from_object, ['model']) is not None:
|
1219
|
-
setv(to_object, ['model'], getv(from_object, ['model']))
|
1220
|
-
|
1221
|
-
if getv(from_object, ['generation_config']) is not None:
|
1222
|
-
setv(
|
1223
|
-
to_object,
|
1224
|
-
['generationConfig'],
|
1225
|
-
getv(from_object, ['generation_config']),
|
1226
|
-
)
|
1227
|
-
|
1228
|
-
if getv(from_object, ['system_instruction']) is not None:
|
1229
|
-
setv(
|
1230
|
-
to_object,
|
1231
|
-
['systemInstruction'],
|
1232
|
-
_Content_to_mldev(
|
1233
|
-
t.t_content(getv(from_object, ['system_instruction'])), to_object
|
1234
|
-
),
|
1235
|
-
)
|
1236
|
-
|
1237
|
-
if getv(from_object, ['tools']) is not None:
|
1238
|
-
setv(
|
1239
|
-
to_object,
|
1240
|
-
['tools'],
|
1241
|
-
[
|
1242
|
-
_Tool_to_mldev(t.t_tool(api_client, item), to_object)
|
1243
|
-
for item in t.t_tools(api_client, getv(from_object, ['tools']))
|
1244
|
-
],
|
1245
|
-
)
|
1246
|
-
|
1247
|
-
if getv(from_object, ['session_resumption']) is not None:
|
1248
|
-
setv(
|
1249
|
-
to_object,
|
1250
|
-
['sessionResumption'],
|
1251
|
-
_SessionResumptionConfig_to_mldev(
|
1252
|
-
getv(from_object, ['session_resumption']), to_object
|
1253
|
-
),
|
1254
|
-
)
|
1255
|
-
|
1256
|
-
if getv(from_object, ['context_window_compression']) is not None:
|
1257
|
-
setv(
|
1258
|
-
to_object,
|
1259
|
-
['contextWindowCompression'],
|
1260
|
-
_ContextWindowCompressionConfig_to_mldev(
|
1261
|
-
getv(from_object, ['context_window_compression']), to_object
|
1262
|
-
),
|
1263
|
-
)
|
1264
|
-
|
1265
|
-
if getv(from_object, ['input_audio_transcription']) is not None:
|
1266
|
-
setv(
|
1267
|
-
to_object,
|
1268
|
-
['inputAudioTranscription'],
|
1269
|
-
_AudioTranscriptionConfig_to_mldev(
|
1270
|
-
getv(from_object, ['input_audio_transcription']), to_object
|
1271
|
-
),
|
1272
|
-
)
|
1273
|
-
|
1274
|
-
if getv(from_object, ['output_audio_transcription']) is not None:
|
1275
|
-
setv(
|
1276
|
-
to_object,
|
1277
|
-
['outputAudioTranscription'],
|
1278
|
-
_AudioTranscriptionConfig_to_mldev(
|
1279
|
-
getv(from_object, ['output_audio_transcription']), to_object
|
1280
|
-
),
|
1281
|
-
)
|
1282
|
-
|
1283
|
-
if getv(from_object, ['proactivity']) is not None:
|
1284
|
-
setv(
|
1285
|
-
to_object,
|
1286
|
-
['proactivity'],
|
1287
|
-
_ProactivityConfig_to_mldev(
|
1288
|
-
getv(from_object, ['proactivity']), to_object
|
1289
|
-
),
|
1290
|
-
)
|
1291
|
-
|
1292
|
-
return to_object
|
1293
|
-
|
1294
|
-
|
1295
|
-
def _LiveClientSetup_to_vertex(
|
1296
|
-
api_client: BaseApiClient,
|
1297
|
-
from_object: Union[dict[str, Any], object],
|
1298
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1299
|
-
) -> dict[str, Any]:
|
1300
|
-
to_object: dict[str, Any] = {}
|
1301
|
-
if getv(from_object, ['model']) is not None:
|
1302
|
-
setv(to_object, ['model'], getv(from_object, ['model']))
|
1303
|
-
|
1304
|
-
if getv(from_object, ['generation_config']) is not None:
|
1305
|
-
setv(
|
1306
|
-
to_object,
|
1307
|
-
['generationConfig'],
|
1308
|
-
getv(from_object, ['generation_config']),
|
1309
|
-
)
|
1310
|
-
|
1311
|
-
if getv(from_object, ['system_instruction']) is not None:
|
1312
|
-
setv(
|
1313
|
-
to_object,
|
1314
|
-
['systemInstruction'],
|
1315
|
-
_Content_to_vertex(
|
1316
|
-
t.t_content(getv(from_object, ['system_instruction'])), to_object
|
1317
|
-
),
|
1318
|
-
)
|
1319
|
-
|
1320
|
-
if getv(from_object, ['tools']) is not None:
|
1321
|
-
setv(
|
1322
|
-
to_object,
|
1323
|
-
['tools'],
|
1324
|
-
[
|
1325
|
-
_Tool_to_vertex(t.t_tool(api_client, item), to_object)
|
1326
|
-
for item in t.t_tools(api_client, getv(from_object, ['tools']))
|
1327
|
-
],
|
1328
|
-
)
|
1329
|
-
|
1330
|
-
if getv(from_object, ['session_resumption']) is not None:
|
1331
|
-
setv(
|
1332
|
-
to_object,
|
1333
|
-
['sessionResumption'],
|
1334
|
-
_SessionResumptionConfig_to_vertex(
|
1335
|
-
getv(from_object, ['session_resumption']), to_object
|
1336
|
-
),
|
1337
|
-
)
|
1338
|
-
|
1339
|
-
if getv(from_object, ['context_window_compression']) is not None:
|
1340
|
-
setv(
|
1341
|
-
to_object,
|
1342
|
-
['contextWindowCompression'],
|
1343
|
-
_ContextWindowCompressionConfig_to_vertex(
|
1344
|
-
getv(from_object, ['context_window_compression']), to_object
|
1345
|
-
),
|
1346
|
-
)
|
1347
|
-
|
1348
|
-
if getv(from_object, ['input_audio_transcription']) is not None:
|
1349
|
-
setv(
|
1350
|
-
to_object,
|
1351
|
-
['inputAudioTranscription'],
|
1352
|
-
_AudioTranscriptionConfig_to_vertex(
|
1353
|
-
getv(from_object, ['input_audio_transcription']), to_object
|
1354
|
-
),
|
1355
|
-
)
|
1356
|
-
|
1357
|
-
if getv(from_object, ['output_audio_transcription']) is not None:
|
1358
|
-
setv(
|
1359
|
-
to_object,
|
1360
|
-
['outputAudioTranscription'],
|
1361
|
-
_AudioTranscriptionConfig_to_vertex(
|
1362
|
-
getv(from_object, ['output_audio_transcription']), to_object
|
1363
|
-
),
|
1364
|
-
)
|
1365
|
-
|
1366
|
-
if getv(from_object, ['proactivity']) is not None:
|
1367
|
-
setv(
|
1368
|
-
to_object,
|
1369
|
-
['proactivity'],
|
1370
|
-
_ProactivityConfig_to_vertex(
|
1371
|
-
getv(from_object, ['proactivity']), to_object
|
1372
|
-
),
|
1373
|
-
)
|
1374
|
-
|
1375
|
-
return to_object
|
1376
|
-
|
1377
|
-
|
1378
|
-
def _LiveClientToolResponse_to_mldev(
|
1379
|
-
from_object: Union[dict[str, Any], object],
|
1380
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1381
|
-
) -> dict[str, Any]:
|
1382
|
-
to_object: dict[str, Any] = {}
|
1383
|
-
if getv(from_object, ['function_responses']) is not None:
|
1384
|
-
setv(
|
1385
|
-
to_object,
|
1386
|
-
['functionResponses'],
|
1387
|
-
[
|
1388
|
-
_FunctionResponse_to_mldev(item, to_object)
|
1389
|
-
for item in getv(from_object, ['function_responses'])
|
1390
|
-
],
|
1391
|
-
)
|
1392
|
-
|
1393
|
-
return to_object
|
1394
|
-
|
1395
|
-
|
1396
|
-
def _LiveClientToolResponse_to_vertex(
|
1397
|
-
from_object: Union[dict[str, Any], object],
|
1398
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1399
|
-
) -> dict[str, Any]:
|
1400
|
-
to_object: dict[str, Any] = {}
|
1401
|
-
if getv(from_object, ['function_responses']) is not None:
|
1402
|
-
setv(
|
1403
|
-
to_object,
|
1404
|
-
['functionResponses'],
|
1405
|
-
[
|
1406
|
-
_FunctionResponse_to_vertex(item, to_object)
|
1407
|
-
for item in getv(from_object, ['function_responses'])
|
1408
|
-
],
|
1409
|
-
)
|
1410
|
-
|
1411
|
-
return to_object
|
1412
|
-
|
1413
|
-
|
1414
|
-
def _LiveConnectConfig_to_mldev(
|
1415
|
-
api_client: BaseApiClient,
|
1416
|
-
from_object: Union[dict[str, Any], object],
|
1417
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1418
|
-
) -> dict[str, Any]:
|
1419
|
-
to_object: dict[str, Any] = {}
|
1420
|
-
|
1421
|
-
if getv(from_object, ['generation_config']) is not None:
|
1422
|
-
setv(
|
1423
|
-
parent_object,
|
1424
|
-
['setup', 'generationConfig'],
|
1425
|
-
getv(from_object, ['generation_config']),
|
1426
|
-
)
|
1427
|
-
|
1428
|
-
if getv(from_object, ['response_modalities']) is not None:
|
1429
|
-
setv(
|
1430
|
-
parent_object,
|
1431
|
-
['setup', 'generationConfig', 'responseModalities'],
|
1432
|
-
getv(from_object, ['response_modalities']),
|
1433
|
-
)
|
1434
|
-
|
1435
|
-
if getv(from_object, ['temperature']) is not None:
|
1436
|
-
setv(
|
1437
|
-
parent_object,
|
1438
|
-
['setup', 'generationConfig', 'temperature'],
|
1439
|
-
getv(from_object, ['temperature']),
|
1440
|
-
)
|
1441
|
-
|
1442
|
-
if getv(from_object, ['top_p']) is not None:
|
1443
|
-
setv(
|
1444
|
-
parent_object,
|
1445
|
-
['setup', 'generationConfig', 'topP'],
|
1446
|
-
getv(from_object, ['top_p']),
|
1447
|
-
)
|
1448
|
-
|
1449
|
-
if getv(from_object, ['top_k']) is not None:
|
1450
|
-
setv(
|
1451
|
-
parent_object,
|
1452
|
-
['setup', 'generationConfig', 'topK'],
|
1453
|
-
getv(from_object, ['top_k']),
|
1454
|
-
)
|
1455
|
-
|
1456
|
-
if getv(from_object, ['max_output_tokens']) is not None:
|
1457
|
-
setv(
|
1458
|
-
parent_object,
|
1459
|
-
['setup', 'generationConfig', 'maxOutputTokens'],
|
1460
|
-
getv(from_object, ['max_output_tokens']),
|
1461
|
-
)
|
1462
|
-
|
1463
|
-
if getv(from_object, ['media_resolution']) is not None:
|
1464
|
-
setv(
|
1465
|
-
parent_object,
|
1466
|
-
['setup', 'generationConfig', 'mediaResolution'],
|
1467
|
-
getv(from_object, ['media_resolution']),
|
1468
|
-
)
|
1469
|
-
|
1470
|
-
if getv(from_object, ['seed']) is not None:
|
1471
|
-
setv(
|
1472
|
-
parent_object,
|
1473
|
-
['setup', 'generationConfig', 'seed'],
|
1474
|
-
getv(from_object, ['seed']),
|
1475
|
-
)
|
1476
|
-
|
1477
|
-
if getv(from_object, ['speech_config']) is not None:
|
1478
|
-
setv(
|
1479
|
-
parent_object,
|
1480
|
-
['setup', 'generationConfig', 'speechConfig'],
|
1481
|
-
_SpeechConfig_to_mldev(
|
1482
|
-
t.t_live_speech_config(getv(from_object, ['speech_config'])),
|
1483
|
-
to_object,
|
1484
|
-
),
|
1485
|
-
)
|
1486
|
-
|
1487
|
-
if getv(from_object, ['thinking_config']) is not None:
|
1488
|
-
setv(
|
1489
|
-
parent_object,
|
1490
|
-
['setup', 'generationConfig', 'thinkingConfig'],
|
1491
|
-
_ThinkingConfig_to_mldev(
|
1492
|
-
getv(from_object, ['thinking_config']), to_object
|
1493
|
-
),
|
1494
|
-
)
|
1495
|
-
|
1496
|
-
if getv(from_object, ['enable_affective_dialog']) is not None:
|
1497
|
-
setv(
|
1498
|
-
parent_object,
|
1499
|
-
['setup', 'generationConfig', 'enableAffectiveDialog'],
|
1500
|
-
getv(from_object, ['enable_affective_dialog']),
|
1501
|
-
)
|
1502
|
-
|
1503
|
-
if getv(from_object, ['system_instruction']) is not None:
|
1504
|
-
setv(
|
1505
|
-
parent_object,
|
1506
|
-
['setup', 'systemInstruction'],
|
1507
|
-
_Content_to_mldev(
|
1508
|
-
t.t_content(getv(from_object, ['system_instruction'])), to_object
|
1509
|
-
),
|
1510
|
-
)
|
1511
|
-
|
1512
|
-
if getv(from_object, ['tools']) is not None:
|
1513
|
-
setv(
|
1514
|
-
parent_object,
|
1515
|
-
['setup', 'tools'],
|
1516
|
-
[
|
1517
|
-
_Tool_to_mldev(t.t_tool(api_client, item), to_object)
|
1518
|
-
for item in t.t_tools(api_client, getv(from_object, ['tools']))
|
1519
|
-
],
|
1520
|
-
)
|
1521
|
-
|
1522
|
-
if getv(from_object, ['session_resumption']) is not None:
|
1523
|
-
setv(
|
1524
|
-
parent_object,
|
1525
|
-
['setup', 'sessionResumption'],
|
1526
|
-
_SessionResumptionConfig_to_mldev(
|
1527
|
-
getv(from_object, ['session_resumption']), to_object
|
1528
|
-
),
|
1529
|
-
)
|
1530
|
-
|
1531
|
-
if getv(from_object, ['input_audio_transcription']) is not None:
|
1532
|
-
setv(
|
1533
|
-
parent_object,
|
1534
|
-
['setup', 'inputAudioTranscription'],
|
1535
|
-
_AudioTranscriptionConfig_to_mldev(
|
1536
|
-
getv(from_object, ['input_audio_transcription']), to_object
|
1537
|
-
),
|
1538
|
-
)
|
1539
|
-
|
1540
|
-
if getv(from_object, ['output_audio_transcription']) is not None:
|
1541
|
-
setv(
|
1542
|
-
parent_object,
|
1543
|
-
['setup', 'outputAudioTranscription'],
|
1544
|
-
_AudioTranscriptionConfig_to_mldev(
|
1545
|
-
getv(from_object, ['output_audio_transcription']), to_object
|
1546
|
-
),
|
1547
|
-
)
|
1548
|
-
|
1549
|
-
if getv(from_object, ['realtime_input_config']) is not None:
|
1550
|
-
setv(
|
1551
|
-
parent_object,
|
1552
|
-
['setup', 'realtimeInputConfig'],
|
1553
|
-
_RealtimeInputConfig_to_mldev(
|
1554
|
-
getv(from_object, ['realtime_input_config']), to_object
|
1555
|
-
),
|
1556
|
-
)
|
1557
|
-
|
1558
|
-
if getv(from_object, ['context_window_compression']) is not None:
|
1559
|
-
setv(
|
1560
|
-
parent_object,
|
1561
|
-
['setup', 'contextWindowCompression'],
|
1562
|
-
_ContextWindowCompressionConfig_to_mldev(
|
1563
|
-
getv(from_object, ['context_window_compression']), to_object
|
1564
|
-
),
|
1565
|
-
)
|
1566
|
-
|
1567
|
-
if getv(from_object, ['proactivity']) is not None:
|
1568
|
-
setv(
|
1569
|
-
parent_object,
|
1570
|
-
['setup', 'proactivity'],
|
1571
|
-
_ProactivityConfig_to_mldev(
|
1572
|
-
getv(from_object, ['proactivity']), to_object
|
1573
|
-
),
|
1574
|
-
)
|
1575
|
-
|
1576
|
-
return to_object
|
1577
|
-
|
1578
|
-
|
1579
|
-
def _LiveConnectConfig_to_vertex(
|
1580
|
-
api_client: BaseApiClient,
|
1581
|
-
from_object: Union[dict[str, Any], object],
|
1582
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1583
|
-
) -> dict[str, Any]:
|
1584
|
-
to_object: dict[str, Any] = {}
|
1585
|
-
|
1586
|
-
if getv(from_object, ['generation_config']) is not None:
|
1587
|
-
setv(
|
1588
|
-
parent_object,
|
1589
|
-
['setup', 'generationConfig'],
|
1590
|
-
getv(from_object, ['generation_config']),
|
1591
|
-
)
|
1592
|
-
|
1593
|
-
if getv(from_object, ['response_modalities']) is not None:
|
1594
|
-
setv(
|
1595
|
-
parent_object,
|
1596
|
-
['setup', 'generationConfig', 'responseModalities'],
|
1597
|
-
getv(from_object, ['response_modalities']),
|
1598
|
-
)
|
1599
|
-
|
1600
|
-
if getv(from_object, ['temperature']) is not None:
|
1601
|
-
setv(
|
1602
|
-
parent_object,
|
1603
|
-
['setup', 'generationConfig', 'temperature'],
|
1604
|
-
getv(from_object, ['temperature']),
|
1605
|
-
)
|
1606
|
-
|
1607
|
-
if getv(from_object, ['top_p']) is not None:
|
1608
|
-
setv(
|
1609
|
-
parent_object,
|
1610
|
-
['setup', 'generationConfig', 'topP'],
|
1611
|
-
getv(from_object, ['top_p']),
|
1612
|
-
)
|
1613
|
-
|
1614
|
-
if getv(from_object, ['top_k']) is not None:
|
1615
|
-
setv(
|
1616
|
-
parent_object,
|
1617
|
-
['setup', 'generationConfig', 'topK'],
|
1618
|
-
getv(from_object, ['top_k']),
|
1619
|
-
)
|
1620
|
-
|
1621
|
-
if getv(from_object, ['max_output_tokens']) is not None:
|
1622
|
-
setv(
|
1623
|
-
parent_object,
|
1624
|
-
['setup', 'generationConfig', 'maxOutputTokens'],
|
1625
|
-
getv(from_object, ['max_output_tokens']),
|
1626
|
-
)
|
1627
|
-
|
1628
|
-
if getv(from_object, ['media_resolution']) is not None:
|
1629
|
-
setv(
|
1630
|
-
parent_object,
|
1631
|
-
['setup', 'generationConfig', 'mediaResolution'],
|
1632
|
-
getv(from_object, ['media_resolution']),
|
1633
|
-
)
|
1634
|
-
|
1635
|
-
if getv(from_object, ['seed']) is not None:
|
1636
|
-
setv(
|
1637
|
-
parent_object,
|
1638
|
-
['setup', 'generationConfig', 'seed'],
|
1639
|
-
getv(from_object, ['seed']),
|
1640
|
-
)
|
1641
|
-
|
1642
|
-
if getv(from_object, ['speech_config']) is not None:
|
1643
|
-
setv(
|
1644
|
-
parent_object,
|
1645
|
-
['setup', 'generationConfig', 'speechConfig'],
|
1646
|
-
_SpeechConfig_to_vertex(
|
1647
|
-
t.t_live_speech_config(getv(from_object, ['speech_config'])),
|
1648
|
-
to_object,
|
1649
|
-
),
|
1650
|
-
)
|
1651
|
-
|
1652
|
-
if getv(from_object, ['thinking_config']) is not None:
|
1653
|
-
setv(
|
1654
|
-
parent_object,
|
1655
|
-
['setup', 'generationConfig', 'thinkingConfig'],
|
1656
|
-
_ThinkingConfig_to_vertex(
|
1657
|
-
getv(from_object, ['thinking_config']), to_object
|
1658
|
-
),
|
1659
|
-
)
|
1660
|
-
|
1661
|
-
if getv(from_object, ['enable_affective_dialog']) is not None:
|
1662
|
-
setv(
|
1663
|
-
parent_object,
|
1664
|
-
['setup', 'generationConfig', 'enableAffectiveDialog'],
|
1665
|
-
getv(from_object, ['enable_affective_dialog']),
|
1666
|
-
)
|
1667
|
-
|
1668
|
-
if getv(from_object, ['system_instruction']) is not None:
|
1669
|
-
setv(
|
1670
|
-
parent_object,
|
1671
|
-
['setup', 'systemInstruction'],
|
1672
|
-
_Content_to_vertex(
|
1673
|
-
t.t_content(getv(from_object, ['system_instruction'])), to_object
|
1674
|
-
),
|
1675
|
-
)
|
1676
|
-
|
1677
|
-
if getv(from_object, ['tools']) is not None:
|
1678
|
-
setv(
|
1679
|
-
parent_object,
|
1680
|
-
['setup', 'tools'],
|
1681
|
-
[
|
1682
|
-
_Tool_to_vertex(t.t_tool(api_client, item), to_object)
|
1683
|
-
for item in t.t_tools(api_client, getv(from_object, ['tools']))
|
1684
|
-
],
|
1685
|
-
)
|
1686
|
-
|
1687
|
-
if getv(from_object, ['session_resumption']) is not None:
|
1688
|
-
setv(
|
1689
|
-
parent_object,
|
1690
|
-
['setup', 'sessionResumption'],
|
1691
|
-
_SessionResumptionConfig_to_vertex(
|
1692
|
-
getv(from_object, ['session_resumption']), to_object
|
1693
|
-
),
|
1694
|
-
)
|
1695
|
-
|
1696
|
-
if getv(from_object, ['input_audio_transcription']) is not None:
|
1697
|
-
setv(
|
1698
|
-
parent_object,
|
1699
|
-
['setup', 'inputAudioTranscription'],
|
1700
|
-
_AudioTranscriptionConfig_to_vertex(
|
1701
|
-
getv(from_object, ['input_audio_transcription']), to_object
|
1702
|
-
),
|
1703
|
-
)
|
1704
|
-
|
1705
|
-
if getv(from_object, ['output_audio_transcription']) is not None:
|
1706
|
-
setv(
|
1707
|
-
parent_object,
|
1708
|
-
['setup', 'outputAudioTranscription'],
|
1709
|
-
_AudioTranscriptionConfig_to_vertex(
|
1710
|
-
getv(from_object, ['output_audio_transcription']), to_object
|
1711
|
-
),
|
1712
|
-
)
|
1713
|
-
|
1714
|
-
if getv(from_object, ['realtime_input_config']) is not None:
|
1715
|
-
setv(
|
1716
|
-
parent_object,
|
1717
|
-
['setup', 'realtimeInputConfig'],
|
1718
|
-
_RealtimeInputConfig_to_vertex(
|
1719
|
-
getv(from_object, ['realtime_input_config']), to_object
|
1720
|
-
),
|
1721
|
-
)
|
1722
|
-
|
1723
|
-
if getv(from_object, ['context_window_compression']) is not None:
|
1724
|
-
setv(
|
1725
|
-
parent_object,
|
1726
|
-
['setup', 'contextWindowCompression'],
|
1727
|
-
_ContextWindowCompressionConfig_to_vertex(
|
1728
|
-
getv(from_object, ['context_window_compression']), to_object
|
1729
|
-
),
|
1730
|
-
)
|
1731
|
-
|
1732
|
-
if getv(from_object, ['proactivity']) is not None:
|
1733
|
-
setv(
|
1734
|
-
parent_object,
|
1735
|
-
['setup', 'proactivity'],
|
1736
|
-
_ProactivityConfig_to_vertex(
|
1737
|
-
getv(from_object, ['proactivity']), to_object
|
1738
|
-
),
|
1739
|
-
)
|
1740
|
-
|
1741
|
-
return to_object
|
1742
|
-
|
1743
|
-
|
1744
|
-
def _LiveConnectParameters_to_mldev(
|
1745
|
-
api_client: BaseApiClient,
|
1746
|
-
from_object: Union[dict[str, Any], object],
|
1747
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1748
|
-
) -> dict[str, Any]:
|
1749
|
-
to_object: dict[str, Any] = {}
|
1750
|
-
if getv(from_object, ['model']) is not None:
|
1751
|
-
setv(
|
1752
|
-
to_object,
|
1753
|
-
['setup', 'model'],
|
1754
|
-
t.t_model(api_client, getv(from_object, ['model'])),
|
1755
|
-
)
|
1756
|
-
|
1757
|
-
if getv(from_object, ['config']) is not None:
|
1758
|
-
setv(
|
1759
|
-
to_object,
|
1760
|
-
['config'],
|
1761
|
-
_LiveConnectConfig_to_mldev(
|
1762
|
-
api_client, getv(from_object, ['config']), to_object
|
1763
|
-
),
|
1764
|
-
)
|
1765
|
-
|
1766
|
-
return to_object
|
1767
|
-
|
1768
|
-
|
1769
|
-
def _LiveConnectParameters_to_vertex(
|
1770
|
-
api_client: BaseApiClient,
|
1771
|
-
from_object: Union[dict[str, Any], object],
|
1772
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1773
|
-
) -> dict[str, Any]:
|
1774
|
-
to_object: dict[str, Any] = {}
|
1775
|
-
if getv(from_object, ['model']) is not None:
|
1776
|
-
setv(
|
1777
|
-
to_object,
|
1778
|
-
['setup', 'model'],
|
1779
|
-
t.t_model(api_client, getv(from_object, ['model'])),
|
1780
|
-
)
|
1781
|
-
|
1782
|
-
if getv(from_object, ['config']) is not None:
|
1783
|
-
setv(
|
1784
|
-
to_object,
|
1785
|
-
['config'],
|
1786
|
-
_LiveConnectConfig_to_vertex(
|
1787
|
-
api_client, getv(from_object, ['config']), to_object
|
1788
|
-
),
|
1789
|
-
)
|
1790
|
-
|
1791
|
-
return to_object
|
1792
|
-
|
1793
|
-
|
1794
|
-
def _LiveMusicClientContent_from_mldev(
|
1795
|
-
from_object: Union[dict[str, Any], object],
|
1796
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1797
|
-
) -> dict[str, Any]:
|
1798
|
-
to_object: dict[str, Any] = {}
|
1799
|
-
if getv(from_object, ['weightedPrompts']) is not None:
|
1800
|
-
setv(
|
1801
|
-
to_object,
|
1802
|
-
['weighted_prompts'],
|
1803
|
-
[
|
1804
|
-
_WeightedPrompt_from_mldev(item, to_object)
|
1805
|
-
for item in getv(from_object, ['weightedPrompts'])
|
1806
|
-
],
|
1807
|
-
)
|
1808
|
-
|
1809
|
-
return to_object
|
1810
|
-
|
1811
|
-
|
1812
|
-
def _LiveMusicClientContent_to_mldev(
|
1813
|
-
from_object: Union[dict[str, Any], object],
|
1814
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1815
|
-
) -> dict[str, Any]:
|
1816
|
-
to_object: dict[str, Any] = {}
|
1817
|
-
if getv(from_object, ['weighted_prompts']) is not None:
|
1818
|
-
setv(
|
1819
|
-
to_object,
|
1820
|
-
['weightedPrompts'],
|
1821
|
-
[
|
1822
|
-
_WeightedPrompt_to_mldev(item, to_object)
|
1823
|
-
for item in getv(from_object, ['weighted_prompts'])
|
1824
|
-
],
|
1825
|
-
)
|
1826
|
-
|
1827
|
-
return to_object
|
1828
|
-
|
1829
|
-
|
1830
|
-
def _LiveMusicClientMessage_to_mldev(
|
1831
|
-
from_object: Union[dict[str, Any], object],
|
1832
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1833
|
-
) -> dict[str, Any]:
|
1834
|
-
to_object: dict[str, Any] = {}
|
1835
|
-
if getv(from_object, ['setup']) is not None:
|
1836
|
-
setv(
|
1837
|
-
to_object,
|
1838
|
-
['setup'],
|
1839
|
-
_LiveMusicClientSetup_to_mldev(getv(from_object, ['setup']), to_object),
|
1840
|
-
)
|
1841
|
-
|
1842
|
-
if getv(from_object, ['client_content']) is not None:
|
1843
|
-
setv(
|
1844
|
-
to_object,
|
1845
|
-
['clientContent'],
|
1846
|
-
_LiveMusicClientContent_to_mldev(
|
1847
|
-
getv(from_object, ['client_content']), to_object
|
1848
|
-
),
|
1849
|
-
)
|
1850
|
-
|
1851
|
-
if getv(from_object, ['music_generation_config']) is not None:
|
1852
|
-
setv(
|
1853
|
-
to_object,
|
1854
|
-
['musicGenerationConfig'],
|
1855
|
-
_LiveMusicGenerationConfig_to_mldev(
|
1856
|
-
getv(from_object, ['music_generation_config']), to_object
|
1857
|
-
),
|
1858
|
-
)
|
1859
|
-
|
1860
|
-
if getv(from_object, ['playback_control']) is not None:
|
1861
|
-
setv(
|
1862
|
-
to_object, ['playbackControl'], getv(from_object, ['playback_control'])
|
1863
|
-
)
|
1864
|
-
|
1865
|
-
return to_object
|
1866
|
-
|
1867
|
-
|
1868
|
-
def _LiveMusicClientMessage_to_vertex(
|
1869
|
-
from_object: Union[dict[str, Any], object],
|
1870
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1871
|
-
) -> dict[str, Any]:
|
1872
|
-
to_object: dict[str, Any] = {}
|
1873
|
-
if getv(from_object, ['setup']) is not None:
|
1874
|
-
raise ValueError('setup parameter is not supported in Vertex AI.')
|
1875
|
-
|
1876
|
-
if getv(from_object, ['client_content']) is not None:
|
1877
|
-
raise ValueError('client_content parameter is not supported in Vertex AI.')
|
1878
|
-
|
1879
|
-
if getv(from_object, ['music_generation_config']) is not None:
|
1880
|
-
raise ValueError(
|
1881
|
-
'music_generation_config parameter is not supported in Vertex AI.'
|
1882
|
-
)
|
1883
|
-
|
1884
|
-
if getv(from_object, ['playback_control']) is not None:
|
1885
|
-
raise ValueError(
|
1886
|
-
'playback_control parameter is not supported in Vertex AI.'
|
1887
|
-
)
|
1888
|
-
|
1889
|
-
return to_object
|
1890
|
-
|
1891
|
-
|
1892
|
-
def _LiveMusicClientSetup_to_mldev(
|
1893
|
-
from_object: Union[dict[str, Any], object],
|
1894
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1895
|
-
) -> dict[str, Any]:
|
1896
|
-
to_object: dict[str, Any] = {}
|
1897
|
-
if getv(from_object, ['model']) is not None:
|
1898
|
-
setv(to_object, ['model'], getv(from_object, ['model']))
|
1899
|
-
|
1900
|
-
return to_object
|
1901
|
-
|
1902
|
-
|
1903
|
-
def _LiveMusicConnectParameters_to_mldev(
|
1904
|
-
from_object: Union[dict[str, Any], object],
|
1905
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1906
|
-
) -> dict[str, Any]:
|
1907
|
-
to_object: dict[str, Any] = {}
|
1908
|
-
if getv(from_object, ['model']) is not None:
|
1909
|
-
setv(to_object, ['setup', 'model'], getv(from_object, ['model']))
|
1910
|
-
|
1911
|
-
return to_object
|
1912
|
-
|
1913
|
-
|
1914
|
-
def _LiveMusicConnectParameters_to_vertex(
|
1915
|
-
from_object: Union[dict[str, Any], object],
|
1916
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1917
|
-
) -> dict[str, Any]:
|
1918
|
-
to_object: dict[str, Any] = {}
|
1919
|
-
if getv(from_object, ['model']) is not None:
|
1920
|
-
raise ValueError('model parameter is not supported in Vertex AI.')
|
1921
|
-
|
1922
|
-
return to_object
|
1923
|
-
|
1924
|
-
|
1925
|
-
def _LiveMusicFilteredPrompt_from_mldev(
|
1926
|
-
from_object: Union[dict[str, Any], object],
|
1927
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1928
|
-
) -> dict[str, Any]:
|
1929
|
-
to_object: dict[str, Any] = {}
|
1930
|
-
if getv(from_object, ['text']) is not None:
|
1931
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
1932
|
-
|
1933
|
-
if getv(from_object, ['filteredReason']) is not None:
|
1934
|
-
setv(to_object, ['filtered_reason'], getv(from_object, ['filteredReason']))
|
1935
|
-
|
1936
|
-
return to_object
|
1937
|
-
|
1938
|
-
|
1939
|
-
def _LiveMusicGenerationConfig_from_mldev(
|
1940
|
-
from_object: Union[dict[str, Any], object],
|
1941
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1942
|
-
) -> dict[str, Any]:
|
1943
|
-
to_object: dict[str, Any] = {}
|
1944
|
-
if getv(from_object, ['temperature']) is not None:
|
1945
|
-
setv(to_object, ['temperature'], getv(from_object, ['temperature']))
|
1946
|
-
|
1947
|
-
if getv(from_object, ['topK']) is not None:
|
1948
|
-
setv(to_object, ['top_k'], getv(from_object, ['topK']))
|
1949
|
-
|
1950
|
-
if getv(from_object, ['seed']) is not None:
|
1951
|
-
setv(to_object, ['seed'], getv(from_object, ['seed']))
|
1952
|
-
|
1953
|
-
if getv(from_object, ['guidance']) is not None:
|
1954
|
-
setv(to_object, ['guidance'], getv(from_object, ['guidance']))
|
1955
|
-
|
1956
|
-
if getv(from_object, ['bpm']) is not None:
|
1957
|
-
setv(to_object, ['bpm'], getv(from_object, ['bpm']))
|
1958
|
-
|
1959
|
-
if getv(from_object, ['density']) is not None:
|
1960
|
-
setv(to_object, ['density'], getv(from_object, ['density']))
|
1961
|
-
|
1962
|
-
if getv(from_object, ['brightness']) is not None:
|
1963
|
-
setv(to_object, ['brightness'], getv(from_object, ['brightness']))
|
1964
|
-
|
1965
|
-
if getv(from_object, ['scale']) is not None:
|
1966
|
-
setv(to_object, ['scale'], getv(from_object, ['scale']))
|
1967
|
-
|
1968
|
-
if getv(from_object, ['muteBass']) is not None:
|
1969
|
-
setv(to_object, ['mute_bass'], getv(from_object, ['muteBass']))
|
1970
|
-
|
1971
|
-
if getv(from_object, ['muteDrums']) is not None:
|
1972
|
-
setv(to_object, ['mute_drums'], getv(from_object, ['muteDrums']))
|
1973
|
-
|
1974
|
-
if getv(from_object, ['onlyBassAndDrums']) is not None:
|
1975
|
-
setv(
|
1976
|
-
to_object,
|
1977
|
-
['only_bass_and_drums'],
|
1978
|
-
getv(from_object, ['onlyBassAndDrums']),
|
1979
|
-
)
|
1980
|
-
|
1981
|
-
if getv(from_object, ['musicGenerationMode']) is not None:
|
1982
|
-
setv(
|
1983
|
-
to_object,
|
1984
|
-
['music_generation_mode'],
|
1985
|
-
getv(from_object, ['musicGenerationMode']),
|
1986
|
-
)
|
1987
|
-
|
1988
|
-
return to_object
|
1989
|
-
|
1990
|
-
|
1991
|
-
def _LiveMusicGenerationConfig_to_mldev(
|
1992
|
-
from_object: Union[dict[str, Any], object],
|
1993
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1994
|
-
) -> dict[str, Any]:
|
1995
|
-
to_object: dict[str, Any] = {}
|
1996
|
-
if getv(from_object, ['temperature']) is not None:
|
1997
|
-
setv(to_object, ['temperature'], getv(from_object, ['temperature']))
|
1998
|
-
|
1999
|
-
if getv(from_object, ['top_k']) is not None:
|
2000
|
-
setv(to_object, ['topK'], getv(from_object, ['top_k']))
|
2001
|
-
|
2002
|
-
if getv(from_object, ['seed']) is not None:
|
2003
|
-
setv(to_object, ['seed'], getv(from_object, ['seed']))
|
2004
|
-
|
2005
|
-
if getv(from_object, ['guidance']) is not None:
|
2006
|
-
setv(to_object, ['guidance'], getv(from_object, ['guidance']))
|
2007
|
-
|
2008
|
-
if getv(from_object, ['bpm']) is not None:
|
2009
|
-
setv(to_object, ['bpm'], getv(from_object, ['bpm']))
|
2010
|
-
|
2011
|
-
if getv(from_object, ['density']) is not None:
|
2012
|
-
setv(to_object, ['density'], getv(from_object, ['density']))
|
2013
|
-
|
2014
|
-
if getv(from_object, ['brightness']) is not None:
|
2015
|
-
setv(to_object, ['brightness'], getv(from_object, ['brightness']))
|
2016
|
-
|
2017
|
-
if getv(from_object, ['scale']) is not None:
|
2018
|
-
setv(to_object, ['scale'], getv(from_object, ['scale']))
|
2019
|
-
|
2020
|
-
if getv(from_object, ['mute_bass']) is not None:
|
2021
|
-
setv(to_object, ['muteBass'], getv(from_object, ['mute_bass']))
|
2022
|
-
|
2023
|
-
if getv(from_object, ['mute_drums']) is not None:
|
2024
|
-
setv(to_object, ['muteDrums'], getv(from_object, ['mute_drums']))
|
2025
|
-
|
2026
|
-
if getv(from_object, ['only_bass_and_drums']) is not None:
|
2027
|
-
setv(
|
2028
|
-
to_object,
|
2029
|
-
['onlyBassAndDrums'],
|
2030
|
-
getv(from_object, ['only_bass_and_drums']),
|
2031
|
-
)
|
2032
|
-
|
2033
|
-
if getv(from_object, ['music_generation_mode']) is not None:
|
2034
|
-
setv(
|
2035
|
-
to_object,
|
2036
|
-
['musicGenerationMode'],
|
2037
|
-
getv(from_object, ['music_generation_mode']),
|
2038
|
-
)
|
2039
|
-
|
2040
|
-
return to_object
|
2041
|
-
|
2042
|
-
|
2043
|
-
def _LiveMusicServerContent_from_mldev(
|
2044
|
-
from_object: Union[dict[str, Any], object],
|
2045
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2046
|
-
) -> dict[str, Any]:
|
2047
|
-
to_object: dict[str, Any] = {}
|
2048
|
-
if getv(from_object, ['audioChunks']) is not None:
|
2049
|
-
setv(
|
2050
|
-
to_object,
|
2051
|
-
['audio_chunks'],
|
2052
|
-
[
|
2053
|
-
_AudioChunk_from_mldev(item, to_object)
|
2054
|
-
for item in getv(from_object, ['audioChunks'])
|
2055
|
-
],
|
2056
|
-
)
|
2057
|
-
|
2058
|
-
return to_object
|
2059
|
-
|
2060
|
-
|
2061
|
-
def _LiveMusicServerMessage_from_mldev(
|
2062
|
-
from_object: Union[dict[str, Any], object],
|
2063
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2064
|
-
) -> dict[str, Any]:
|
2065
|
-
to_object: dict[str, Any] = {}
|
2066
|
-
if getv(from_object, ['setupComplete']) is not None:
|
2067
|
-
setv(
|
2068
|
-
to_object,
|
2069
|
-
['setup_complete'],
|
2070
|
-
_LiveMusicServerSetupComplete_from_mldev(
|
2071
|
-
getv(from_object, ['setupComplete']), to_object
|
2072
|
-
),
|
2073
|
-
)
|
2074
|
-
|
2075
|
-
if getv(from_object, ['serverContent']) is not None:
|
2076
|
-
setv(
|
2077
|
-
to_object,
|
2078
|
-
['server_content'],
|
2079
|
-
_LiveMusicServerContent_from_mldev(
|
2080
|
-
getv(from_object, ['serverContent']), to_object
|
2081
|
-
),
|
2082
|
-
)
|
2083
|
-
|
2084
|
-
if getv(from_object, ['filteredPrompt']) is not None:
|
2085
|
-
setv(
|
2086
|
-
to_object,
|
2087
|
-
['filtered_prompt'],
|
2088
|
-
_LiveMusicFilteredPrompt_from_mldev(
|
2089
|
-
getv(from_object, ['filteredPrompt']), to_object
|
2090
|
-
),
|
2091
|
-
)
|
2092
|
-
|
2093
|
-
return to_object
|
2094
|
-
|
2095
|
-
|
2096
|
-
def _LiveMusicServerMessage_from_vertex(
|
2097
|
-
from_object: Union[dict[str, Any], object],
|
2098
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2099
|
-
) -> dict[str, Any]:
|
2100
|
-
to_object: dict[str, Any] = {}
|
2101
|
-
|
2102
|
-
return to_object
|
2103
|
-
|
2104
|
-
|
2105
|
-
def _LiveMusicServerSetupComplete_from_mldev(
|
2106
|
-
from_object: Union[dict[str, Any], object],
|
2107
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2108
|
-
) -> dict[str, Any]:
|
2109
|
-
to_object: dict[str, Any] = {}
|
2110
|
-
|
2111
|
-
return to_object
|
2112
|
-
|
2113
|
-
|
2114
|
-
def _LiveMusicSetConfigParameters_to_mldev(
|
2115
|
-
from_object: Union[dict[str, Any], object],
|
2116
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2117
|
-
) -> dict[str, Any]:
|
2118
|
-
to_object: dict[str, Any] = {}
|
2119
|
-
if getv(from_object, ['music_generation_config']) is not None:
|
2120
|
-
setv(
|
2121
|
-
to_object,
|
2122
|
-
['musicGenerationConfig'],
|
2123
|
-
_LiveMusicGenerationConfig_to_mldev(
|
2124
|
-
getv(from_object, ['music_generation_config']), to_object
|
2125
|
-
),
|
2126
|
-
)
|
2127
|
-
|
2128
|
-
return to_object
|
2129
|
-
|
2130
|
-
|
2131
|
-
def _LiveMusicSetConfigParameters_to_vertex(
|
2132
|
-
from_object: Union[dict[str, Any], object],
|
2133
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2134
|
-
) -> dict[str, Any]:
|
2135
|
-
to_object: dict[str, Any] = {}
|
2136
|
-
if getv(from_object, ['music_generation_config']) is not None:
|
2137
|
-
raise ValueError(
|
2138
|
-
'music_generation_config parameter is not supported in Vertex AI.'
|
2139
|
-
)
|
2140
|
-
|
2141
|
-
return to_object
|
2142
|
-
|
2143
|
-
|
2144
|
-
def _LiveMusicSetWeightedPromptsParameters_to_mldev(
|
2145
|
-
from_object: Union[dict[str, Any], object],
|
2146
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2147
|
-
) -> dict[str, Any]:
|
2148
|
-
to_object: dict[str, Any] = {}
|
2149
|
-
if getv(from_object, ['weighted_prompts']) is not None:
|
2150
|
-
setv(
|
2151
|
-
to_object,
|
2152
|
-
['weightedPrompts'],
|
2153
|
-
[
|
2154
|
-
_WeightedPrompt_to_mldev(item, to_object)
|
2155
|
-
for item in getv(from_object, ['weighted_prompts'])
|
2156
|
-
],
|
2157
|
-
)
|
2158
|
-
|
2159
|
-
return to_object
|
2160
|
-
|
2161
|
-
|
2162
|
-
def _LiveMusicSetWeightedPromptsParameters_to_vertex(
|
2163
|
-
from_object: Union[dict[str, Any], object],
|
2164
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2165
|
-
) -> dict[str, Any]:
|
2166
|
-
to_object: dict[str, Any] = {}
|
2167
|
-
if getv(from_object, ['weighted_prompts']) is not None:
|
2168
|
-
raise ValueError(
|
2169
|
-
'weighted_prompts parameter is not supported in Vertex AI.'
|
2170
|
-
)
|
2171
|
-
|
2172
|
-
return to_object
|
2173
|
-
|
2174
|
-
|
2175
|
-
def _LiveMusicSourceMetadata_from_mldev(
|
2176
|
-
from_object: Union[dict[str, Any], object],
|
2177
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2178
|
-
) -> dict[str, Any]:
|
2179
|
-
to_object: dict[str, Any] = {}
|
2180
|
-
if getv(from_object, ['clientContent']) is not None:
|
2181
|
-
setv(
|
2182
|
-
to_object,
|
2183
|
-
['client_content'],
|
2184
|
-
_LiveMusicClientContent_from_mldev(
|
2185
|
-
getv(from_object, ['clientContent']), to_object
|
2186
|
-
),
|
2187
|
-
)
|
2188
|
-
|
2189
|
-
if getv(from_object, ['musicGenerationConfig']) is not None:
|
2190
|
-
setv(
|
2191
|
-
to_object,
|
2192
|
-
['music_generation_config'],
|
2193
|
-
_LiveMusicGenerationConfig_from_mldev(
|
2194
|
-
getv(from_object, ['musicGenerationConfig']), to_object
|
2195
|
-
),
|
2196
|
-
)
|
2197
|
-
|
2198
|
-
return to_object
|
2199
|
-
|
2200
|
-
|
2201
|
-
def _LiveSendRealtimeInputParameters_to_mldev(
|
2202
|
-
from_object: Union[dict[str, Any], object],
|
2203
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2204
|
-
) -> dict[str, Any]:
|
2205
|
-
to_object: dict[str, Any] = {}
|
2206
|
-
if getv(from_object, ['media']) is not None:
|
2207
|
-
setv(
|
2208
|
-
to_object,
|
2209
|
-
['mediaChunks'],
|
2210
|
-
[item for item in t.t_blobs(getv(from_object, ['media']))],
|
2211
|
-
)
|
2212
|
-
|
2213
|
-
if getv(from_object, ['audio']) is not None:
|
2214
|
-
setv(to_object, ['audio'], t.t_audio_blob(getv(from_object, ['audio'])))
|
2215
|
-
|
2216
|
-
if getv(from_object, ['audio_stream_end']) is not None:
|
2217
|
-
setv(to_object, ['audioStreamEnd'], getv(from_object, ['audio_stream_end']))
|
2218
|
-
|
2219
|
-
if getv(from_object, ['video']) is not None:
|
2220
|
-
setv(to_object, ['video'], t.t_image_blob(getv(from_object, ['video'])))
|
2221
|
-
|
2222
|
-
if getv(from_object, ['text']) is not None:
|
2223
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
2224
|
-
|
2225
|
-
if getv(from_object, ['activity_start']) is not None:
|
2226
|
-
setv(
|
2227
|
-
to_object,
|
2228
|
-
['activityStart'],
|
2229
|
-
_ActivityStart_to_mldev(
|
2230
|
-
getv(from_object, ['activity_start']), to_object
|
2231
|
-
),
|
2232
|
-
)
|
2233
|
-
|
2234
|
-
if getv(from_object, ['activity_end']) is not None:
|
2235
|
-
setv(
|
2236
|
-
to_object,
|
2237
|
-
['activityEnd'],
|
2238
|
-
_ActivityEnd_to_mldev(getv(from_object, ['activity_end']), to_object),
|
2239
|
-
)
|
2240
|
-
|
2241
|
-
return to_object
|
2242
|
-
|
2243
|
-
|
2244
|
-
def _LiveSendRealtimeInputParameters_to_vertex(
|
2245
|
-
from_object: Union[dict[str, Any], object],
|
2246
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2247
|
-
) -> dict[str, Any]:
|
2248
|
-
to_object: dict[str, Any] = {}
|
2249
|
-
if getv(from_object, ['media']) is not None:
|
2250
|
-
setv(
|
2251
|
-
to_object,
|
2252
|
-
['mediaChunks'],
|
2253
|
-
[item for item in t.t_blobs(getv(from_object, ['media']))],
|
2254
|
-
)
|
2255
|
-
|
2256
|
-
if getv(from_object, ['audio']) is not None:
|
2257
|
-
setv(to_object, ['audio'], t.t_audio_blob(getv(from_object, ['audio'])))
|
2258
|
-
|
2259
|
-
if getv(from_object, ['audio_stream_end']) is not None:
|
2260
|
-
setv(to_object, ['audioStreamEnd'], getv(from_object, ['audio_stream_end']))
|
2261
|
-
|
2262
|
-
if getv(from_object, ['video']) is not None:
|
2263
|
-
setv(to_object, ['video'], t.t_image_blob(getv(from_object, ['video'])))
|
2264
|
-
|
2265
|
-
if getv(from_object, ['text']) is not None:
|
2266
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
2267
|
-
|
2268
|
-
if getv(from_object, ['activity_start']) is not None:
|
2269
|
-
setv(
|
2270
|
-
to_object,
|
2271
|
-
['activityStart'],
|
2272
|
-
_ActivityStart_to_vertex(
|
2273
|
-
getv(from_object, ['activity_start']), to_object
|
2274
|
-
),
|
2275
|
-
)
|
2276
|
-
|
2277
|
-
if getv(from_object, ['activity_end']) is not None:
|
2278
|
-
setv(
|
2279
|
-
to_object,
|
2280
|
-
['activityEnd'],
|
2281
|
-
_ActivityEnd_to_vertex(getv(from_object, ['activity_end']), to_object),
|
2282
|
-
)
|
2283
|
-
|
2284
|
-
return to_object
|
2285
|
-
|
2286
|
-
|
2287
|
-
def _LiveServerContent_from_mldev(
|
2288
|
-
from_object: Union[dict[str, Any], object],
|
2289
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2290
|
-
) -> dict[str, Any]:
|
2291
|
-
to_object: dict[str, Any] = {}
|
2292
|
-
if getv(from_object, ['modelTurn']) is not None:
|
2293
|
-
setv(
|
2294
|
-
to_object,
|
2295
|
-
['model_turn'],
|
2296
|
-
_Content_from_mldev(getv(from_object, ['modelTurn']), to_object),
|
2297
|
-
)
|
2298
|
-
|
2299
|
-
if getv(from_object, ['turnComplete']) is not None:
|
2300
|
-
setv(to_object, ['turn_complete'], getv(from_object, ['turnComplete']))
|
2301
|
-
|
2302
|
-
if getv(from_object, ['interrupted']) is not None:
|
2303
|
-
setv(to_object, ['interrupted'], getv(from_object, ['interrupted']))
|
2304
|
-
|
2305
|
-
if getv(from_object, ['groundingMetadata']) is not None:
|
2306
|
-
setv(
|
2307
|
-
to_object,
|
2308
|
-
['grounding_metadata'],
|
2309
|
-
getv(from_object, ['groundingMetadata']),
|
2310
|
-
)
|
2311
|
-
|
2312
|
-
if getv(from_object, ['generationComplete']) is not None:
|
2313
|
-
setv(
|
2314
|
-
to_object,
|
2315
|
-
['generation_complete'],
|
2316
|
-
getv(from_object, ['generationComplete']),
|
2317
|
-
)
|
2318
|
-
|
2319
|
-
if getv(from_object, ['inputTranscription']) is not None:
|
2320
|
-
setv(
|
2321
|
-
to_object,
|
2322
|
-
['input_transcription'],
|
2323
|
-
_Transcription_from_mldev(
|
2324
|
-
getv(from_object, ['inputTranscription']), to_object
|
2325
|
-
),
|
2326
|
-
)
|
2327
|
-
|
2328
|
-
if getv(from_object, ['outputTranscription']) is not None:
|
2329
|
-
setv(
|
2330
|
-
to_object,
|
2331
|
-
['output_transcription'],
|
2332
|
-
_Transcription_from_mldev(
|
2333
|
-
getv(from_object, ['outputTranscription']), to_object
|
2334
|
-
),
|
2335
|
-
)
|
2336
|
-
|
2337
|
-
if getv(from_object, ['urlContextMetadata']) is not None:
|
2338
|
-
setv(
|
2339
|
-
to_object,
|
2340
|
-
['url_context_metadata'],
|
2341
|
-
_UrlContextMetadata_from_mldev(
|
2342
|
-
getv(from_object, ['urlContextMetadata']), to_object
|
2343
|
-
),
|
2344
|
-
)
|
2345
|
-
|
2346
|
-
if getv(from_object, ['turnCompleteReason']) is not None:
|
2347
|
-
setv(
|
2348
|
-
to_object,
|
2349
|
-
['turn_complete_reason'],
|
2350
|
-
getv(from_object, ['turnCompleteReason']),
|
2351
|
-
)
|
2352
|
-
|
2353
|
-
if getv(from_object, ['waitingForInput']) is not None:
|
2354
|
-
setv(
|
2355
|
-
to_object, ['waiting_for_input'], getv(from_object, ['waitingForInput'])
|
2356
|
-
)
|
2357
|
-
|
2358
|
-
return to_object
|
2359
|
-
|
2360
|
-
|
2361
|
-
def _LiveServerContent_from_vertex(
|
2362
|
-
from_object: Union[dict[str, Any], object],
|
2363
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2364
|
-
) -> dict[str, Any]:
|
2365
|
-
to_object: dict[str, Any] = {}
|
2366
|
-
if getv(from_object, ['modelTurn']) is not None:
|
2367
|
-
setv(
|
2368
|
-
to_object,
|
2369
|
-
['model_turn'],
|
2370
|
-
_Content_from_vertex(getv(from_object, ['modelTurn']), to_object),
|
2371
|
-
)
|
2372
|
-
|
2373
|
-
if getv(from_object, ['turnComplete']) is not None:
|
2374
|
-
setv(to_object, ['turn_complete'], getv(from_object, ['turnComplete']))
|
2375
|
-
|
2376
|
-
if getv(from_object, ['interrupted']) is not None:
|
2377
|
-
setv(to_object, ['interrupted'], getv(from_object, ['interrupted']))
|
2378
|
-
|
2379
|
-
if getv(from_object, ['groundingMetadata']) is not None:
|
2380
|
-
setv(
|
2381
|
-
to_object,
|
2382
|
-
['grounding_metadata'],
|
2383
|
-
getv(from_object, ['groundingMetadata']),
|
2384
|
-
)
|
2385
|
-
|
2386
|
-
if getv(from_object, ['generationComplete']) is not None:
|
2387
|
-
setv(
|
2388
|
-
to_object,
|
2389
|
-
['generation_complete'],
|
2390
|
-
getv(from_object, ['generationComplete']),
|
2391
|
-
)
|
2392
|
-
|
2393
|
-
if getv(from_object, ['inputTranscription']) is not None:
|
2394
|
-
setv(
|
2395
|
-
to_object,
|
2396
|
-
['input_transcription'],
|
2397
|
-
_Transcription_from_vertex(
|
2398
|
-
getv(from_object, ['inputTranscription']), to_object
|
2399
|
-
),
|
409
|
+
['mediaChunks'],
|
410
|
+
[item for item in getv(from_object, ['media_chunks'])],
|
2400
411
|
)
|
2401
412
|
|
2402
|
-
if getv(from_object, ['
|
2403
|
-
setv(
|
2404
|
-
to_object,
|
2405
|
-
['output_transcription'],
|
2406
|
-
_Transcription_from_vertex(
|
2407
|
-
getv(from_object, ['outputTranscription']), to_object
|
2408
|
-
),
|
2409
|
-
)
|
413
|
+
if getv(from_object, ['audio']) is not None:
|
414
|
+
setv(to_object, ['audio'], getv(from_object, ['audio']))
|
2410
415
|
|
2411
|
-
if getv(from_object, ['
|
2412
|
-
|
2413
|
-
|
2414
|
-
['turn_complete_reason'],
|
2415
|
-
getv(from_object, ['turnCompleteReason']),
|
416
|
+
if getv(from_object, ['audio_stream_end']) is not None:
|
417
|
+
raise ValueError(
|
418
|
+
'audio_stream_end parameter is not supported in Vertex AI.'
|
2416
419
|
)
|
2417
420
|
|
2418
|
-
if getv(from_object, ['
|
2419
|
-
setv(
|
2420
|
-
to_object, ['waiting_for_input'], getv(from_object, ['waitingForInput'])
|
2421
|
-
)
|
421
|
+
if getv(from_object, ['video']) is not None:
|
422
|
+
setv(to_object, ['video'], getv(from_object, ['video']))
|
2422
423
|
|
2423
|
-
|
424
|
+
if getv(from_object, ['text']) is not None:
|
425
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
2424
426
|
|
427
|
+
if getv(from_object, ['activity_start']) is not None:
|
428
|
+
setv(to_object, ['activityStart'], getv(from_object, ['activity_start']))
|
2425
429
|
|
2426
|
-
|
2427
|
-
|
2428
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2429
|
-
) -> dict[str, Any]:
|
2430
|
-
to_object: dict[str, Any] = {}
|
2431
|
-
if getv(from_object, ['timeLeft']) is not None:
|
2432
|
-
setv(to_object, ['time_left'], getv(from_object, ['timeLeft']))
|
430
|
+
if getv(from_object, ['activity_end']) is not None:
|
431
|
+
setv(to_object, ['activityEnd'], getv(from_object, ['activity_end']))
|
2433
432
|
|
2434
433
|
return to_object
|
2435
434
|
|
2436
435
|
|
2437
|
-
def
|
436
|
+
def _LiveClientSetup_to_mldev(
|
437
|
+
api_client: BaseApiClient,
|
2438
438
|
from_object: Union[dict[str, Any], object],
|
2439
439
|
parent_object: Optional[dict[str, Any]] = None,
|
2440
440
|
) -> dict[str, Any]:
|
2441
441
|
to_object: dict[str, Any] = {}
|
2442
|
-
if getv(from_object, ['
|
2443
|
-
setv(to_object, ['
|
2444
|
-
|
2445
|
-
return to_object
|
2446
|
-
|
442
|
+
if getv(from_object, ['model']) is not None:
|
443
|
+
setv(to_object, ['model'], getv(from_object, ['model']))
|
2447
444
|
|
2448
|
-
|
2449
|
-
from_object: Union[dict[str, Any], object],
|
2450
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2451
|
-
) -> dict[str, Any]:
|
2452
|
-
to_object: dict[str, Any] = {}
|
2453
|
-
if getv(from_object, ['setupComplete']) is not None:
|
445
|
+
if getv(from_object, ['generation_config']) is not None:
|
2454
446
|
setv(
|
2455
447
|
to_object,
|
2456
|
-
['
|
2457
|
-
|
2458
|
-
getv(from_object, ['setupComplete']), to_object
|
2459
|
-
),
|
448
|
+
['generationConfig'],
|
449
|
+
getv(from_object, ['generation_config']),
|
2460
450
|
)
|
2461
451
|
|
2462
|
-
if getv(from_object, ['
|
452
|
+
if getv(from_object, ['system_instruction']) is not None:
|
2463
453
|
setv(
|
2464
454
|
to_object,
|
2465
|
-
['
|
2466
|
-
|
2467
|
-
getv(from_object, ['
|
455
|
+
['systemInstruction'],
|
456
|
+
_Content_to_mldev(
|
457
|
+
t.t_content(getv(from_object, ['system_instruction'])), to_object
|
2468
458
|
),
|
2469
459
|
)
|
2470
460
|
|
2471
|
-
if getv(from_object, ['
|
461
|
+
if getv(from_object, ['tools']) is not None:
|
2472
462
|
setv(
|
2473
463
|
to_object,
|
2474
|
-
['
|
2475
|
-
|
2476
|
-
|
2477
|
-
|
464
|
+
['tools'],
|
465
|
+
[
|
466
|
+
_Tool_to_mldev(t.t_tool(api_client, item), to_object)
|
467
|
+
for item in t.t_tools(api_client, getv(from_object, ['tools']))
|
468
|
+
],
|
2478
469
|
)
|
2479
470
|
|
2480
|
-
if getv(from_object, ['
|
471
|
+
if getv(from_object, ['session_resumption']) is not None:
|
2481
472
|
setv(
|
2482
473
|
to_object,
|
2483
|
-
['
|
2484
|
-
|
2485
|
-
getv(from_object, ['
|
474
|
+
['sessionResumption'],
|
475
|
+
_SessionResumptionConfig_to_mldev(
|
476
|
+
getv(from_object, ['session_resumption']), to_object
|
2486
477
|
),
|
2487
478
|
)
|
2488
479
|
|
2489
|
-
if getv(from_object, ['
|
480
|
+
if getv(from_object, ['context_window_compression']) is not None:
|
2490
481
|
setv(
|
2491
482
|
to_object,
|
2492
|
-
['
|
2493
|
-
|
2494
|
-
getv(from_object, ['usageMetadata']), to_object
|
2495
|
-
),
|
483
|
+
['contextWindowCompression'],
|
484
|
+
getv(from_object, ['context_window_compression']),
|
2496
485
|
)
|
2497
486
|
|
2498
|
-
if getv(from_object, ['
|
487
|
+
if getv(from_object, ['input_audio_transcription']) is not None:
|
2499
488
|
setv(
|
2500
489
|
to_object,
|
2501
|
-
['
|
2502
|
-
|
490
|
+
['inputAudioTranscription'],
|
491
|
+
getv(from_object, ['input_audio_transcription']),
|
2503
492
|
)
|
2504
493
|
|
2505
|
-
if getv(from_object, ['
|
494
|
+
if getv(from_object, ['output_audio_transcription']) is not None:
|
2506
495
|
setv(
|
2507
496
|
to_object,
|
2508
|
-
['
|
2509
|
-
|
2510
|
-
getv(from_object, ['sessionResumptionUpdate']), to_object
|
2511
|
-
),
|
497
|
+
['outputAudioTranscription'],
|
498
|
+
getv(from_object, ['output_audio_transcription']),
|
2512
499
|
)
|
2513
500
|
|
501
|
+
if getv(from_object, ['proactivity']) is not None:
|
502
|
+
setv(to_object, ['proactivity'], getv(from_object, ['proactivity']))
|
503
|
+
|
2514
504
|
return to_object
|
2515
505
|
|
2516
506
|
|
2517
|
-
def
|
507
|
+
def _LiveClientSetup_to_vertex(
|
508
|
+
api_client: BaseApiClient,
|
2518
509
|
from_object: Union[dict[str, Any], object],
|
2519
510
|
parent_object: Optional[dict[str, Any]] = None,
|
2520
511
|
) -> dict[str, Any]:
|
2521
512
|
to_object: dict[str, Any] = {}
|
2522
|
-
if getv(from_object, ['
|
2523
|
-
setv(
|
2524
|
-
to_object,
|
2525
|
-
['setup_complete'],
|
2526
|
-
_LiveServerSetupComplete_from_vertex(
|
2527
|
-
getv(from_object, ['setupComplete']), to_object
|
2528
|
-
),
|
2529
|
-
)
|
2530
|
-
|
2531
|
-
if getv(from_object, ['serverContent']) is not None:
|
2532
|
-
setv(
|
2533
|
-
to_object,
|
2534
|
-
['server_content'],
|
2535
|
-
_LiveServerContent_from_vertex(
|
2536
|
-
getv(from_object, ['serverContent']), to_object
|
2537
|
-
),
|
2538
|
-
)
|
2539
|
-
|
2540
|
-
if getv(from_object, ['toolCall']) is not None:
|
2541
|
-
setv(
|
2542
|
-
to_object,
|
2543
|
-
['tool_call'],
|
2544
|
-
_LiveServerToolCall_from_vertex(
|
2545
|
-
getv(from_object, ['toolCall']), to_object
|
2546
|
-
),
|
2547
|
-
)
|
2548
|
-
|
2549
|
-
if getv(from_object, ['toolCallCancellation']) is not None:
|
2550
|
-
setv(
|
2551
|
-
to_object,
|
2552
|
-
['tool_call_cancellation'],
|
2553
|
-
_LiveServerToolCallCancellation_from_vertex(
|
2554
|
-
getv(from_object, ['toolCallCancellation']), to_object
|
2555
|
-
),
|
2556
|
-
)
|
513
|
+
if getv(from_object, ['model']) is not None:
|
514
|
+
setv(to_object, ['model'], getv(from_object, ['model']))
|
2557
515
|
|
2558
|
-
if getv(from_object, ['
|
516
|
+
if getv(from_object, ['generation_config']) is not None:
|
2559
517
|
setv(
|
2560
518
|
to_object,
|
2561
|
-
['
|
2562
|
-
|
2563
|
-
getv(from_object, ['
|
519
|
+
['generationConfig'],
|
520
|
+
_GenerationConfig_to_vertex(
|
521
|
+
getv(from_object, ['generation_config']), to_object
|
2564
522
|
),
|
2565
523
|
)
|
2566
524
|
|
2567
|
-
if getv(from_object, ['
|
525
|
+
if getv(from_object, ['system_instruction']) is not None:
|
2568
526
|
setv(
|
2569
527
|
to_object,
|
2570
|
-
['
|
2571
|
-
|
528
|
+
['systemInstruction'],
|
529
|
+
t.t_content(getv(from_object, ['system_instruction'])),
|
2572
530
|
)
|
2573
531
|
|
2574
|
-
if getv(from_object, ['
|
532
|
+
if getv(from_object, ['tools']) is not None:
|
2575
533
|
setv(
|
2576
534
|
to_object,
|
2577
|
-
['
|
2578
|
-
|
2579
|
-
|
2580
|
-
|
535
|
+
['tools'],
|
536
|
+
[
|
537
|
+
_Tool_to_vertex(t.t_tool(api_client, item), to_object)
|
538
|
+
for item in t.t_tools(api_client, getv(from_object, ['tools']))
|
539
|
+
],
|
2581
540
|
)
|
2582
541
|
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2586
|
-
def _LiveServerSessionResumptionUpdate_from_mldev(
|
2587
|
-
from_object: Union[dict[str, Any], object],
|
2588
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2589
|
-
) -> dict[str, Any]:
|
2590
|
-
to_object: dict[str, Any] = {}
|
2591
|
-
if getv(from_object, ['newHandle']) is not None:
|
2592
|
-
setv(to_object, ['new_handle'], getv(from_object, ['newHandle']))
|
2593
|
-
|
2594
|
-
if getv(from_object, ['resumable']) is not None:
|
2595
|
-
setv(to_object, ['resumable'], getv(from_object, ['resumable']))
|
2596
|
-
|
2597
|
-
if getv(from_object, ['lastConsumedClientMessageIndex']) is not None:
|
542
|
+
if getv(from_object, ['session_resumption']) is not None:
|
2598
543
|
setv(
|
2599
544
|
to_object,
|
2600
|
-
['
|
2601
|
-
getv(from_object, ['
|
545
|
+
['sessionResumption'],
|
546
|
+
getv(from_object, ['session_resumption']),
|
2602
547
|
)
|
2603
548
|
|
2604
|
-
|
2605
|
-
|
2606
|
-
|
2607
|
-
def _LiveServerSessionResumptionUpdate_from_vertex(
|
2608
|
-
from_object: Union[dict[str, Any], object],
|
2609
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2610
|
-
) -> dict[str, Any]:
|
2611
|
-
to_object: dict[str, Any] = {}
|
2612
|
-
if getv(from_object, ['newHandle']) is not None:
|
2613
|
-
setv(to_object, ['new_handle'], getv(from_object, ['newHandle']))
|
2614
|
-
|
2615
|
-
if getv(from_object, ['resumable']) is not None:
|
2616
|
-
setv(to_object, ['resumable'], getv(from_object, ['resumable']))
|
2617
|
-
|
2618
|
-
if getv(from_object, ['lastConsumedClientMessageIndex']) is not None:
|
549
|
+
if getv(from_object, ['context_window_compression']) is not None:
|
2619
550
|
setv(
|
2620
551
|
to_object,
|
2621
|
-
['
|
2622
|
-
getv(from_object, ['
|
552
|
+
['contextWindowCompression'],
|
553
|
+
getv(from_object, ['context_window_compression']),
|
2623
554
|
)
|
2624
555
|
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2628
|
-
def _LiveServerSetupComplete_from_mldev(
|
2629
|
-
from_object: Union[dict[str, Any], object],
|
2630
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2631
|
-
) -> dict[str, Any]:
|
2632
|
-
to_object: dict[str, Any] = {}
|
2633
|
-
|
2634
|
-
return to_object
|
2635
|
-
|
2636
|
-
|
2637
|
-
def _LiveServerSetupComplete_from_vertex(
|
2638
|
-
from_object: Union[dict[str, Any], object],
|
2639
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2640
|
-
) -> dict[str, Any]:
|
2641
|
-
to_object: dict[str, Any] = {}
|
2642
|
-
if getv(from_object, ['sessionId']) is not None:
|
2643
|
-
setv(to_object, ['session_id'], getv(from_object, ['sessionId']))
|
2644
|
-
|
2645
|
-
return to_object
|
2646
|
-
|
2647
|
-
|
2648
|
-
def _LiveServerToolCallCancellation_from_mldev(
|
2649
|
-
from_object: Union[dict[str, Any], object],
|
2650
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2651
|
-
) -> dict[str, Any]:
|
2652
|
-
to_object: dict[str, Any] = {}
|
2653
|
-
if getv(from_object, ['ids']) is not None:
|
2654
|
-
setv(to_object, ['ids'], getv(from_object, ['ids']))
|
2655
|
-
|
2656
|
-
return to_object
|
2657
|
-
|
2658
|
-
|
2659
|
-
def _LiveServerToolCallCancellation_from_vertex(
|
2660
|
-
from_object: Union[dict[str, Any], object],
|
2661
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2662
|
-
) -> dict[str, Any]:
|
2663
|
-
to_object: dict[str, Any] = {}
|
2664
|
-
if getv(from_object, ['ids']) is not None:
|
2665
|
-
setv(to_object, ['ids'], getv(from_object, ['ids']))
|
2666
|
-
|
2667
|
-
return to_object
|
2668
|
-
|
2669
|
-
|
2670
|
-
def _LiveServerToolCall_from_mldev(
|
2671
|
-
from_object: Union[dict[str, Any], object],
|
2672
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2673
|
-
) -> dict[str, Any]:
|
2674
|
-
to_object: dict[str, Any] = {}
|
2675
|
-
if getv(from_object, ['functionCalls']) is not None:
|
556
|
+
if getv(from_object, ['input_audio_transcription']) is not None:
|
2676
557
|
setv(
|
2677
558
|
to_object,
|
2678
|
-
['
|
2679
|
-
[
|
2680
|
-
_FunctionCall_from_mldev(item, to_object)
|
2681
|
-
for item in getv(from_object, ['functionCalls'])
|
2682
|
-
],
|
559
|
+
['inputAudioTranscription'],
|
560
|
+
getv(from_object, ['input_audio_transcription']),
|
2683
561
|
)
|
2684
562
|
|
2685
|
-
|
2686
|
-
|
2687
|
-
|
2688
|
-
def _LiveServerToolCall_from_vertex(
|
2689
|
-
from_object: Union[dict[str, Any], object],
|
2690
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2691
|
-
) -> dict[str, Any]:
|
2692
|
-
to_object: dict[str, Any] = {}
|
2693
|
-
if getv(from_object, ['functionCalls']) is not None:
|
563
|
+
if getv(from_object, ['output_audio_transcription']) is not None:
|
2694
564
|
setv(
|
2695
565
|
to_object,
|
2696
|
-
['
|
2697
|
-
[
|
2698
|
-
_FunctionCall_from_vertex(item, to_object)
|
2699
|
-
for item in getv(from_object, ['functionCalls'])
|
2700
|
-
],
|
566
|
+
['outputAudioTranscription'],
|
567
|
+
getv(from_object, ['output_audio_transcription']),
|
2701
568
|
)
|
2702
569
|
|
2703
|
-
|
2704
|
-
|
2705
|
-
|
2706
|
-
def _ModalityTokenCount_from_mldev(
|
2707
|
-
from_object: Union[dict[str, Any], object],
|
2708
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2709
|
-
) -> dict[str, Any]:
|
2710
|
-
to_object: dict[str, Any] = {}
|
2711
|
-
if getv(from_object, ['modality']) is not None:
|
2712
|
-
setv(to_object, ['modality'], getv(from_object, ['modality']))
|
2713
|
-
|
2714
|
-
if getv(from_object, ['tokenCount']) is not None:
|
2715
|
-
setv(to_object, ['token_count'], getv(from_object, ['tokenCount']))
|
570
|
+
if getv(from_object, ['proactivity']) is not None:
|
571
|
+
setv(to_object, ['proactivity'], getv(from_object, ['proactivity']))
|
2716
572
|
|
2717
573
|
return to_object
|
2718
574
|
|
2719
575
|
|
2720
|
-
def
|
576
|
+
def _LiveConnectConfig_to_mldev(
|
577
|
+
api_client: BaseApiClient,
|
2721
578
|
from_object: Union[dict[str, Any], object],
|
2722
579
|
parent_object: Optional[dict[str, Any]] = None,
|
2723
580
|
) -> dict[str, Any]:
|
2724
581
|
to_object: dict[str, Any] = {}
|
2725
|
-
if getv(from_object, ['modality']) is not None:
|
2726
|
-
setv(to_object, ['modality'], getv(from_object, ['modality']))
|
2727
|
-
|
2728
|
-
if getv(from_object, ['tokenCount']) is not None:
|
2729
|
-
setv(to_object, ['token_count'], getv(from_object, ['tokenCount']))
|
2730
|
-
|
2731
|
-
return to_object
|
2732
582
|
|
2733
|
-
|
2734
|
-
def _MultiSpeakerVoiceConfig_to_mldev(
|
2735
|
-
from_object: Union[dict[str, Any], object],
|
2736
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2737
|
-
) -> dict[str, Any]:
|
2738
|
-
to_object: dict[str, Any] = {}
|
2739
|
-
if getv(from_object, ['speaker_voice_configs']) is not None:
|
583
|
+
if getv(from_object, ['generation_config']) is not None:
|
2740
584
|
setv(
|
2741
|
-
|
2742
|
-
['
|
2743
|
-
[
|
2744
|
-
_SpeakerVoiceConfig_to_mldev(item, to_object)
|
2745
|
-
for item in getv(from_object, ['speaker_voice_configs'])
|
2746
|
-
],
|
585
|
+
parent_object,
|
586
|
+
['setup', 'generationConfig'],
|
587
|
+
getv(from_object, ['generation_config']),
|
2747
588
|
)
|
2748
589
|
|
2749
|
-
|
2750
|
-
|
2751
|
-
|
2752
|
-
def _Part_from_mldev(
|
2753
|
-
from_object: Union[dict[str, Any], object],
|
2754
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2755
|
-
) -> dict[str, Any]:
|
2756
|
-
to_object: dict[str, Any] = {}
|
2757
|
-
if getv(from_object, ['videoMetadata']) is not None:
|
590
|
+
if getv(from_object, ['response_modalities']) is not None:
|
2758
591
|
setv(
|
2759
|
-
|
2760
|
-
['
|
2761
|
-
|
2762
|
-
getv(from_object, ['videoMetadata']), to_object
|
2763
|
-
),
|
592
|
+
parent_object,
|
593
|
+
['setup', 'generationConfig', 'responseModalities'],
|
594
|
+
getv(from_object, ['response_modalities']),
|
2764
595
|
)
|
2765
596
|
|
2766
|
-
if getv(from_object, ['
|
2767
|
-
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
2768
|
-
|
2769
|
-
if getv(from_object, ['inlineData']) is not None:
|
597
|
+
if getv(from_object, ['temperature']) is not None:
|
2770
598
|
setv(
|
2771
|
-
|
2772
|
-
['
|
2773
|
-
|
599
|
+
parent_object,
|
600
|
+
['setup', 'generationConfig', 'temperature'],
|
601
|
+
getv(from_object, ['temperature']),
|
2774
602
|
)
|
2775
603
|
|
2776
|
-
if getv(from_object, ['
|
604
|
+
if getv(from_object, ['top_p']) is not None:
|
2777
605
|
setv(
|
2778
|
-
|
2779
|
-
['
|
2780
|
-
|
606
|
+
parent_object,
|
607
|
+
['setup', 'generationConfig', 'topP'],
|
608
|
+
getv(from_object, ['top_p']),
|
2781
609
|
)
|
2782
610
|
|
2783
|
-
if getv(from_object, ['
|
611
|
+
if getv(from_object, ['top_k']) is not None:
|
2784
612
|
setv(
|
2785
|
-
|
2786
|
-
['
|
2787
|
-
getv(from_object, ['
|
613
|
+
parent_object,
|
614
|
+
['setup', 'generationConfig', 'topK'],
|
615
|
+
getv(from_object, ['top_k']),
|
2788
616
|
)
|
2789
617
|
|
2790
|
-
if getv(from_object, ['
|
618
|
+
if getv(from_object, ['max_output_tokens']) is not None:
|
2791
619
|
setv(
|
2792
|
-
|
2793
|
-
['
|
2794
|
-
|
2795
|
-
getv(from_object, ['functionCall']), to_object
|
2796
|
-
),
|
620
|
+
parent_object,
|
621
|
+
['setup', 'generationConfig', 'maxOutputTokens'],
|
622
|
+
getv(from_object, ['max_output_tokens']),
|
2797
623
|
)
|
2798
624
|
|
2799
|
-
if getv(from_object, ['
|
625
|
+
if getv(from_object, ['media_resolution']) is not None:
|
2800
626
|
setv(
|
2801
|
-
|
2802
|
-
['
|
2803
|
-
getv(from_object, ['
|
627
|
+
parent_object,
|
628
|
+
['setup', 'generationConfig', 'mediaResolution'],
|
629
|
+
getv(from_object, ['media_resolution']),
|
2804
630
|
)
|
2805
631
|
|
2806
|
-
if getv(from_object, ['
|
2807
|
-
setv(to_object, ['executable_code'], getv(from_object, ['executableCode']))
|
2808
|
-
|
2809
|
-
if getv(from_object, ['functionResponse']) is not None:
|
632
|
+
if getv(from_object, ['seed']) is not None:
|
2810
633
|
setv(
|
2811
|
-
|
2812
|
-
['
|
2813
|
-
getv(from_object, ['
|
634
|
+
parent_object,
|
635
|
+
['setup', 'generationConfig', 'seed'],
|
636
|
+
getv(from_object, ['seed']),
|
2814
637
|
)
|
2815
638
|
|
2816
|
-
if getv(from_object, ['
|
2817
|
-
setv(
|
639
|
+
if getv(from_object, ['speech_config']) is not None:
|
640
|
+
setv(
|
641
|
+
parent_object,
|
642
|
+
['setup', 'generationConfig', 'speechConfig'],
|
643
|
+
t.t_live_speech_config(getv(from_object, ['speech_config'])),
|
644
|
+
)
|
2818
645
|
|
2819
|
-
|
646
|
+
if getv(from_object, ['thinking_config']) is not None:
|
647
|
+
setv(
|
648
|
+
parent_object,
|
649
|
+
['setup', 'generationConfig', 'thinkingConfig'],
|
650
|
+
getv(from_object, ['thinking_config']),
|
651
|
+
)
|
2820
652
|
|
653
|
+
if getv(from_object, ['enable_affective_dialog']) is not None:
|
654
|
+
setv(
|
655
|
+
parent_object,
|
656
|
+
['setup', 'generationConfig', 'enableAffectiveDialog'],
|
657
|
+
getv(from_object, ['enable_affective_dialog']),
|
658
|
+
)
|
2821
659
|
|
2822
|
-
|
2823
|
-
from_object: Union[dict[str, Any], object],
|
2824
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2825
|
-
) -> dict[str, Any]:
|
2826
|
-
to_object: dict[str, Any] = {}
|
2827
|
-
if getv(from_object, ['videoMetadata']) is not None:
|
660
|
+
if getv(from_object, ['system_instruction']) is not None:
|
2828
661
|
setv(
|
2829
|
-
|
2830
|
-
['
|
2831
|
-
|
2832
|
-
getv(from_object, ['
|
662
|
+
parent_object,
|
663
|
+
['setup', 'systemInstruction'],
|
664
|
+
_Content_to_mldev(
|
665
|
+
t.t_content(getv(from_object, ['system_instruction'])), to_object
|
2833
666
|
),
|
2834
667
|
)
|
2835
668
|
|
2836
|
-
if getv(from_object, ['
|
2837
|
-
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
2838
|
-
|
2839
|
-
if getv(from_object, ['inlineData']) is not None:
|
669
|
+
if getv(from_object, ['tools']) is not None:
|
2840
670
|
setv(
|
2841
|
-
|
2842
|
-
['
|
2843
|
-
|
671
|
+
parent_object,
|
672
|
+
['setup', 'tools'],
|
673
|
+
[
|
674
|
+
_Tool_to_mldev(t.t_tool(api_client, item), to_object)
|
675
|
+
for item in t.t_tools(api_client, getv(from_object, ['tools']))
|
676
|
+
],
|
2844
677
|
)
|
2845
678
|
|
2846
|
-
if getv(from_object, ['
|
679
|
+
if getv(from_object, ['session_resumption']) is not None:
|
2847
680
|
setv(
|
2848
|
-
|
2849
|
-
['
|
2850
|
-
|
681
|
+
parent_object,
|
682
|
+
['setup', 'sessionResumption'],
|
683
|
+
_SessionResumptionConfig_to_mldev(
|
684
|
+
getv(from_object, ['session_resumption']), to_object
|
685
|
+
),
|
2851
686
|
)
|
2852
687
|
|
2853
|
-
if getv(from_object, ['
|
688
|
+
if getv(from_object, ['input_audio_transcription']) is not None:
|
2854
689
|
setv(
|
2855
|
-
|
2856
|
-
['
|
2857
|
-
getv(from_object, ['
|
690
|
+
parent_object,
|
691
|
+
['setup', 'inputAudioTranscription'],
|
692
|
+
getv(from_object, ['input_audio_transcription']),
|
2858
693
|
)
|
2859
694
|
|
2860
|
-
if getv(from_object, ['
|
695
|
+
if getv(from_object, ['output_audio_transcription']) is not None:
|
2861
696
|
setv(
|
2862
|
-
|
2863
|
-
['
|
2864
|
-
|
2865
|
-
getv(from_object, ['functionCall']), to_object
|
2866
|
-
),
|
697
|
+
parent_object,
|
698
|
+
['setup', 'outputAudioTranscription'],
|
699
|
+
getv(from_object, ['output_audio_transcription']),
|
2867
700
|
)
|
2868
701
|
|
2869
|
-
if getv(from_object, ['
|
702
|
+
if getv(from_object, ['realtime_input_config']) is not None:
|
2870
703
|
setv(
|
2871
|
-
|
2872
|
-
['
|
2873
|
-
getv(from_object, ['
|
704
|
+
parent_object,
|
705
|
+
['setup', 'realtimeInputConfig'],
|
706
|
+
getv(from_object, ['realtime_input_config']),
|
2874
707
|
)
|
2875
708
|
|
2876
|
-
if getv(from_object, ['
|
2877
|
-
setv(to_object, ['executable_code'], getv(from_object, ['executableCode']))
|
2878
|
-
|
2879
|
-
if getv(from_object, ['functionResponse']) is not None:
|
709
|
+
if getv(from_object, ['context_window_compression']) is not None:
|
2880
710
|
setv(
|
2881
|
-
|
2882
|
-
['
|
2883
|
-
getv(from_object, ['
|
711
|
+
parent_object,
|
712
|
+
['setup', 'contextWindowCompression'],
|
713
|
+
getv(from_object, ['context_window_compression']),
|
2884
714
|
)
|
2885
715
|
|
2886
|
-
if getv(from_object, ['
|
2887
|
-
setv(
|
716
|
+
if getv(from_object, ['proactivity']) is not None:
|
717
|
+
setv(
|
718
|
+
parent_object,
|
719
|
+
['setup', 'proactivity'],
|
720
|
+
getv(from_object, ['proactivity']),
|
721
|
+
)
|
2888
722
|
|
2889
723
|
return to_object
|
2890
724
|
|
2891
725
|
|
2892
|
-
def
|
726
|
+
def _LiveConnectConfig_to_vertex(
|
727
|
+
api_client: BaseApiClient,
|
2893
728
|
from_object: Union[dict[str, Any], object],
|
2894
729
|
parent_object: Optional[dict[str, Any]] = None,
|
2895
730
|
) -> dict[str, Any]:
|
2896
731
|
to_object: dict[str, Any] = {}
|
2897
|
-
|
732
|
+
|
733
|
+
if getv(from_object, ['generation_config']) is not None:
|
2898
734
|
setv(
|
2899
|
-
|
2900
|
-
['
|
2901
|
-
|
2902
|
-
getv(from_object, ['
|
735
|
+
parent_object,
|
736
|
+
['setup', 'generationConfig'],
|
737
|
+
_GenerationConfig_to_vertex(
|
738
|
+
getv(from_object, ['generation_config']), to_object
|
2903
739
|
),
|
2904
740
|
)
|
2905
741
|
|
2906
|
-
if getv(from_object, ['
|
2907
|
-
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
2908
|
-
|
2909
|
-
if getv(from_object, ['inline_data']) is not None:
|
742
|
+
if getv(from_object, ['response_modalities']) is not None:
|
2910
743
|
setv(
|
2911
|
-
|
2912
|
-
['
|
2913
|
-
|
744
|
+
parent_object,
|
745
|
+
['setup', 'generationConfig', 'responseModalities'],
|
746
|
+
getv(from_object, ['response_modalities']),
|
2914
747
|
)
|
2915
748
|
|
2916
|
-
if getv(from_object, ['
|
749
|
+
if getv(from_object, ['temperature']) is not None:
|
2917
750
|
setv(
|
2918
|
-
|
2919
|
-
['
|
2920
|
-
|
751
|
+
parent_object,
|
752
|
+
['setup', 'generationConfig', 'temperature'],
|
753
|
+
getv(from_object, ['temperature']),
|
2921
754
|
)
|
2922
755
|
|
2923
|
-
if getv(from_object, ['
|
756
|
+
if getv(from_object, ['top_p']) is not None:
|
2924
757
|
setv(
|
2925
|
-
|
2926
|
-
['
|
2927
|
-
getv(from_object, ['
|
758
|
+
parent_object,
|
759
|
+
['setup', 'generationConfig', 'topP'],
|
760
|
+
getv(from_object, ['top_p']),
|
2928
761
|
)
|
2929
762
|
|
2930
|
-
if getv(from_object, ['
|
763
|
+
if getv(from_object, ['top_k']) is not None:
|
2931
764
|
setv(
|
2932
|
-
|
2933
|
-
['
|
2934
|
-
|
765
|
+
parent_object,
|
766
|
+
['setup', 'generationConfig', 'topK'],
|
767
|
+
getv(from_object, ['top_k']),
|
2935
768
|
)
|
2936
769
|
|
2937
|
-
if getv(from_object, ['
|
770
|
+
if getv(from_object, ['max_output_tokens']) is not None:
|
2938
771
|
setv(
|
2939
|
-
|
2940
|
-
['
|
2941
|
-
getv(from_object, ['
|
772
|
+
parent_object,
|
773
|
+
['setup', 'generationConfig', 'maxOutputTokens'],
|
774
|
+
getv(from_object, ['max_output_tokens']),
|
2942
775
|
)
|
2943
776
|
|
2944
|
-
if getv(from_object, ['
|
2945
|
-
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
2946
|
-
|
2947
|
-
if getv(from_object, ['function_response']) is not None:
|
777
|
+
if getv(from_object, ['media_resolution']) is not None:
|
2948
778
|
setv(
|
2949
|
-
|
2950
|
-
['
|
2951
|
-
getv(from_object, ['
|
779
|
+
parent_object,
|
780
|
+
['setup', 'generationConfig', 'mediaResolution'],
|
781
|
+
getv(from_object, ['media_resolution']),
|
2952
782
|
)
|
2953
783
|
|
2954
|
-
if getv(from_object, ['
|
2955
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
2956
|
-
|
2957
|
-
return to_object
|
2958
|
-
|
2959
|
-
|
2960
|
-
def _Part_to_vertex(
|
2961
|
-
from_object: Union[dict[str, Any], object],
|
2962
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2963
|
-
) -> dict[str, Any]:
|
2964
|
-
to_object: dict[str, Any] = {}
|
2965
|
-
if getv(from_object, ['video_metadata']) is not None:
|
784
|
+
if getv(from_object, ['seed']) is not None:
|
2966
785
|
setv(
|
2967
|
-
|
2968
|
-
['
|
2969
|
-
|
2970
|
-
getv(from_object, ['video_metadata']), to_object
|
2971
|
-
),
|
786
|
+
parent_object,
|
787
|
+
['setup', 'generationConfig', 'seed'],
|
788
|
+
getv(from_object, ['seed']),
|
2972
789
|
)
|
2973
790
|
|
2974
|
-
if getv(from_object, ['
|
2975
|
-
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
2976
|
-
|
2977
|
-
if getv(from_object, ['inline_data']) is not None:
|
791
|
+
if getv(from_object, ['speech_config']) is not None:
|
2978
792
|
setv(
|
2979
|
-
|
2980
|
-
['
|
2981
|
-
|
793
|
+
parent_object,
|
794
|
+
['setup', 'generationConfig', 'speechConfig'],
|
795
|
+
_SpeechConfig_to_vertex(
|
796
|
+
t.t_live_speech_config(getv(from_object, ['speech_config'])),
|
797
|
+
to_object,
|
798
|
+
),
|
2982
799
|
)
|
2983
800
|
|
2984
|
-
if getv(from_object, ['
|
801
|
+
if getv(from_object, ['thinking_config']) is not None:
|
2985
802
|
setv(
|
2986
|
-
|
2987
|
-
['
|
2988
|
-
|
803
|
+
parent_object,
|
804
|
+
['setup', 'generationConfig', 'thinkingConfig'],
|
805
|
+
getv(from_object, ['thinking_config']),
|
2989
806
|
)
|
2990
807
|
|
2991
|
-
if getv(from_object, ['
|
808
|
+
if getv(from_object, ['enable_affective_dialog']) is not None:
|
2992
809
|
setv(
|
2993
|
-
|
2994
|
-
['
|
2995
|
-
getv(from_object, ['
|
810
|
+
parent_object,
|
811
|
+
['setup', 'generationConfig', 'enableAffectiveDialog'],
|
812
|
+
getv(from_object, ['enable_affective_dialog']),
|
2996
813
|
)
|
2997
814
|
|
2998
|
-
if getv(from_object, ['
|
815
|
+
if getv(from_object, ['system_instruction']) is not None:
|
2999
816
|
setv(
|
3000
|
-
|
3001
|
-
['
|
3002
|
-
|
3003
|
-
getv(from_object, ['function_call']), to_object
|
3004
|
-
),
|
817
|
+
parent_object,
|
818
|
+
['setup', 'systemInstruction'],
|
819
|
+
t.t_content(getv(from_object, ['system_instruction'])),
|
3005
820
|
)
|
3006
821
|
|
3007
|
-
if getv(from_object, ['
|
822
|
+
if getv(from_object, ['tools']) is not None:
|
3008
823
|
setv(
|
3009
|
-
|
3010
|
-
['
|
3011
|
-
|
824
|
+
parent_object,
|
825
|
+
['setup', 'tools'],
|
826
|
+
[
|
827
|
+
_Tool_to_vertex(t.t_tool(api_client, item), to_object)
|
828
|
+
for item in t.t_tools(api_client, getv(from_object, ['tools']))
|
829
|
+
],
|
3012
830
|
)
|
3013
831
|
|
3014
|
-
if getv(from_object, ['
|
3015
|
-
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
3016
|
-
|
3017
|
-
if getv(from_object, ['function_response']) is not None:
|
832
|
+
if getv(from_object, ['session_resumption']) is not None:
|
3018
833
|
setv(
|
3019
|
-
|
3020
|
-
['
|
3021
|
-
getv(from_object, ['
|
3022
|
-
)
|
3023
|
-
|
3024
|
-
if getv(from_object, ['text']) is not None:
|
3025
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
3026
|
-
|
3027
|
-
return to_object
|
3028
|
-
|
3029
|
-
|
3030
|
-
def _PrebuiltVoiceConfig_to_mldev(
|
3031
|
-
from_object: Union[dict[str, Any], object],
|
3032
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3033
|
-
) -> dict[str, Any]:
|
3034
|
-
to_object: dict[str, Any] = {}
|
3035
|
-
if getv(from_object, ['voice_name']) is not None:
|
3036
|
-
setv(to_object, ['voiceName'], getv(from_object, ['voice_name']))
|
3037
|
-
|
3038
|
-
return to_object
|
3039
|
-
|
3040
|
-
|
3041
|
-
def _PrebuiltVoiceConfig_to_vertex(
|
3042
|
-
from_object: Union[dict[str, Any], object],
|
3043
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3044
|
-
) -> dict[str, Any]:
|
3045
|
-
to_object: dict[str, Any] = {}
|
3046
|
-
if getv(from_object, ['voice_name']) is not None:
|
3047
|
-
setv(to_object, ['voiceName'], getv(from_object, ['voice_name']))
|
3048
|
-
|
3049
|
-
return to_object
|
834
|
+
parent_object,
|
835
|
+
['setup', 'sessionResumption'],
|
836
|
+
getv(from_object, ['session_resumption']),
|
837
|
+
)
|
3050
838
|
|
839
|
+
if getv(from_object, ['input_audio_transcription']) is not None:
|
840
|
+
setv(
|
841
|
+
parent_object,
|
842
|
+
['setup', 'inputAudioTranscription'],
|
843
|
+
getv(from_object, ['input_audio_transcription']),
|
844
|
+
)
|
3051
845
|
|
3052
|
-
|
3053
|
-
|
3054
|
-
|
3055
|
-
|
3056
|
-
|
3057
|
-
|
3058
|
-
setv(to_object, ['proactiveAudio'], getv(from_object, ['proactive_audio']))
|
846
|
+
if getv(from_object, ['output_audio_transcription']) is not None:
|
847
|
+
setv(
|
848
|
+
parent_object,
|
849
|
+
['setup', 'outputAudioTranscription'],
|
850
|
+
getv(from_object, ['output_audio_transcription']),
|
851
|
+
)
|
3059
852
|
|
3060
|
-
|
853
|
+
if getv(from_object, ['realtime_input_config']) is not None:
|
854
|
+
setv(
|
855
|
+
parent_object,
|
856
|
+
['setup', 'realtimeInputConfig'],
|
857
|
+
getv(from_object, ['realtime_input_config']),
|
858
|
+
)
|
3061
859
|
|
860
|
+
if getv(from_object, ['context_window_compression']) is not None:
|
861
|
+
setv(
|
862
|
+
parent_object,
|
863
|
+
['setup', 'contextWindowCompression'],
|
864
|
+
getv(from_object, ['context_window_compression']),
|
865
|
+
)
|
3062
866
|
|
3063
|
-
|
3064
|
-
|
3065
|
-
|
3066
|
-
|
3067
|
-
|
3068
|
-
|
3069
|
-
setv(to_object, ['proactiveAudio'], getv(from_object, ['proactive_audio']))
|
867
|
+
if getv(from_object, ['proactivity']) is not None:
|
868
|
+
setv(
|
869
|
+
parent_object,
|
870
|
+
['setup', 'proactivity'],
|
871
|
+
getv(from_object, ['proactivity']),
|
872
|
+
)
|
3070
873
|
|
3071
874
|
return to_object
|
3072
875
|
|
3073
876
|
|
3074
|
-
def
|
877
|
+
def _LiveConnectParameters_to_mldev(
|
878
|
+
api_client: BaseApiClient,
|
3075
879
|
from_object: Union[dict[str, Any], object],
|
3076
880
|
parent_object: Optional[dict[str, Any]] = None,
|
3077
881
|
) -> dict[str, Any]:
|
3078
882
|
to_object: dict[str, Any] = {}
|
3079
|
-
if getv(from_object, ['
|
883
|
+
if getv(from_object, ['model']) is not None:
|
3080
884
|
setv(
|
3081
885
|
to_object,
|
3082
|
-
['
|
3083
|
-
|
3084
|
-
getv(from_object, ['automatic_activity_detection']), to_object
|
3085
|
-
),
|
886
|
+
['setup', 'model'],
|
887
|
+
t.t_model(api_client, getv(from_object, ['model'])),
|
3086
888
|
)
|
3087
889
|
|
3088
|
-
if getv(from_object, ['
|
890
|
+
if getv(from_object, ['config']) is not None:
|
3089
891
|
setv(
|
3090
892
|
to_object,
|
3091
|
-
['
|
3092
|
-
|
893
|
+
['config'],
|
894
|
+
_LiveConnectConfig_to_mldev(
|
895
|
+
api_client, getv(from_object, ['config']), to_object
|
896
|
+
),
|
3093
897
|
)
|
3094
898
|
|
3095
|
-
if getv(from_object, ['turn_coverage']) is not None:
|
3096
|
-
setv(to_object, ['turnCoverage'], getv(from_object, ['turn_coverage']))
|
3097
|
-
|
3098
899
|
return to_object
|
3099
900
|
|
3100
901
|
|
3101
|
-
def
|
902
|
+
def _LiveConnectParameters_to_vertex(
|
903
|
+
api_client: BaseApiClient,
|
3102
904
|
from_object: Union[dict[str, Any], object],
|
3103
905
|
parent_object: Optional[dict[str, Any]] = None,
|
3104
906
|
) -> dict[str, Any]:
|
3105
907
|
to_object: dict[str, Any] = {}
|
3106
|
-
if getv(from_object, ['
|
908
|
+
if getv(from_object, ['model']) is not None:
|
3107
909
|
setv(
|
3108
910
|
to_object,
|
3109
|
-
['
|
3110
|
-
|
3111
|
-
getv(from_object, ['automatic_activity_detection']), to_object
|
3112
|
-
),
|
911
|
+
['setup', 'model'],
|
912
|
+
t.t_model(api_client, getv(from_object, ['model'])),
|
3113
913
|
)
|
3114
914
|
|
3115
|
-
if getv(from_object, ['
|
915
|
+
if getv(from_object, ['config']) is not None:
|
3116
916
|
setv(
|
3117
917
|
to_object,
|
3118
|
-
['
|
3119
|
-
|
918
|
+
['config'],
|
919
|
+
_LiveConnectConfig_to_vertex(
|
920
|
+
api_client, getv(from_object, ['config']), to_object
|
921
|
+
),
|
3120
922
|
)
|
3121
923
|
|
3122
|
-
if getv(from_object, ['turn_coverage']) is not None:
|
3123
|
-
setv(to_object, ['turnCoverage'], getv(from_object, ['turn_coverage']))
|
3124
|
-
|
3125
924
|
return to_object
|
3126
925
|
|
3127
926
|
|
3128
|
-
def
|
927
|
+
def _LiveMusicClientMessage_to_vertex(
|
3129
928
|
from_object: Union[dict[str, Any], object],
|
3130
929
|
parent_object: Optional[dict[str, Any]] = None,
|
3131
930
|
) -> dict[str, Any]:
|
3132
931
|
to_object: dict[str, Any] = {}
|
3133
|
-
if getv(from_object, ['
|
3134
|
-
|
932
|
+
if getv(from_object, ['setup']) is not None:
|
933
|
+
raise ValueError('setup parameter is not supported in Vertex AI.')
|
3135
934
|
|
3136
|
-
if getv(from_object, ['
|
3137
|
-
raise ValueError('
|
935
|
+
if getv(from_object, ['client_content']) is not None:
|
936
|
+
raise ValueError('client_content parameter is not supported in Vertex AI.')
|
937
|
+
|
938
|
+
if getv(from_object, ['music_generation_config']) is not None:
|
939
|
+
raise ValueError(
|
940
|
+
'music_generation_config parameter is not supported in Vertex AI.'
|
941
|
+
)
|
942
|
+
|
943
|
+
if getv(from_object, ['playback_control']) is not None:
|
944
|
+
raise ValueError(
|
945
|
+
'playback_control parameter is not supported in Vertex AI.'
|
946
|
+
)
|
3138
947
|
|
3139
948
|
return to_object
|
3140
949
|
|
3141
950
|
|
3142
|
-
def
|
951
|
+
def _LiveMusicConnectParameters_to_mldev(
|
3143
952
|
from_object: Union[dict[str, Any], object],
|
3144
953
|
parent_object: Optional[dict[str, Any]] = None,
|
3145
954
|
) -> dict[str, Any]:
|
3146
955
|
to_object: dict[str, Any] = {}
|
3147
|
-
if getv(from_object, ['
|
3148
|
-
setv(to_object, ['
|
3149
|
-
|
3150
|
-
if getv(from_object, ['transparent']) is not None:
|
3151
|
-
setv(to_object, ['transparent'], getv(from_object, ['transparent']))
|
956
|
+
if getv(from_object, ['model']) is not None:
|
957
|
+
setv(to_object, ['setup', 'model'], getv(from_object, ['model']))
|
3152
958
|
|
3153
959
|
return to_object
|
3154
960
|
|
3155
961
|
|
3156
|
-
def
|
962
|
+
def _LiveMusicConnectParameters_to_vertex(
|
3157
963
|
from_object: Union[dict[str, Any], object],
|
3158
964
|
parent_object: Optional[dict[str, Any]] = None,
|
3159
965
|
) -> dict[str, Any]:
|
3160
966
|
to_object: dict[str, Any] = {}
|
3161
|
-
if getv(from_object, ['
|
3162
|
-
|
967
|
+
if getv(from_object, ['model']) is not None:
|
968
|
+
raise ValueError('model parameter is not supported in Vertex AI.')
|
3163
969
|
|
3164
970
|
return to_object
|
3165
971
|
|
3166
972
|
|
3167
|
-
def
|
973
|
+
def _LiveMusicSetConfigParameters_to_mldev(
|
3168
974
|
from_object: Union[dict[str, Any], object],
|
3169
975
|
parent_object: Optional[dict[str, Any]] = None,
|
3170
976
|
) -> dict[str, Any]:
|
3171
977
|
to_object: dict[str, Any] = {}
|
3172
|
-
if getv(from_object, ['
|
3173
|
-
setv(
|
978
|
+
if getv(from_object, ['music_generation_config']) is not None:
|
979
|
+
setv(
|
980
|
+
to_object,
|
981
|
+
['musicGenerationConfig'],
|
982
|
+
getv(from_object, ['music_generation_config']),
|
983
|
+
)
|
3174
984
|
|
3175
985
|
return to_object
|
3176
986
|
|
3177
987
|
|
3178
|
-
def
|
988
|
+
def _LiveMusicSetConfigParameters_to_vertex(
|
3179
989
|
from_object: Union[dict[str, Any], object],
|
3180
990
|
parent_object: Optional[dict[str, Any]] = None,
|
3181
991
|
) -> dict[str, Any]:
|
3182
992
|
to_object: dict[str, Any] = {}
|
3183
|
-
if getv(from_object, ['
|
3184
|
-
|
3185
|
-
|
3186
|
-
if getv(from_object, ['voice_config']) is not None:
|
3187
|
-
setv(
|
3188
|
-
to_object,
|
3189
|
-
['voiceConfig'],
|
3190
|
-
_VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
|
993
|
+
if getv(from_object, ['music_generation_config']) is not None:
|
994
|
+
raise ValueError(
|
995
|
+
'music_generation_config parameter is not supported in Vertex AI.'
|
3191
996
|
)
|
3192
997
|
|
3193
998
|
return to_object
|
3194
999
|
|
3195
1000
|
|
3196
|
-
def
|
1001
|
+
def _LiveMusicSetWeightedPromptsParameters_to_mldev(
|
3197
1002
|
from_object: Union[dict[str, Any], object],
|
3198
1003
|
parent_object: Optional[dict[str, Any]] = None,
|
3199
1004
|
) -> dict[str, Any]:
|
3200
1005
|
to_object: dict[str, Any] = {}
|
3201
|
-
if getv(from_object, ['
|
3202
|
-
setv(
|
3203
|
-
to_object,
|
3204
|
-
['voiceConfig'],
|
3205
|
-
_VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
|
3206
|
-
)
|
3207
|
-
|
3208
|
-
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
1006
|
+
if getv(from_object, ['weighted_prompts']) is not None:
|
3209
1007
|
setv(
|
3210
1008
|
to_object,
|
3211
|
-
['
|
3212
|
-
|
3213
|
-
getv(from_object, ['multi_speaker_voice_config']), to_object
|
3214
|
-
),
|
1009
|
+
['weightedPrompts'],
|
1010
|
+
[item for item in getv(from_object, ['weighted_prompts'])],
|
3215
1011
|
)
|
3216
1012
|
|
3217
|
-
if getv(from_object, ['language_code']) is not None:
|
3218
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
3219
|
-
|
3220
1013
|
return to_object
|
3221
1014
|
|
3222
1015
|
|
3223
|
-
def
|
1016
|
+
def _LiveMusicSetWeightedPromptsParameters_to_vertex(
|
3224
1017
|
from_object: Union[dict[str, Any], object],
|
3225
1018
|
parent_object: Optional[dict[str, Any]] = None,
|
3226
1019
|
) -> dict[str, Any]:
|
3227
1020
|
to_object: dict[str, Any] = {}
|
3228
|
-
if getv(from_object, ['
|
3229
|
-
setv(
|
3230
|
-
to_object,
|
3231
|
-
['voiceConfig'],
|
3232
|
-
_VoiceConfig_to_vertex(getv(from_object, ['voice_config']), to_object),
|
3233
|
-
)
|
3234
|
-
|
3235
|
-
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
1021
|
+
if getv(from_object, ['weighted_prompts']) is not None:
|
3236
1022
|
raise ValueError(
|
3237
|
-
'
|
1023
|
+
'weighted_prompts parameter is not supported in Vertex AI.'
|
3238
1024
|
)
|
3239
1025
|
|
3240
|
-
if getv(from_object, ['language_code']) is not None:
|
3241
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
3242
|
-
|
3243
1026
|
return to_object
|
3244
1027
|
|
3245
1028
|
|
3246
|
-
def
|
1029
|
+
def _LiveSendRealtimeInputParameters_to_mldev(
|
3247
1030
|
from_object: Union[dict[str, Any], object],
|
3248
1031
|
parent_object: Optional[dict[str, Any]] = None,
|
3249
1032
|
) -> dict[str, Any]:
|
3250
1033
|
to_object: dict[str, Any] = {}
|
3251
|
-
if getv(from_object, ['
|
1034
|
+
if getv(from_object, ['media']) is not None:
|
1035
|
+
setv(
|
1036
|
+
to_object,
|
1037
|
+
['mediaChunks'],
|
1038
|
+
[
|
1039
|
+
_Blob_to_mldev(item, to_object)
|
1040
|
+
for item in t.t_blobs(getv(from_object, ['media']))
|
1041
|
+
],
|
1042
|
+
)
|
1043
|
+
|
1044
|
+
if getv(from_object, ['audio']) is not None:
|
1045
|
+
setv(
|
1046
|
+
to_object,
|
1047
|
+
['audio'],
|
1048
|
+
_Blob_to_mldev(t.t_audio_blob(getv(from_object, ['audio'])), to_object),
|
1049
|
+
)
|
1050
|
+
|
1051
|
+
if getv(from_object, ['audio_stream_end']) is not None:
|
1052
|
+
setv(to_object, ['audioStreamEnd'], getv(from_object, ['audio_stream_end']))
|
1053
|
+
|
1054
|
+
if getv(from_object, ['video']) is not None:
|
3252
1055
|
setv(
|
3253
|
-
to_object,
|
1056
|
+
to_object,
|
1057
|
+
['video'],
|
1058
|
+
_Blob_to_mldev(t.t_image_blob(getv(from_object, ['video'])), to_object),
|
3254
1059
|
)
|
3255
1060
|
|
3256
|
-
if getv(from_object, ['
|
3257
|
-
setv(to_object, ['
|
1061
|
+
if getv(from_object, ['text']) is not None:
|
1062
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
1063
|
+
|
1064
|
+
if getv(from_object, ['activity_start']) is not None:
|
1065
|
+
setv(to_object, ['activityStart'], getv(from_object, ['activity_start']))
|
1066
|
+
|
1067
|
+
if getv(from_object, ['activity_end']) is not None:
|
1068
|
+
setv(to_object, ['activityEnd'], getv(from_object, ['activity_end']))
|
3258
1069
|
|
3259
1070
|
return to_object
|
3260
1071
|
|
3261
1072
|
|
3262
|
-
def
|
1073
|
+
def _LiveSendRealtimeInputParameters_to_vertex(
|
3263
1074
|
from_object: Union[dict[str, Any], object],
|
3264
1075
|
parent_object: Optional[dict[str, Any]] = None,
|
3265
1076
|
) -> dict[str, Any]:
|
3266
1077
|
to_object: dict[str, Any] = {}
|
3267
|
-
if getv(from_object, ['
|
1078
|
+
if getv(from_object, ['media']) is not None:
|
3268
1079
|
setv(
|
3269
|
-
to_object,
|
1080
|
+
to_object,
|
1081
|
+
['mediaChunks'],
|
1082
|
+
[item for item in t.t_blobs(getv(from_object, ['media']))],
|
3270
1083
|
)
|
3271
1084
|
|
3272
|
-
if getv(from_object, ['
|
3273
|
-
setv(to_object, ['
|
1085
|
+
if getv(from_object, ['audio']) is not None:
|
1086
|
+
setv(to_object, ['audio'], t.t_audio_blob(getv(from_object, ['audio'])))
|
1087
|
+
|
1088
|
+
if getv(from_object, ['audio_stream_end']) is not None:
|
1089
|
+
setv(to_object, ['audioStreamEnd'], getv(from_object, ['audio_stream_end']))
|
1090
|
+
|
1091
|
+
if getv(from_object, ['video']) is not None:
|
1092
|
+
setv(to_object, ['video'], t.t_image_blob(getv(from_object, ['video'])))
|
1093
|
+
|
1094
|
+
if getv(from_object, ['text']) is not None:
|
1095
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
1096
|
+
|
1097
|
+
if getv(from_object, ['activity_start']) is not None:
|
1098
|
+
setv(to_object, ['activityStart'], getv(from_object, ['activity_start']))
|
1099
|
+
|
1100
|
+
if getv(from_object, ['activity_end']) is not None:
|
1101
|
+
setv(to_object, ['activityEnd'], getv(from_object, ['activity_end']))
|
3274
1102
|
|
3275
1103
|
return to_object
|
3276
1104
|
|
3277
1105
|
|
3278
|
-
def
|
1106
|
+
def _LiveServerMessage_from_vertex(
|
3279
1107
|
from_object: Union[dict[str, Any], object],
|
3280
1108
|
parent_object: Optional[dict[str, Any]] = None,
|
3281
1109
|
) -> dict[str, Any]:
|
3282
1110
|
to_object: dict[str, Any] = {}
|
3283
|
-
if getv(from_object, ['
|
3284
|
-
setv(
|
3285
|
-
to_object,
|
3286
|
-
['functionDeclarations'],
|
3287
|
-
[
|
3288
|
-
_FunctionDeclaration_to_mldev(item, to_object)
|
3289
|
-
for item in getv(from_object, ['function_declarations'])
|
3290
|
-
],
|
3291
|
-
)
|
1111
|
+
if getv(from_object, ['setupComplete']) is not None:
|
1112
|
+
setv(to_object, ['setup_complete'], getv(from_object, ['setupComplete']))
|
3292
1113
|
|
3293
|
-
if getv(from_object, ['
|
3294
|
-
|
1114
|
+
if getv(from_object, ['serverContent']) is not None:
|
1115
|
+
setv(to_object, ['server_content'], getv(from_object, ['serverContent']))
|
3295
1116
|
|
3296
|
-
if getv(from_object, ['
|
1117
|
+
if getv(from_object, ['toolCall']) is not None:
|
1118
|
+
setv(to_object, ['tool_call'], getv(from_object, ['toolCall']))
|
1119
|
+
|
1120
|
+
if getv(from_object, ['toolCallCancellation']) is not None:
|
3297
1121
|
setv(
|
3298
1122
|
to_object,
|
3299
|
-
['
|
3300
|
-
|
1123
|
+
['tool_call_cancellation'],
|
1124
|
+
getv(from_object, ['toolCallCancellation']),
|
3301
1125
|
)
|
3302
1126
|
|
3303
|
-
if getv(from_object, ['
|
1127
|
+
if getv(from_object, ['usageMetadata']) is not None:
|
3304
1128
|
setv(
|
3305
1129
|
to_object,
|
3306
|
-
['
|
3307
|
-
|
3308
|
-
getv(from_object, ['
|
1130
|
+
['usage_metadata'],
|
1131
|
+
_UsageMetadata_from_vertex(
|
1132
|
+
getv(from_object, ['usageMetadata']), to_object
|
3309
1133
|
),
|
3310
1134
|
)
|
3311
1135
|
|
3312
|
-
if getv(from_object, ['
|
3313
|
-
|
3314
|
-
'enterprise_web_search parameter is not supported in Gemini API.'
|
3315
|
-
)
|
3316
|
-
|
3317
|
-
if getv(from_object, ['google_maps']) is not None:
|
3318
|
-
raise ValueError('google_maps parameter is not supported in Gemini API.')
|
3319
|
-
|
3320
|
-
if getv(from_object, ['url_context']) is not None:
|
3321
|
-
setv(
|
3322
|
-
to_object,
|
3323
|
-
['urlContext'],
|
3324
|
-
_UrlContext_to_mldev(getv(from_object, ['url_context']), to_object),
|
3325
|
-
)
|
1136
|
+
if getv(from_object, ['goAway']) is not None:
|
1137
|
+
setv(to_object, ['go_away'], getv(from_object, ['goAway']))
|
3326
1138
|
|
3327
|
-
if getv(from_object, ['
|
1139
|
+
if getv(from_object, ['sessionResumptionUpdate']) is not None:
|
3328
1140
|
setv(
|
3329
1141
|
to_object,
|
3330
|
-
['
|
3331
|
-
|
1142
|
+
['session_resumption_update'],
|
1143
|
+
getv(from_object, ['sessionResumptionUpdate']),
|
3332
1144
|
)
|
3333
1145
|
|
3334
|
-
if getv(from_object, ['code_execution']) is not None:
|
3335
|
-
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
3336
|
-
|
3337
1146
|
return to_object
|
3338
1147
|
|
3339
1148
|
|
3340
|
-
def
|
1149
|
+
def _Part_to_mldev(
|
3341
1150
|
from_object: Union[dict[str, Any], object],
|
3342
1151
|
parent_object: Optional[dict[str, Any]] = None,
|
3343
1152
|
) -> dict[str, Any]:
|
3344
1153
|
to_object: dict[str, Any] = {}
|
3345
|
-
if getv(from_object, ['
|
3346
|
-
setv(
|
3347
|
-
to_object,
|
3348
|
-
['functionDeclarations'],
|
3349
|
-
[
|
3350
|
-
_FunctionDeclaration_to_vertex(item, to_object)
|
3351
|
-
for item in getv(from_object, ['function_declarations'])
|
3352
|
-
],
|
3353
|
-
)
|
3354
|
-
|
3355
|
-
if getv(from_object, ['retrieval']) is not None:
|
3356
|
-
setv(to_object, ['retrieval'], getv(from_object, ['retrieval']))
|
3357
|
-
|
3358
|
-
if getv(from_object, ['google_search']) is not None:
|
3359
|
-
setv(
|
3360
|
-
to_object,
|
3361
|
-
['googleSearch'],
|
3362
|
-
_GoogleSearch_to_vertex(
|
3363
|
-
getv(from_object, ['google_search']), to_object
|
3364
|
-
),
|
3365
|
-
)
|
1154
|
+
if getv(from_object, ['video_metadata']) is not None:
|
1155
|
+
setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
|
3366
1156
|
|
3367
|
-
if getv(from_object, ['
|
3368
|
-
setv(
|
3369
|
-
to_object,
|
3370
|
-
['googleSearchRetrieval'],
|
3371
|
-
_GoogleSearchRetrieval_to_vertex(
|
3372
|
-
getv(from_object, ['google_search_retrieval']), to_object
|
3373
|
-
),
|
3374
|
-
)
|
1157
|
+
if getv(from_object, ['thought']) is not None:
|
1158
|
+
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
3375
1159
|
|
3376
|
-
if getv(from_object, ['
|
1160
|
+
if getv(from_object, ['inline_data']) is not None:
|
3377
1161
|
setv(
|
3378
1162
|
to_object,
|
3379
|
-
['
|
3380
|
-
|
3381
|
-
getv(from_object, ['enterprise_web_search']), to_object
|
3382
|
-
),
|
1163
|
+
['inlineData'],
|
1164
|
+
_Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
|
3383
1165
|
)
|
3384
1166
|
|
3385
|
-
if getv(from_object, ['
|
1167
|
+
if getv(from_object, ['file_data']) is not None:
|
3386
1168
|
setv(
|
3387
1169
|
to_object,
|
3388
|
-
['
|
3389
|
-
|
1170
|
+
['fileData'],
|
1171
|
+
_FileData_to_mldev(getv(from_object, ['file_data']), to_object),
|
3390
1172
|
)
|
3391
1173
|
|
3392
|
-
if getv(from_object, ['
|
1174
|
+
if getv(from_object, ['thought_signature']) is not None:
|
3393
1175
|
setv(
|
3394
1176
|
to_object,
|
3395
|
-
['
|
3396
|
-
|
1177
|
+
['thoughtSignature'],
|
1178
|
+
getv(from_object, ['thought_signature']),
|
3397
1179
|
)
|
3398
1180
|
|
3399
|
-
if getv(from_object, ['
|
1181
|
+
if getv(from_object, ['function_call']) is not None:
|
1182
|
+
setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
|
1183
|
+
|
1184
|
+
if getv(from_object, ['code_execution_result']) is not None:
|
3400
1185
|
setv(
|
3401
1186
|
to_object,
|
3402
|
-
['
|
3403
|
-
|
1187
|
+
['codeExecutionResult'],
|
1188
|
+
getv(from_object, ['code_execution_result']),
|
3404
1189
|
)
|
3405
1190
|
|
3406
|
-
if getv(from_object, ['
|
3407
|
-
setv(to_object, ['
|
3408
|
-
|
3409
|
-
return to_object
|
1191
|
+
if getv(from_object, ['executable_code']) is not None:
|
1192
|
+
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
3410
1193
|
|
1194
|
+
if getv(from_object, ['function_response']) is not None:
|
1195
|
+
setv(
|
1196
|
+
to_object,
|
1197
|
+
['functionResponse'],
|
1198
|
+
getv(from_object, ['function_response']),
|
1199
|
+
)
|
3411
1200
|
|
3412
|
-
def _Transcription_from_mldev(
|
3413
|
-
from_object: Union[dict[str, Any], object],
|
3414
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3415
|
-
) -> dict[str, Any]:
|
3416
|
-
to_object: dict[str, Any] = {}
|
3417
1201
|
if getv(from_object, ['text']) is not None:
|
3418
1202
|
setv(to_object, ['text'], getv(from_object, ['text']))
|
3419
1203
|
|
3420
|
-
if getv(from_object, ['finished']) is not None:
|
3421
|
-
setv(to_object, ['finished'], getv(from_object, ['finished']))
|
3422
|
-
|
3423
1204
|
return to_object
|
3424
1205
|
|
3425
1206
|
|
3426
|
-
def
|
1207
|
+
def _SessionResumptionConfig_to_mldev(
|
3427
1208
|
from_object: Union[dict[str, Any], object],
|
3428
1209
|
parent_object: Optional[dict[str, Any]] = None,
|
3429
1210
|
) -> dict[str, Any]:
|
3430
1211
|
to_object: dict[str, Any] = {}
|
3431
|
-
if getv(from_object, ['
|
3432
|
-
setv(to_object, ['
|
3433
|
-
|
3434
|
-
if getv(from_object, ['finished']) is not None:
|
3435
|
-
setv(to_object, ['finished'], getv(from_object, ['finished']))
|
3436
|
-
|
3437
|
-
return to_object
|
3438
|
-
|
1212
|
+
if getv(from_object, ['handle']) is not None:
|
1213
|
+
setv(to_object, ['handle'], getv(from_object, ['handle']))
|
3439
1214
|
|
3440
|
-
|
3441
|
-
|
3442
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3443
|
-
) -> dict[str, Any]:
|
3444
|
-
to_object: dict[str, Any] = {}
|
3445
|
-
if getv(from_object, ['urlMetadata']) is not None:
|
3446
|
-
setv(
|
3447
|
-
to_object,
|
3448
|
-
['url_metadata'],
|
3449
|
-
[
|
3450
|
-
_UrlMetadata_from_mldev(item, to_object)
|
3451
|
-
for item in getv(from_object, ['urlMetadata'])
|
3452
|
-
],
|
3453
|
-
)
|
1215
|
+
if getv(from_object, ['transparent']) is not None:
|
1216
|
+
raise ValueError('transparent parameter is not supported in Gemini API.')
|
3454
1217
|
|
3455
1218
|
return to_object
|
3456
1219
|
|
3457
1220
|
|
3458
|
-
def
|
1221
|
+
def _SpeechConfig_to_vertex(
|
3459
1222
|
from_object: Union[dict[str, Any], object],
|
3460
1223
|
parent_object: Optional[dict[str, Any]] = None,
|
3461
1224
|
) -> dict[str, Any]:
|
3462
1225
|
to_object: dict[str, Any] = {}
|
1226
|
+
if getv(from_object, ['voice_config']) is not None:
|
1227
|
+
setv(to_object, ['voiceConfig'], getv(from_object, ['voice_config']))
|
3463
1228
|
|
3464
|
-
|
3465
|
-
|
1229
|
+
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
1230
|
+
raise ValueError(
|
1231
|
+
'multi_speaker_voice_config parameter is not supported in Vertex AI.'
|
1232
|
+
)
|
3466
1233
|
|
3467
|
-
|
3468
|
-
|
3469
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3470
|
-
) -> dict[str, Any]:
|
3471
|
-
to_object: dict[str, Any] = {}
|
1234
|
+
if getv(from_object, ['language_code']) is not None:
|
1235
|
+
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
3472
1236
|
|
3473
1237
|
return to_object
|
3474
1238
|
|
3475
1239
|
|
3476
|
-
def
|
1240
|
+
def _Tool_to_mldev(
|
3477
1241
|
from_object: Union[dict[str, Any], object],
|
3478
1242
|
parent_object: Optional[dict[str, Any]] = None,
|
3479
1243
|
) -> dict[str, Any]:
|
3480
1244
|
to_object: dict[str, Any] = {}
|
3481
|
-
if getv(from_object, ['
|
3482
|
-
setv(to_object, ['retrieved_url'], getv(from_object, ['retrievedUrl']))
|
3483
|
-
|
3484
|
-
if getv(from_object, ['urlRetrievalStatus']) is not None:
|
1245
|
+
if getv(from_object, ['function_declarations']) is not None:
|
3485
1246
|
setv(
|
3486
1247
|
to_object,
|
3487
|
-
['
|
3488
|
-
getv(from_object, ['
|
1248
|
+
['functionDeclarations'],
|
1249
|
+
[item for item in getv(from_object, ['function_declarations'])],
|
3489
1250
|
)
|
3490
1251
|
|
3491
|
-
|
3492
|
-
|
1252
|
+
if getv(from_object, ['retrieval']) is not None:
|
1253
|
+
raise ValueError('retrieval parameter is not supported in Gemini API.')
|
3493
1254
|
|
3494
|
-
|
3495
|
-
from_object: Union[dict[str, Any], object],
|
3496
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3497
|
-
) -> dict[str, Any]:
|
3498
|
-
to_object: dict[str, Any] = {}
|
3499
|
-
if getv(from_object, ['promptTokenCount']) is not None:
|
1255
|
+
if getv(from_object, ['google_search']) is not None:
|
3500
1256
|
setv(
|
3501
1257
|
to_object,
|
3502
|
-
['
|
3503
|
-
getv(from_object, ['
|
1258
|
+
['googleSearch'],
|
1259
|
+
_GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
|
3504
1260
|
)
|
3505
1261
|
|
3506
|
-
if getv(from_object, ['
|
1262
|
+
if getv(from_object, ['google_search_retrieval']) is not None:
|
3507
1263
|
setv(
|
3508
1264
|
to_object,
|
3509
|
-
['
|
3510
|
-
getv(from_object, ['
|
1265
|
+
['googleSearchRetrieval'],
|
1266
|
+
getv(from_object, ['google_search_retrieval']),
|
3511
1267
|
)
|
3512
1268
|
|
3513
|
-
if getv(from_object, ['
|
3514
|
-
|
3515
|
-
|
3516
|
-
['response_token_count'],
|
3517
|
-
getv(from_object, ['responseTokenCount']),
|
1269
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
1270
|
+
raise ValueError(
|
1271
|
+
'enterprise_web_search parameter is not supported in Gemini API.'
|
3518
1272
|
)
|
3519
1273
|
|
3520
|
-
if getv(from_object, ['
|
1274
|
+
if getv(from_object, ['google_maps']) is not None:
|
3521
1275
|
setv(
|
3522
1276
|
to_object,
|
3523
|
-
['
|
3524
|
-
getv(from_object, ['
|
1277
|
+
['googleMaps'],
|
1278
|
+
_GoogleMaps_to_mldev(getv(from_object, ['google_maps']), to_object),
|
3525
1279
|
)
|
3526
1280
|
|
3527
|
-
if getv(from_object, ['
|
3528
|
-
setv(
|
3529
|
-
to_object,
|
3530
|
-
['thoughts_token_count'],
|
3531
|
-
getv(from_object, ['thoughtsTokenCount']),
|
3532
|
-
)
|
1281
|
+
if getv(from_object, ['url_context']) is not None:
|
1282
|
+
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
3533
1283
|
|
3534
|
-
if getv(from_object, ['
|
3535
|
-
setv(
|
3536
|
-
to_object, ['total_token_count'], getv(from_object, ['totalTokenCount'])
|
3537
|
-
)
|
1284
|
+
if getv(from_object, ['computer_use']) is not None:
|
1285
|
+
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
3538
1286
|
|
3539
|
-
if getv(from_object, ['
|
3540
|
-
setv(
|
3541
|
-
to_object,
|
3542
|
-
['prompt_tokens_details'],
|
3543
|
-
[
|
3544
|
-
_ModalityTokenCount_from_mldev(item, to_object)
|
3545
|
-
for item in getv(from_object, ['promptTokensDetails'])
|
3546
|
-
],
|
3547
|
-
)
|
1287
|
+
if getv(from_object, ['code_execution']) is not None:
|
1288
|
+
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
3548
1289
|
|
3549
|
-
|
1290
|
+
return to_object
|
1291
|
+
|
1292
|
+
|
1293
|
+
def _Tool_to_vertex(
|
1294
|
+
from_object: Union[dict[str, Any], object],
|
1295
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1296
|
+
) -> dict[str, Any]:
|
1297
|
+
to_object: dict[str, Any] = {}
|
1298
|
+
if getv(from_object, ['function_declarations']) is not None:
|
3550
1299
|
setv(
|
3551
1300
|
to_object,
|
3552
|
-
['
|
1301
|
+
['functionDeclarations'],
|
3553
1302
|
[
|
3554
|
-
|
3555
|
-
for item in getv(from_object, ['
|
1303
|
+
_FunctionDeclaration_to_vertex(item, to_object)
|
1304
|
+
for item in getv(from_object, ['function_declarations'])
|
3556
1305
|
],
|
3557
1306
|
)
|
3558
1307
|
|
3559
|
-
if getv(from_object, ['
|
1308
|
+
if getv(from_object, ['retrieval']) is not None:
|
1309
|
+
setv(to_object, ['retrieval'], getv(from_object, ['retrieval']))
|
1310
|
+
|
1311
|
+
if getv(from_object, ['google_search']) is not None:
|
1312
|
+
setv(to_object, ['googleSearch'], getv(from_object, ['google_search']))
|
1313
|
+
|
1314
|
+
if getv(from_object, ['google_search_retrieval']) is not None:
|
3560
1315
|
setv(
|
3561
1316
|
to_object,
|
3562
|
-
['
|
3563
|
-
[
|
3564
|
-
_ModalityTokenCount_from_mldev(item, to_object)
|
3565
|
-
for item in getv(from_object, ['responseTokensDetails'])
|
3566
|
-
],
|
1317
|
+
['googleSearchRetrieval'],
|
1318
|
+
getv(from_object, ['google_search_retrieval']),
|
3567
1319
|
)
|
3568
1320
|
|
3569
|
-
if getv(from_object, ['
|
1321
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
3570
1322
|
setv(
|
3571
1323
|
to_object,
|
3572
|
-
['
|
3573
|
-
[
|
3574
|
-
_ModalityTokenCount_from_mldev(item, to_object)
|
3575
|
-
for item in getv(from_object, ['toolUsePromptTokensDetails'])
|
3576
|
-
],
|
1324
|
+
['enterpriseWebSearch'],
|
1325
|
+
getv(from_object, ['enterprise_web_search']),
|
3577
1326
|
)
|
3578
1327
|
|
1328
|
+
if getv(from_object, ['google_maps']) is not None:
|
1329
|
+
setv(to_object, ['googleMaps'], getv(from_object, ['google_maps']))
|
1330
|
+
|
1331
|
+
if getv(from_object, ['url_context']) is not None:
|
1332
|
+
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
1333
|
+
|
1334
|
+
if getv(from_object, ['computer_use']) is not None:
|
1335
|
+
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
1336
|
+
|
1337
|
+
if getv(from_object, ['code_execution']) is not None:
|
1338
|
+
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
1339
|
+
|
3579
1340
|
return to_object
|
3580
1341
|
|
3581
1342
|
|
@@ -3628,173 +1389,31 @@ def _UsageMetadata_from_vertex(
|
|
3628
1389
|
setv(
|
3629
1390
|
to_object,
|
3630
1391
|
['prompt_tokens_details'],
|
3631
|
-
[
|
3632
|
-
_ModalityTokenCount_from_vertex(item, to_object)
|
3633
|
-
for item in getv(from_object, ['promptTokensDetails'])
|
3634
|
-
],
|
1392
|
+
[item for item in getv(from_object, ['promptTokensDetails'])],
|
3635
1393
|
)
|
3636
1394
|
|
3637
1395
|
if getv(from_object, ['cacheTokensDetails']) is not None:
|
3638
1396
|
setv(
|
3639
1397
|
to_object,
|
3640
1398
|
['cache_tokens_details'],
|
3641
|
-
[
|
3642
|
-
_ModalityTokenCount_from_vertex(item, to_object)
|
3643
|
-
for item in getv(from_object, ['cacheTokensDetails'])
|
3644
|
-
],
|
1399
|
+
[item for item in getv(from_object, ['cacheTokensDetails'])],
|
3645
1400
|
)
|
3646
1401
|
|
3647
1402
|
if getv(from_object, ['candidatesTokensDetails']) is not None:
|
3648
1403
|
setv(
|
3649
1404
|
to_object,
|
3650
1405
|
['response_tokens_details'],
|
3651
|
-
[
|
3652
|
-
_ModalityTokenCount_from_vertex(item, to_object)
|
3653
|
-
for item in getv(from_object, ['candidatesTokensDetails'])
|
3654
|
-
],
|
1406
|
+
[item for item in getv(from_object, ['candidatesTokensDetails'])],
|
3655
1407
|
)
|
3656
1408
|
|
3657
1409
|
if getv(from_object, ['toolUsePromptTokensDetails']) is not None:
|
3658
1410
|
setv(
|
3659
1411
|
to_object,
|
3660
1412
|
['tool_use_prompt_tokens_details'],
|
3661
|
-
[
|
3662
|
-
_ModalityTokenCount_from_vertex(item, to_object)
|
3663
|
-
for item in getv(from_object, ['toolUsePromptTokensDetails'])
|
3664
|
-
],
|
1413
|
+
[item for item in getv(from_object, ['toolUsePromptTokensDetails'])],
|
3665
1414
|
)
|
3666
1415
|
|
3667
1416
|
if getv(from_object, ['trafficType']) is not None:
|
3668
1417
|
setv(to_object, ['traffic_type'], getv(from_object, ['trafficType']))
|
3669
1418
|
|
3670
1419
|
return to_object
|
3671
|
-
|
3672
|
-
|
3673
|
-
def _VideoMetadata_from_mldev(
|
3674
|
-
from_object: Union[dict[str, Any], object],
|
3675
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3676
|
-
) -> dict[str, Any]:
|
3677
|
-
to_object: dict[str, Any] = {}
|
3678
|
-
if getv(from_object, ['fps']) is not None:
|
3679
|
-
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
3680
|
-
|
3681
|
-
if getv(from_object, ['endOffset']) is not None:
|
3682
|
-
setv(to_object, ['end_offset'], getv(from_object, ['endOffset']))
|
3683
|
-
|
3684
|
-
if getv(from_object, ['startOffset']) is not None:
|
3685
|
-
setv(to_object, ['start_offset'], getv(from_object, ['startOffset']))
|
3686
|
-
|
3687
|
-
return to_object
|
3688
|
-
|
3689
|
-
|
3690
|
-
def _VideoMetadata_from_vertex(
|
3691
|
-
from_object: Union[dict[str, Any], object],
|
3692
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3693
|
-
) -> dict[str, Any]:
|
3694
|
-
to_object: dict[str, Any] = {}
|
3695
|
-
if getv(from_object, ['fps']) is not None:
|
3696
|
-
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
3697
|
-
|
3698
|
-
if getv(from_object, ['endOffset']) is not None:
|
3699
|
-
setv(to_object, ['end_offset'], getv(from_object, ['endOffset']))
|
3700
|
-
|
3701
|
-
if getv(from_object, ['startOffset']) is not None:
|
3702
|
-
setv(to_object, ['start_offset'], getv(from_object, ['startOffset']))
|
3703
|
-
|
3704
|
-
return to_object
|
3705
|
-
|
3706
|
-
|
3707
|
-
def _VideoMetadata_to_mldev(
|
3708
|
-
from_object: Union[dict[str, Any], object],
|
3709
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3710
|
-
) -> dict[str, Any]:
|
3711
|
-
to_object: dict[str, Any] = {}
|
3712
|
-
if getv(from_object, ['fps']) is not None:
|
3713
|
-
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
3714
|
-
|
3715
|
-
if getv(from_object, ['end_offset']) is not None:
|
3716
|
-
setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
|
3717
|
-
|
3718
|
-
if getv(from_object, ['start_offset']) is not None:
|
3719
|
-
setv(to_object, ['startOffset'], getv(from_object, ['start_offset']))
|
3720
|
-
|
3721
|
-
return to_object
|
3722
|
-
|
3723
|
-
|
3724
|
-
def _VideoMetadata_to_vertex(
|
3725
|
-
from_object: Union[dict[str, Any], object],
|
3726
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3727
|
-
) -> dict[str, Any]:
|
3728
|
-
to_object: dict[str, Any] = {}
|
3729
|
-
if getv(from_object, ['fps']) is not None:
|
3730
|
-
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
3731
|
-
|
3732
|
-
if getv(from_object, ['end_offset']) is not None:
|
3733
|
-
setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
|
3734
|
-
|
3735
|
-
if getv(from_object, ['start_offset']) is not None:
|
3736
|
-
setv(to_object, ['startOffset'], getv(from_object, ['start_offset']))
|
3737
|
-
|
3738
|
-
return to_object
|
3739
|
-
|
3740
|
-
|
3741
|
-
def _VoiceConfig_to_mldev(
|
3742
|
-
from_object: Union[dict[str, Any], object],
|
3743
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3744
|
-
) -> dict[str, Any]:
|
3745
|
-
to_object: dict[str, Any] = {}
|
3746
|
-
if getv(from_object, ['prebuilt_voice_config']) is not None:
|
3747
|
-
setv(
|
3748
|
-
to_object,
|
3749
|
-
['prebuiltVoiceConfig'],
|
3750
|
-
_PrebuiltVoiceConfig_to_mldev(
|
3751
|
-
getv(from_object, ['prebuilt_voice_config']), to_object
|
3752
|
-
),
|
3753
|
-
)
|
3754
|
-
|
3755
|
-
return to_object
|
3756
|
-
|
3757
|
-
|
3758
|
-
def _VoiceConfig_to_vertex(
|
3759
|
-
from_object: Union[dict[str, Any], object],
|
3760
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3761
|
-
) -> dict[str, Any]:
|
3762
|
-
to_object: dict[str, Any] = {}
|
3763
|
-
if getv(from_object, ['prebuilt_voice_config']) is not None:
|
3764
|
-
setv(
|
3765
|
-
to_object,
|
3766
|
-
['prebuiltVoiceConfig'],
|
3767
|
-
_PrebuiltVoiceConfig_to_vertex(
|
3768
|
-
getv(from_object, ['prebuilt_voice_config']), to_object
|
3769
|
-
),
|
3770
|
-
)
|
3771
|
-
|
3772
|
-
return to_object
|
3773
|
-
|
3774
|
-
|
3775
|
-
def _WeightedPrompt_from_mldev(
|
3776
|
-
from_object: Union[dict[str, Any], object],
|
3777
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3778
|
-
) -> dict[str, Any]:
|
3779
|
-
to_object: dict[str, Any] = {}
|
3780
|
-
if getv(from_object, ['text']) is not None:
|
3781
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
3782
|
-
|
3783
|
-
if getv(from_object, ['weight']) is not None:
|
3784
|
-
setv(to_object, ['weight'], getv(from_object, ['weight']))
|
3785
|
-
|
3786
|
-
return to_object
|
3787
|
-
|
3788
|
-
|
3789
|
-
def _WeightedPrompt_to_mldev(
|
3790
|
-
from_object: Union[dict[str, Any], object],
|
3791
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3792
|
-
) -> dict[str, Any]:
|
3793
|
-
to_object: dict[str, Any] = {}
|
3794
|
-
if getv(from_object, ['text']) is not None:
|
3795
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
3796
|
-
|
3797
|
-
if getv(from_object, ['weight']) is not None:
|
3798
|
-
setv(to_object, ['weight'], getv(from_object, ['weight']))
|
3799
|
-
|
3800
|
-
return to_object
|