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