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