google-genai 1.41.0__py3-none-any.whl → 1.43.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- google/genai/_api_client.py +2 -1
- google/genai/_common.py +213 -77
- google/genai/_live_converters.py +717 -3098
- google/genai/_replay_api_client.py +9 -5
- google/genai/_tokens_converters.py +23 -434
- google/genai/_transformers.py +42 -12
- google/genai/batches.py +125 -1054
- google/genai/caches.py +69 -847
- google/genai/errors.py +9 -2
- google/genai/files.py +12 -171
- google/genai/live.py +10 -11
- google/genai/live_music.py +24 -27
- google/genai/models.py +333 -1828
- google/genai/operations.py +6 -32
- google/genai/tokens.py +2 -12
- google/genai/tunings.py +18 -197
- google/genai/types.py +154 -3
- google/genai/version.py +1 -1
- {google_genai-1.41.0.dist-info → google_genai-1.43.0.dist-info}/METADATA +40 -38
- google_genai-1.43.0.dist-info/RECORD +39 -0
- google_genai-1.41.0.dist-info/RECORD +0 -39
- {google_genai-1.41.0.dist-info → google_genai-1.43.0.dist-info}/WHEEL +0 -0
- {google_genai-1.41.0.dist-info → google_genai-1.43.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.41.0.dist-info → google_genai-1.43.0.dist-info}/top_level.txt +0 -0
google/genai/models.py
CHANGED
@@ -37,11 +37,6 @@ from .pagers import AsyncPager, Pager
|
|
37
37
|
logger = logging.getLogger('google_genai.models')
|
38
38
|
|
39
39
|
|
40
|
-
def _Behavior_to_vertex_enum_validate(enum_value: Any) -> None:
|
41
|
-
if enum_value in set(['UNSPECIFIED', 'BLOCKING', 'NON_BLOCKING']):
|
42
|
-
raise ValueError(f'{enum_value} enum value is not supported in Vertex AI.')
|
43
|
-
|
44
|
-
|
45
40
|
def _PersonGeneration_to_mldev_enum_validate(enum_value: Any) -> None:
|
46
41
|
if enum_value in set(['ALLOW_ALL']):
|
47
42
|
raise ValueError(f'{enum_value} enum value is not supported in Gemini API.')
|
@@ -52,87 +47,11 @@ def _SafetyFilterLevel_to_mldev_enum_validate(enum_value: Any) -> None:
|
|
52
47
|
raise ValueError(f'{enum_value} enum value is not supported in Gemini API.')
|
53
48
|
|
54
49
|
|
55
|
-
def
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
if getv(from_object, ['api_key_string']) is not None:
|
61
|
-
setv(to_object, ['apiKeyString'], getv(from_object, ['api_key_string']))
|
62
|
-
|
63
|
-
return to_object
|
64
|
-
|
65
|
-
|
66
|
-
def _AuthConfig_to_vertex(
|
67
|
-
from_object: Union[dict[str, Any], object],
|
68
|
-
parent_object: Optional[dict[str, Any]] = None,
|
69
|
-
) -> dict[str, Any]:
|
70
|
-
to_object: dict[str, Any] = {}
|
71
|
-
if getv(from_object, ['api_key_config']) is not None:
|
72
|
-
setv(
|
73
|
-
to_object,
|
74
|
-
['apiKeyConfig'],
|
75
|
-
_ApiKeyConfig_to_vertex(
|
76
|
-
getv(from_object, ['api_key_config']), to_object
|
77
|
-
),
|
78
|
-
)
|
79
|
-
|
80
|
-
if getv(from_object, ['auth_type']) is not None:
|
81
|
-
setv(to_object, ['authType'], getv(from_object, ['auth_type']))
|
82
|
-
|
83
|
-
if getv(from_object, ['google_service_account_config']) is not None:
|
84
|
-
setv(
|
85
|
-
to_object,
|
86
|
-
['googleServiceAccountConfig'],
|
87
|
-
getv(from_object, ['google_service_account_config']),
|
88
|
-
)
|
89
|
-
|
90
|
-
if getv(from_object, ['http_basic_auth_config']) is not None:
|
91
|
-
setv(
|
92
|
-
to_object,
|
93
|
-
['httpBasicAuthConfig'],
|
94
|
-
getv(from_object, ['http_basic_auth_config']),
|
95
|
-
)
|
96
|
-
|
97
|
-
if getv(from_object, ['oauth_config']) is not None:
|
98
|
-
setv(to_object, ['oauthConfig'], getv(from_object, ['oauth_config']))
|
99
|
-
|
100
|
-
if getv(from_object, ['oidc_config']) is not None:
|
101
|
-
setv(to_object, ['oidcConfig'], getv(from_object, ['oidc_config']))
|
102
|
-
|
103
|
-
return to_object
|
104
|
-
|
105
|
-
|
106
|
-
def _Blob_from_mldev(
|
107
|
-
from_object: Union[dict[str, Any], object],
|
108
|
-
parent_object: Optional[dict[str, Any]] = None,
|
109
|
-
) -> dict[str, Any]:
|
110
|
-
to_object: dict[str, Any] = {}
|
111
|
-
|
112
|
-
if getv(from_object, ['data']) is not None:
|
113
|
-
setv(to_object, ['data'], getv(from_object, ['data']))
|
114
|
-
|
115
|
-
if getv(from_object, ['mimeType']) is not None:
|
116
|
-
setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
|
117
|
-
|
118
|
-
return to_object
|
119
|
-
|
120
|
-
|
121
|
-
def _Blob_from_vertex(
|
122
|
-
from_object: Union[dict[str, Any], object],
|
123
|
-
parent_object: Optional[dict[str, Any]] = None,
|
124
|
-
) -> dict[str, Any]:
|
125
|
-
to_object: dict[str, Any] = {}
|
126
|
-
if getv(from_object, ['displayName']) is not None:
|
127
|
-
setv(to_object, ['display_name'], getv(from_object, ['displayName']))
|
128
|
-
|
129
|
-
if getv(from_object, ['data']) is not None:
|
130
|
-
setv(to_object, ['data'], getv(from_object, ['data']))
|
131
|
-
|
132
|
-
if getv(from_object, ['mimeType']) is not None:
|
133
|
-
setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
|
134
|
-
|
135
|
-
return to_object
|
50
|
+
def _VideoGenerationReferenceType_to_mldev_enum_validate(
|
51
|
+
enum_value: Any,
|
52
|
+
) -> None:
|
53
|
+
if enum_value in set(['STYLE']):
|
54
|
+
raise ValueError(f'{enum_value} enum value is not supported in Gemini API.')
|
136
55
|
|
137
56
|
|
138
57
|
def _Blob_to_mldev(
|
@@ -152,34 +71,13 @@ def _Blob_to_mldev(
|
|
152
71
|
return to_object
|
153
72
|
|
154
73
|
|
155
|
-
def _Blob_to_vertex(
|
156
|
-
from_object: Union[dict[str, Any], object],
|
157
|
-
parent_object: Optional[dict[str, Any]] = None,
|
158
|
-
) -> dict[str, Any]:
|
159
|
-
to_object: dict[str, Any] = {}
|
160
|
-
if getv(from_object, ['display_name']) is not None:
|
161
|
-
setv(to_object, ['displayName'], getv(from_object, ['display_name']))
|
162
|
-
|
163
|
-
if getv(from_object, ['data']) is not None:
|
164
|
-
setv(to_object, ['data'], getv(from_object, ['data']))
|
165
|
-
|
166
|
-
if getv(from_object, ['mime_type']) is not None:
|
167
|
-
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
168
|
-
|
169
|
-
return to_object
|
170
|
-
|
171
|
-
|
172
74
|
def _Candidate_from_mldev(
|
173
75
|
from_object: Union[dict[str, Any], object],
|
174
76
|
parent_object: Optional[dict[str, Any]] = None,
|
175
77
|
) -> dict[str, Any]:
|
176
78
|
to_object: dict[str, Any] = {}
|
177
79
|
if getv(from_object, ['content']) is not None:
|
178
|
-
setv(
|
179
|
-
to_object,
|
180
|
-
['content'],
|
181
|
-
_Content_from_mldev(getv(from_object, ['content']), to_object),
|
182
|
-
)
|
80
|
+
setv(to_object, ['content'], getv(from_object, ['content']))
|
183
81
|
|
184
82
|
if getv(from_object, ['citationMetadata']) is not None:
|
185
83
|
setv(
|
@@ -200,9 +98,7 @@ def _Candidate_from_mldev(
|
|
200
98
|
setv(
|
201
99
|
to_object,
|
202
100
|
['url_context_metadata'],
|
203
|
-
|
204
|
-
getv(from_object, ['urlContextMetadata']), to_object
|
205
|
-
),
|
101
|
+
getv(from_object, ['urlContextMetadata']),
|
206
102
|
)
|
207
103
|
|
208
104
|
if getv(from_object, ['avgLogprobs']) is not None:
|
@@ -222,83 +118,12 @@ def _Candidate_from_mldev(
|
|
222
118
|
setv(to_object, ['logprobs_result'], getv(from_object, ['logprobsResult']))
|
223
119
|
|
224
120
|
if getv(from_object, ['safetyRatings']) is not None:
|
225
|
-
setv(to_object, ['safety_ratings'], getv(from_object, ['safetyRatings']))
|
226
|
-
|
227
|
-
return to_object
|
228
|
-
|
229
|
-
|
230
|
-
def _Candidate_from_vertex(
|
231
|
-
from_object: Union[dict[str, Any], object],
|
232
|
-
parent_object: Optional[dict[str, Any]] = None,
|
233
|
-
) -> dict[str, Any]:
|
234
|
-
to_object: dict[str, Any] = {}
|
235
|
-
if getv(from_object, ['content']) is not None:
|
236
|
-
setv(
|
237
|
-
to_object,
|
238
|
-
['content'],
|
239
|
-
_Content_from_vertex(getv(from_object, ['content']), to_object),
|
240
|
-
)
|
241
|
-
|
242
|
-
if getv(from_object, ['citationMetadata']) is not None:
|
243
|
-
setv(
|
244
|
-
to_object,
|
245
|
-
['citation_metadata'],
|
246
|
-
_CitationMetadata_from_vertex(
|
247
|
-
getv(from_object, ['citationMetadata']), to_object
|
248
|
-
),
|
249
|
-
)
|
250
|
-
|
251
|
-
if getv(from_object, ['finishMessage']) is not None:
|
252
|
-
setv(to_object, ['finish_message'], getv(from_object, ['finishMessage']))
|
253
|
-
|
254
|
-
if getv(from_object, ['finishReason']) is not None:
|
255
|
-
setv(to_object, ['finish_reason'], getv(from_object, ['finishReason']))
|
256
|
-
|
257
|
-
if getv(from_object, ['urlContextMetadata']) is not None:
|
258
|
-
setv(
|
259
|
-
to_object,
|
260
|
-
['url_context_metadata'],
|
261
|
-
_UrlContextMetadata_from_vertex(
|
262
|
-
getv(from_object, ['urlContextMetadata']), to_object
|
263
|
-
),
|
264
|
-
)
|
265
|
-
|
266
|
-
if getv(from_object, ['avgLogprobs']) is not None:
|
267
|
-
setv(to_object, ['avg_logprobs'], getv(from_object, ['avgLogprobs']))
|
268
|
-
|
269
|
-
if getv(from_object, ['groundingMetadata']) is not None:
|
270
121
|
setv(
|
271
122
|
to_object,
|
272
|
-
['
|
273
|
-
getv(from_object, ['
|
123
|
+
['safety_ratings'],
|
124
|
+
[item for item in getv(from_object, ['safetyRatings'])],
|
274
125
|
)
|
275
126
|
|
276
|
-
if getv(from_object, ['index']) is not None:
|
277
|
-
setv(to_object, ['index'], getv(from_object, ['index']))
|
278
|
-
|
279
|
-
if getv(from_object, ['logprobsResult']) is not None:
|
280
|
-
setv(to_object, ['logprobs_result'], getv(from_object, ['logprobsResult']))
|
281
|
-
|
282
|
-
if getv(from_object, ['safetyRatings']) is not None:
|
283
|
-
setv(to_object, ['safety_ratings'], getv(from_object, ['safetyRatings']))
|
284
|
-
|
285
|
-
return to_object
|
286
|
-
|
287
|
-
|
288
|
-
def _Checkpoint_from_vertex(
|
289
|
-
from_object: Union[dict[str, Any], object],
|
290
|
-
parent_object: Optional[dict[str, Any]] = None,
|
291
|
-
) -> dict[str, Any]:
|
292
|
-
to_object: dict[str, Any] = {}
|
293
|
-
if getv(from_object, ['checkpointId']) is not None:
|
294
|
-
setv(to_object, ['checkpoint_id'], getv(from_object, ['checkpointId']))
|
295
|
-
|
296
|
-
if getv(from_object, ['epoch']) is not None:
|
297
|
-
setv(to_object, ['epoch'], getv(from_object, ['epoch']))
|
298
|
-
|
299
|
-
if getv(from_object, ['step']) is not None:
|
300
|
-
setv(to_object, ['step'], getv(from_object, ['step']))
|
301
|
-
|
302
127
|
return to_object
|
303
128
|
|
304
129
|
|
@@ -308,18 +133,11 @@ def _CitationMetadata_from_mldev(
|
|
308
133
|
) -> dict[str, Any]:
|
309
134
|
to_object: dict[str, Any] = {}
|
310
135
|
if getv(from_object, ['citationSources']) is not None:
|
311
|
-
setv(
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
def _CitationMetadata_from_vertex(
|
317
|
-
from_object: Union[dict[str, Any], object],
|
318
|
-
parent_object: Optional[dict[str, Any]] = None,
|
319
|
-
) -> dict[str, Any]:
|
320
|
-
to_object: dict[str, Any] = {}
|
321
|
-
if getv(from_object, ['citations']) is not None:
|
322
|
-
setv(to_object, ['citations'], getv(from_object, ['citations']))
|
136
|
+
setv(
|
137
|
+
to_object,
|
138
|
+
['citations'],
|
139
|
+
[item for item in getv(from_object, ['citationSources'])],
|
140
|
+
)
|
323
141
|
|
324
142
|
return to_object
|
325
143
|
|
@@ -341,10 +159,7 @@ def _ComputeTokensParameters_to_vertex(
|
|
341
159
|
setv(
|
342
160
|
to_object,
|
343
161
|
['contents'],
|
344
|
-
[
|
345
|
-
_Content_to_vertex(item, to_object)
|
346
|
-
for item in t.t_contents(getv(from_object, ['contents']))
|
347
|
-
],
|
162
|
+
[item for item in t.t_contents(getv(from_object, ['contents']))],
|
348
163
|
)
|
349
164
|
|
350
165
|
return to_object
|
@@ -361,42 +176,10 @@ def _ComputeTokensResponse_from_vertex(
|
|
361
176
|
)
|
362
177
|
|
363
178
|
if getv(from_object, ['tokensInfo']) is not None:
|
364
|
-
setv(to_object, ['tokens_info'], getv(from_object, ['tokensInfo']))
|
365
|
-
|
366
|
-
return to_object
|
367
|
-
|
368
|
-
|
369
|
-
def _ComputerUse_to_mldev(
|
370
|
-
from_object: Union[dict[str, Any], object],
|
371
|
-
parent_object: Optional[dict[str, Any]] = None,
|
372
|
-
) -> dict[str, Any]:
|
373
|
-
to_object: dict[str, Any] = {}
|
374
|
-
if getv(from_object, ['environment']) is not None:
|
375
|
-
setv(to_object, ['environment'], getv(from_object, ['environment']))
|
376
|
-
|
377
|
-
if getv(from_object, ['excluded_predefined_functions']) is not None:
|
378
179
|
setv(
|
379
180
|
to_object,
|
380
|
-
['
|
381
|
-
getv(from_object, ['
|
382
|
-
)
|
383
|
-
|
384
|
-
return to_object
|
385
|
-
|
386
|
-
|
387
|
-
def _ComputerUse_to_vertex(
|
388
|
-
from_object: Union[dict[str, Any], object],
|
389
|
-
parent_object: Optional[dict[str, Any]] = None,
|
390
|
-
) -> dict[str, Any]:
|
391
|
-
to_object: dict[str, Any] = {}
|
392
|
-
if getv(from_object, ['environment']) is not None:
|
393
|
-
setv(to_object, ['environment'], getv(from_object, ['environment']))
|
394
|
-
|
395
|
-
if getv(from_object, ['excluded_predefined_functions']) is not None:
|
396
|
-
setv(
|
397
|
-
to_object,
|
398
|
-
['excludedPredefinedFunctions'],
|
399
|
-
getv(from_object, ['excluded_predefined_functions']),
|
181
|
+
['tokens_info'],
|
182
|
+
[item for item in getv(from_object, ['tokensInfo'])],
|
400
183
|
)
|
401
184
|
|
402
185
|
return to_object
|
@@ -416,17 +199,6 @@ def _ContentEmbeddingStatistics_from_vertex(
|
|
416
199
|
return to_object
|
417
200
|
|
418
201
|
|
419
|
-
def _ContentEmbedding_from_mldev(
|
420
|
-
from_object: Union[dict[str, Any], object],
|
421
|
-
parent_object: Optional[dict[str, Any]] = None,
|
422
|
-
) -> dict[str, Any]:
|
423
|
-
to_object: dict[str, Any] = {}
|
424
|
-
if getv(from_object, ['values']) is not None:
|
425
|
-
setv(to_object, ['values'], getv(from_object, ['values']))
|
426
|
-
|
427
|
-
return to_object
|
428
|
-
|
429
|
-
|
430
202
|
def _ContentEmbedding_from_vertex(
|
431
203
|
from_object: Union[dict[str, Any], object],
|
432
204
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -447,48 +219,6 @@ def _ContentEmbedding_from_vertex(
|
|
447
219
|
return to_object
|
448
220
|
|
449
221
|
|
450
|
-
def _Content_from_mldev(
|
451
|
-
from_object: Union[dict[str, Any], object],
|
452
|
-
parent_object: Optional[dict[str, Any]] = None,
|
453
|
-
) -> dict[str, Any]:
|
454
|
-
to_object: dict[str, Any] = {}
|
455
|
-
if getv(from_object, ['parts']) is not None:
|
456
|
-
setv(
|
457
|
-
to_object,
|
458
|
-
['parts'],
|
459
|
-
[
|
460
|
-
_Part_from_mldev(item, to_object)
|
461
|
-
for item in getv(from_object, ['parts'])
|
462
|
-
],
|
463
|
-
)
|
464
|
-
|
465
|
-
if getv(from_object, ['role']) is not None:
|
466
|
-
setv(to_object, ['role'], getv(from_object, ['role']))
|
467
|
-
|
468
|
-
return to_object
|
469
|
-
|
470
|
-
|
471
|
-
def _Content_from_vertex(
|
472
|
-
from_object: Union[dict[str, Any], object],
|
473
|
-
parent_object: Optional[dict[str, Any]] = None,
|
474
|
-
) -> dict[str, Any]:
|
475
|
-
to_object: dict[str, Any] = {}
|
476
|
-
if getv(from_object, ['parts']) is not None:
|
477
|
-
setv(
|
478
|
-
to_object,
|
479
|
-
['parts'],
|
480
|
-
[
|
481
|
-
_Part_from_vertex(item, to_object)
|
482
|
-
for item in getv(from_object, ['parts'])
|
483
|
-
],
|
484
|
-
)
|
485
|
-
|
486
|
-
if getv(from_object, ['role']) is not None:
|
487
|
-
setv(to_object, ['role'], getv(from_object, ['role']))
|
488
|
-
|
489
|
-
return to_object
|
490
|
-
|
491
|
-
|
492
222
|
def _Content_to_mldev(
|
493
223
|
from_object: Union[dict[str, Any], object],
|
494
224
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -510,27 +240,6 @@ def _Content_to_mldev(
|
|
510
240
|
return to_object
|
511
241
|
|
512
242
|
|
513
|
-
def _Content_to_vertex(
|
514
|
-
from_object: Union[dict[str, Any], object],
|
515
|
-
parent_object: Optional[dict[str, Any]] = None,
|
516
|
-
) -> dict[str, Any]:
|
517
|
-
to_object: dict[str, Any] = {}
|
518
|
-
if getv(from_object, ['parts']) is not None:
|
519
|
-
setv(
|
520
|
-
to_object,
|
521
|
-
['parts'],
|
522
|
-
[
|
523
|
-
_Part_to_vertex(item, to_object)
|
524
|
-
for item in getv(from_object, ['parts'])
|
525
|
-
],
|
526
|
-
)
|
527
|
-
|
528
|
-
if getv(from_object, ['role']) is not None:
|
529
|
-
setv(to_object, ['role'], getv(from_object, ['role']))
|
530
|
-
|
531
|
-
return to_object
|
532
|
-
|
533
|
-
|
534
243
|
def _ControlReferenceConfig_to_vertex(
|
535
244
|
from_object: Union[dict[str, Any], object],
|
536
245
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -581,9 +290,7 @@ def _CountTokensConfig_to_vertex(
|
|
581
290
|
setv(
|
582
291
|
parent_object,
|
583
292
|
['systemInstruction'],
|
584
|
-
|
585
|
-
t.t_content(getv(from_object, ['system_instruction'])), to_object
|
586
|
-
),
|
293
|
+
t.t_content(getv(from_object, ['system_instruction'])),
|
587
294
|
)
|
588
295
|
|
589
296
|
if getv(from_object, ['tools']) is not None:
|
@@ -600,7 +307,9 @@ def _CountTokensConfig_to_vertex(
|
|
600
307
|
setv(
|
601
308
|
parent_object,
|
602
309
|
['generationConfig'],
|
603
|
-
|
310
|
+
_GenerationConfig_to_vertex(
|
311
|
+
getv(from_object, ['generation_config']), to_object
|
312
|
+
),
|
604
313
|
)
|
605
314
|
|
606
315
|
return to_object
|
@@ -652,10 +361,7 @@ def _CountTokensParameters_to_vertex(
|
|
652
361
|
setv(
|
653
362
|
to_object,
|
654
363
|
['contents'],
|
655
|
-
[
|
656
|
-
_Content_to_vertex(item, to_object)
|
657
|
-
for item in t.t_contents(getv(from_object, ['contents']))
|
658
|
-
],
|
364
|
+
[item for item in t.t_contents(getv(from_object, ['contents']))],
|
659
365
|
)
|
660
366
|
|
661
367
|
if getv(from_object, ['config']) is not None:
|
@@ -761,53 +467,17 @@ def _DeleteModelResponse_from_vertex(
|
|
761
467
|
return to_object
|
762
468
|
|
763
469
|
|
764
|
-
def
|
470
|
+
def _EditImageConfig_to_vertex(
|
765
471
|
from_object: Union[dict[str, Any], object],
|
766
472
|
parent_object: Optional[dict[str, Any]] = None,
|
767
473
|
) -> dict[str, Any]:
|
768
474
|
to_object: dict[str, Any] = {}
|
769
|
-
if getv(from_object, ['mode']) is not None:
|
770
|
-
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
771
475
|
|
772
|
-
if getv(from_object, ['
|
476
|
+
if getv(from_object, ['output_gcs_uri']) is not None:
|
773
477
|
setv(
|
774
|
-
|
775
|
-
['
|
776
|
-
getv(from_object, ['
|
777
|
-
)
|
778
|
-
|
779
|
-
return to_object
|
780
|
-
|
781
|
-
|
782
|
-
def _DynamicRetrievalConfig_to_vertex(
|
783
|
-
from_object: Union[dict[str, Any], object],
|
784
|
-
parent_object: Optional[dict[str, Any]] = None,
|
785
|
-
) -> dict[str, Any]:
|
786
|
-
to_object: dict[str, Any] = {}
|
787
|
-
if getv(from_object, ['mode']) is not None:
|
788
|
-
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
789
|
-
|
790
|
-
if getv(from_object, ['dynamic_threshold']) is not None:
|
791
|
-
setv(
|
792
|
-
to_object,
|
793
|
-
['dynamicThreshold'],
|
794
|
-
getv(from_object, ['dynamic_threshold']),
|
795
|
-
)
|
796
|
-
|
797
|
-
return to_object
|
798
|
-
|
799
|
-
|
800
|
-
def _EditImageConfig_to_vertex(
|
801
|
-
from_object: Union[dict[str, Any], object],
|
802
|
-
parent_object: Optional[dict[str, Any]] = None,
|
803
|
-
) -> dict[str, Any]:
|
804
|
-
to_object: dict[str, Any] = {}
|
805
|
-
|
806
|
-
if getv(from_object, ['output_gcs_uri']) is not None:
|
807
|
-
setv(
|
808
|
-
parent_object,
|
809
|
-
['parameters', 'storageUri'],
|
810
|
-
getv(from_object, ['output_gcs_uri']),
|
478
|
+
parent_object,
|
479
|
+
['parameters', 'storageUri'],
|
480
|
+
getv(from_object, ['output_gcs_uri']),
|
811
481
|
)
|
812
482
|
|
813
483
|
if getv(from_object, ['negative_prompt']) is not None:
|
@@ -897,6 +567,9 @@ def _EditImageConfig_to_vertex(
|
|
897
567
|
getv(from_object, ['add_watermark']),
|
898
568
|
)
|
899
569
|
|
570
|
+
if getv(from_object, ['labels']) is not None:
|
571
|
+
setv(parent_object, ['labels'], getv(from_object, ['labels']))
|
572
|
+
|
900
573
|
if getv(from_object, ['edit_mode']) is not None:
|
901
574
|
setv(
|
902
575
|
parent_object,
|
@@ -1041,30 +714,6 @@ def _EmbedContentConfig_to_vertex(
|
|
1041
714
|
return to_object
|
1042
715
|
|
1043
716
|
|
1044
|
-
def _EmbedContentMetadata_from_mldev(
|
1045
|
-
from_object: Union[dict[str, Any], object],
|
1046
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1047
|
-
) -> dict[str, Any]:
|
1048
|
-
to_object: dict[str, Any] = {}
|
1049
|
-
|
1050
|
-
return to_object
|
1051
|
-
|
1052
|
-
|
1053
|
-
def _EmbedContentMetadata_from_vertex(
|
1054
|
-
from_object: Union[dict[str, Any], object],
|
1055
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1056
|
-
) -> dict[str, Any]:
|
1057
|
-
to_object: dict[str, Any] = {}
|
1058
|
-
if getv(from_object, ['billableCharacterCount']) is not None:
|
1059
|
-
setv(
|
1060
|
-
to_object,
|
1061
|
-
['billable_character_count'],
|
1062
|
-
getv(from_object, ['billableCharacterCount']),
|
1063
|
-
)
|
1064
|
-
|
1065
|
-
return to_object
|
1066
|
-
|
1067
|
-
|
1068
717
|
def _EmbedContentParameters_to_mldev(
|
1069
718
|
api_client: BaseApiClient,
|
1070
719
|
from_object: Union[dict[str, Any], object],
|
@@ -1082,7 +731,12 @@ def _EmbedContentParameters_to_mldev(
|
|
1082
731
|
setv(
|
1083
732
|
to_object,
|
1084
733
|
['requests[]', 'content'],
|
1085
|
-
|
734
|
+
[
|
735
|
+
item
|
736
|
+
for item in t.t_contents_for_embed(
|
737
|
+
api_client, getv(from_object, ['contents'])
|
738
|
+
)
|
739
|
+
],
|
1086
740
|
)
|
1087
741
|
|
1088
742
|
if getv(from_object, ['config']) is not None:
|
@@ -1113,7 +767,12 @@ def _EmbedContentParameters_to_vertex(
|
|
1113
767
|
setv(
|
1114
768
|
to_object,
|
1115
769
|
['instances[]', 'content'],
|
1116
|
-
|
770
|
+
[
|
771
|
+
item
|
772
|
+
for item in t.t_contents_for_embed(
|
773
|
+
api_client, getv(from_object, ['contents'])
|
774
|
+
)
|
775
|
+
],
|
1117
776
|
)
|
1118
777
|
|
1119
778
|
if getv(from_object, ['config']) is not None:
|
@@ -1136,20 +795,11 @@ def _EmbedContentResponse_from_mldev(
|
|
1136
795
|
setv(
|
1137
796
|
to_object,
|
1138
797
|
['embeddings'],
|
1139
|
-
[
|
1140
|
-
_ContentEmbedding_from_mldev(item, to_object)
|
1141
|
-
for item in getv(from_object, ['embeddings'])
|
1142
|
-
],
|
798
|
+
[item for item in getv(from_object, ['embeddings'])],
|
1143
799
|
)
|
1144
800
|
|
1145
801
|
if getv(from_object, ['metadata']) is not None:
|
1146
|
-
setv(
|
1147
|
-
to_object,
|
1148
|
-
['metadata'],
|
1149
|
-
_EmbedContentMetadata_from_mldev(
|
1150
|
-
getv(from_object, ['metadata']), to_object
|
1151
|
-
),
|
1152
|
-
)
|
802
|
+
setv(to_object, ['metadata'], getv(from_object, ['metadata']))
|
1153
803
|
|
1154
804
|
return to_object
|
1155
805
|
|
@@ -1175,13 +825,7 @@ def _EmbedContentResponse_from_vertex(
|
|
1175
825
|
)
|
1176
826
|
|
1177
827
|
if getv(from_object, ['metadata']) is not None:
|
1178
|
-
setv(
|
1179
|
-
to_object,
|
1180
|
-
['metadata'],
|
1181
|
-
_EmbedContentMetadata_from_vertex(
|
1182
|
-
getv(from_object, ['metadata']), to_object
|
1183
|
-
),
|
1184
|
-
)
|
828
|
+
setv(to_object, ['metadata'], getv(from_object, ['metadata']))
|
1185
829
|
|
1186
830
|
return to_object
|
1187
831
|
|
@@ -1202,63 +846,6 @@ def _Endpoint_from_vertex(
|
|
1202
846
|
return to_object
|
1203
847
|
|
1204
848
|
|
1205
|
-
def _EnterpriseWebSearch_to_vertex(
|
1206
|
-
from_object: Union[dict[str, Any], object],
|
1207
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1208
|
-
) -> dict[str, Any]:
|
1209
|
-
to_object: dict[str, Any] = {}
|
1210
|
-
if getv(from_object, ['exclude_domains']) is not None:
|
1211
|
-
setv(to_object, ['excludeDomains'], getv(from_object, ['exclude_domains']))
|
1212
|
-
|
1213
|
-
return to_object
|
1214
|
-
|
1215
|
-
|
1216
|
-
def _EntityLabel_from_vertex(
|
1217
|
-
from_object: Union[dict[str, Any], object],
|
1218
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1219
|
-
) -> dict[str, Any]:
|
1220
|
-
to_object: dict[str, Any] = {}
|
1221
|
-
if getv(from_object, ['label']) is not None:
|
1222
|
-
setv(to_object, ['label'], getv(from_object, ['label']))
|
1223
|
-
|
1224
|
-
if getv(from_object, ['score']) is not None:
|
1225
|
-
setv(to_object, ['score'], getv(from_object, ['score']))
|
1226
|
-
|
1227
|
-
return to_object
|
1228
|
-
|
1229
|
-
|
1230
|
-
def _FileData_from_mldev(
|
1231
|
-
from_object: Union[dict[str, Any], object],
|
1232
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1233
|
-
) -> dict[str, Any]:
|
1234
|
-
to_object: dict[str, Any] = {}
|
1235
|
-
|
1236
|
-
if getv(from_object, ['fileUri']) is not None:
|
1237
|
-
setv(to_object, ['file_uri'], getv(from_object, ['fileUri']))
|
1238
|
-
|
1239
|
-
if getv(from_object, ['mimeType']) is not None:
|
1240
|
-
setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
|
1241
|
-
|
1242
|
-
return to_object
|
1243
|
-
|
1244
|
-
|
1245
|
-
def _FileData_from_vertex(
|
1246
|
-
from_object: Union[dict[str, Any], object],
|
1247
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1248
|
-
) -> dict[str, Any]:
|
1249
|
-
to_object: dict[str, Any] = {}
|
1250
|
-
if getv(from_object, ['displayName']) is not None:
|
1251
|
-
setv(to_object, ['display_name'], getv(from_object, ['displayName']))
|
1252
|
-
|
1253
|
-
if getv(from_object, ['fileUri']) is not None:
|
1254
|
-
setv(to_object, ['file_uri'], getv(from_object, ['fileUri']))
|
1255
|
-
|
1256
|
-
if getv(from_object, ['mimeType']) is not None:
|
1257
|
-
setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
|
1258
|
-
|
1259
|
-
return to_object
|
1260
|
-
|
1261
|
-
|
1262
849
|
def _FileData_to_mldev(
|
1263
850
|
from_object: Union[dict[str, Any], object],
|
1264
851
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -1276,164 +863,6 @@ def _FileData_to_mldev(
|
|
1276
863
|
return to_object
|
1277
864
|
|
1278
865
|
|
1279
|
-
def _FileData_to_vertex(
|
1280
|
-
from_object: Union[dict[str, Any], object],
|
1281
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1282
|
-
) -> dict[str, Any]:
|
1283
|
-
to_object: dict[str, Any] = {}
|
1284
|
-
if getv(from_object, ['display_name']) is not None:
|
1285
|
-
setv(to_object, ['displayName'], getv(from_object, ['display_name']))
|
1286
|
-
|
1287
|
-
if getv(from_object, ['file_uri']) is not None:
|
1288
|
-
setv(to_object, ['fileUri'], getv(from_object, ['file_uri']))
|
1289
|
-
|
1290
|
-
if getv(from_object, ['mime_type']) is not None:
|
1291
|
-
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
1292
|
-
|
1293
|
-
return to_object
|
1294
|
-
|
1295
|
-
|
1296
|
-
def _FunctionCall_from_mldev(
|
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, ['id']) is not None:
|
1302
|
-
setv(to_object, ['id'], getv(from_object, ['id']))
|
1303
|
-
|
1304
|
-
if getv(from_object, ['args']) is not None:
|
1305
|
-
setv(to_object, ['args'], getv(from_object, ['args']))
|
1306
|
-
|
1307
|
-
if getv(from_object, ['name']) is not None:
|
1308
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
1309
|
-
|
1310
|
-
return to_object
|
1311
|
-
|
1312
|
-
|
1313
|
-
def _FunctionCall_from_vertex(
|
1314
|
-
from_object: Union[dict[str, Any], object],
|
1315
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1316
|
-
) -> dict[str, Any]:
|
1317
|
-
to_object: dict[str, Any] = {}
|
1318
|
-
if getv(from_object, ['id']) is not None:
|
1319
|
-
setv(to_object, ['id'], getv(from_object, ['id']))
|
1320
|
-
|
1321
|
-
if getv(from_object, ['args']) is not None:
|
1322
|
-
setv(to_object, ['args'], getv(from_object, ['args']))
|
1323
|
-
|
1324
|
-
if getv(from_object, ['name']) is not None:
|
1325
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
1326
|
-
|
1327
|
-
return to_object
|
1328
|
-
|
1329
|
-
|
1330
|
-
def _FunctionCall_to_mldev(
|
1331
|
-
from_object: Union[dict[str, Any], object],
|
1332
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1333
|
-
) -> dict[str, Any]:
|
1334
|
-
to_object: dict[str, Any] = {}
|
1335
|
-
if getv(from_object, ['id']) is not None:
|
1336
|
-
setv(to_object, ['id'], getv(from_object, ['id']))
|
1337
|
-
|
1338
|
-
if getv(from_object, ['args']) is not None:
|
1339
|
-
setv(to_object, ['args'], getv(from_object, ['args']))
|
1340
|
-
|
1341
|
-
if getv(from_object, ['name']) is not None:
|
1342
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
1343
|
-
|
1344
|
-
return to_object
|
1345
|
-
|
1346
|
-
|
1347
|
-
def _FunctionCall_to_vertex(
|
1348
|
-
from_object: Union[dict[str, Any], object],
|
1349
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1350
|
-
) -> dict[str, Any]:
|
1351
|
-
to_object: dict[str, Any] = {}
|
1352
|
-
if getv(from_object, ['id']) is not None:
|
1353
|
-
setv(to_object, ['id'], getv(from_object, ['id']))
|
1354
|
-
|
1355
|
-
if getv(from_object, ['args']) is not None:
|
1356
|
-
setv(to_object, ['args'], getv(from_object, ['args']))
|
1357
|
-
|
1358
|
-
if getv(from_object, ['name']) is not None:
|
1359
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
1360
|
-
|
1361
|
-
return to_object
|
1362
|
-
|
1363
|
-
|
1364
|
-
def _FunctionCallingConfig_to_mldev(
|
1365
|
-
from_object: Union[dict[str, Any], object],
|
1366
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1367
|
-
) -> dict[str, Any]:
|
1368
|
-
to_object: dict[str, Any] = {}
|
1369
|
-
if getv(from_object, ['mode']) is not None:
|
1370
|
-
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
1371
|
-
|
1372
|
-
if getv(from_object, ['allowed_function_names']) is not None:
|
1373
|
-
setv(
|
1374
|
-
to_object,
|
1375
|
-
['allowedFunctionNames'],
|
1376
|
-
getv(from_object, ['allowed_function_names']),
|
1377
|
-
)
|
1378
|
-
|
1379
|
-
return to_object
|
1380
|
-
|
1381
|
-
|
1382
|
-
def _FunctionCallingConfig_to_vertex(
|
1383
|
-
from_object: Union[dict[str, Any], object],
|
1384
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1385
|
-
) -> dict[str, Any]:
|
1386
|
-
to_object: dict[str, Any] = {}
|
1387
|
-
if getv(from_object, ['mode']) is not None:
|
1388
|
-
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
1389
|
-
|
1390
|
-
if getv(from_object, ['allowed_function_names']) is not None:
|
1391
|
-
setv(
|
1392
|
-
to_object,
|
1393
|
-
['allowedFunctionNames'],
|
1394
|
-
getv(from_object, ['allowed_function_names']),
|
1395
|
-
)
|
1396
|
-
|
1397
|
-
return to_object
|
1398
|
-
|
1399
|
-
|
1400
|
-
def _FunctionDeclaration_to_mldev(
|
1401
|
-
from_object: Union[dict[str, Any], object],
|
1402
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1403
|
-
) -> dict[str, Any]:
|
1404
|
-
to_object: dict[str, Any] = {}
|
1405
|
-
if getv(from_object, ['behavior']) is not None:
|
1406
|
-
setv(to_object, ['behavior'], getv(from_object, ['behavior']))
|
1407
|
-
|
1408
|
-
if getv(from_object, ['description']) is not None:
|
1409
|
-
setv(to_object, ['description'], getv(from_object, ['description']))
|
1410
|
-
|
1411
|
-
if getv(from_object, ['name']) is not None:
|
1412
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
1413
|
-
|
1414
|
-
if getv(from_object, ['parameters']) is not None:
|
1415
|
-
setv(to_object, ['parameters'], getv(from_object, ['parameters']))
|
1416
|
-
|
1417
|
-
if getv(from_object, ['parameters_json_schema']) is not None:
|
1418
|
-
setv(
|
1419
|
-
to_object,
|
1420
|
-
['parametersJsonSchema'],
|
1421
|
-
getv(from_object, ['parameters_json_schema']),
|
1422
|
-
)
|
1423
|
-
|
1424
|
-
if getv(from_object, ['response']) is not None:
|
1425
|
-
setv(to_object, ['response'], getv(from_object, ['response']))
|
1426
|
-
|
1427
|
-
if getv(from_object, ['response_json_schema']) is not None:
|
1428
|
-
setv(
|
1429
|
-
to_object,
|
1430
|
-
['responseJsonSchema'],
|
1431
|
-
getv(from_object, ['response_json_schema']),
|
1432
|
-
)
|
1433
|
-
|
1434
|
-
return to_object
|
1435
|
-
|
1436
|
-
|
1437
866
|
def _FunctionDeclaration_to_vertex(
|
1438
867
|
from_object: Union[dict[str, Any], object],
|
1439
868
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -1543,10 +972,7 @@ def _GenerateContentConfig_to_mldev(
|
|
1543
972
|
setv(
|
1544
973
|
to_object,
|
1545
974
|
['responseSchema'],
|
1546
|
-
|
1547
|
-
t.t_schema(api_client, getv(from_object, ['response_schema'])),
|
1548
|
-
to_object,
|
1549
|
-
),
|
975
|
+
t.t_schema(api_client, getv(from_object, ['response_schema'])),
|
1550
976
|
)
|
1551
977
|
|
1552
978
|
if getv(from_object, ['response_json_schema']) is not None:
|
@@ -1585,11 +1011,7 @@ def _GenerateContentConfig_to_mldev(
|
|
1585
1011
|
)
|
1586
1012
|
|
1587
1013
|
if getv(from_object, ['tool_config']) is not None:
|
1588
|
-
setv(
|
1589
|
-
parent_object,
|
1590
|
-
['toolConfig'],
|
1591
|
-
_ToolConfig_to_mldev(getv(from_object, ['tool_config']), to_object),
|
1592
|
-
)
|
1014
|
+
setv(parent_object, ['toolConfig'], getv(from_object, ['tool_config']))
|
1593
1015
|
|
1594
1016
|
if getv(from_object, ['labels']) is not None:
|
1595
1017
|
raise ValueError('labels parameter is not supported in Gemini API.')
|
@@ -1619,9 +1041,7 @@ def _GenerateContentConfig_to_mldev(
|
|
1619
1041
|
setv(
|
1620
1042
|
to_object,
|
1621
1043
|
['speechConfig'],
|
1622
|
-
|
1623
|
-
t.t_speech_config(getv(from_object, ['speech_config'])), to_object
|
1624
|
-
),
|
1044
|
+
t.t_speech_config(getv(from_object, ['speech_config'])),
|
1625
1045
|
)
|
1626
1046
|
|
1627
1047
|
if getv(from_object, ['audio_timestamp']) is not None:
|
@@ -1630,20 +1050,10 @@ def _GenerateContentConfig_to_mldev(
|
|
1630
1050
|
)
|
1631
1051
|
|
1632
1052
|
if getv(from_object, ['thinking_config']) is not None:
|
1633
|
-
setv(
|
1634
|
-
to_object,
|
1635
|
-
['thinkingConfig'],
|
1636
|
-
_ThinkingConfig_to_mldev(
|
1637
|
-
getv(from_object, ['thinking_config']), to_object
|
1638
|
-
),
|
1639
|
-
)
|
1053
|
+
setv(to_object, ['thinkingConfig'], getv(from_object, ['thinking_config']))
|
1640
1054
|
|
1641
1055
|
if getv(from_object, ['image_config']) is not None:
|
1642
|
-
setv(
|
1643
|
-
to_object,
|
1644
|
-
['imageConfig'],
|
1645
|
-
_ImageConfig_to_mldev(getv(from_object, ['image_config']), to_object),
|
1646
|
-
)
|
1056
|
+
setv(to_object, ['imageConfig'], getv(from_object, ['image_config']))
|
1647
1057
|
|
1648
1058
|
return to_object
|
1649
1059
|
|
@@ -1659,9 +1069,7 @@ def _GenerateContentConfig_to_vertex(
|
|
1659
1069
|
setv(
|
1660
1070
|
parent_object,
|
1661
1071
|
['systemInstruction'],
|
1662
|
-
|
1663
|
-
t.t_content(getv(from_object, ['system_instruction'])), to_object
|
1664
|
-
),
|
1072
|
+
t.t_content(getv(from_object, ['system_instruction'])),
|
1665
1073
|
)
|
1666
1074
|
|
1667
1075
|
if getv(from_object, ['temperature']) is not None:
|
@@ -1720,10 +1128,7 @@ def _GenerateContentConfig_to_vertex(
|
|
1720
1128
|
setv(
|
1721
1129
|
to_object,
|
1722
1130
|
['responseSchema'],
|
1723
|
-
|
1724
|
-
t.t_schema(api_client, getv(from_object, ['response_schema'])),
|
1725
|
-
to_object,
|
1726
|
-
),
|
1131
|
+
t.t_schema(api_client, getv(from_object, ['response_schema'])),
|
1727
1132
|
)
|
1728
1133
|
|
1729
1134
|
if getv(from_object, ['response_json_schema']) is not None:
|
@@ -1740,19 +1145,14 @@ def _GenerateContentConfig_to_vertex(
|
|
1740
1145
|
setv(
|
1741
1146
|
to_object,
|
1742
1147
|
['modelConfig'],
|
1743
|
-
|
1744
|
-
getv(from_object, ['model_selection_config']), to_object
|
1745
|
-
),
|
1148
|
+
getv(from_object, ['model_selection_config']),
|
1746
1149
|
)
|
1747
1150
|
|
1748
1151
|
if getv(from_object, ['safety_settings']) is not None:
|
1749
1152
|
setv(
|
1750
1153
|
parent_object,
|
1751
1154
|
['safetySettings'],
|
1752
|
-
[
|
1753
|
-
_SafetySetting_to_vertex(item, to_object)
|
1754
|
-
for item in getv(from_object, ['safety_settings'])
|
1755
|
-
],
|
1155
|
+
[item for item in getv(from_object, ['safety_settings'])],
|
1756
1156
|
)
|
1757
1157
|
|
1758
1158
|
if getv(from_object, ['tools']) is not None:
|
@@ -1766,11 +1166,7 @@ def _GenerateContentConfig_to_vertex(
|
|
1766
1166
|
)
|
1767
1167
|
|
1768
1168
|
if getv(from_object, ['tool_config']) is not None:
|
1769
|
-
setv(
|
1770
|
-
parent_object,
|
1771
|
-
['toolConfig'],
|
1772
|
-
_ToolConfig_to_vertex(getv(from_object, ['tool_config']), to_object),
|
1773
|
-
)
|
1169
|
+
setv(parent_object, ['toolConfig'], getv(from_object, ['tool_config']))
|
1774
1170
|
|
1775
1171
|
if getv(from_object, ['labels']) is not None:
|
1776
1172
|
setv(parent_object, ['labels'], getv(from_object, ['labels']))
|
@@ -1809,20 +1205,10 @@ def _GenerateContentConfig_to_vertex(
|
|
1809
1205
|
setv(to_object, ['audioTimestamp'], getv(from_object, ['audio_timestamp']))
|
1810
1206
|
|
1811
1207
|
if getv(from_object, ['thinking_config']) is not None:
|
1812
|
-
setv(
|
1813
|
-
to_object,
|
1814
|
-
['thinkingConfig'],
|
1815
|
-
_ThinkingConfig_to_vertex(
|
1816
|
-
getv(from_object, ['thinking_config']), to_object
|
1817
|
-
),
|
1818
|
-
)
|
1208
|
+
setv(to_object, ['thinkingConfig'], getv(from_object, ['thinking_config']))
|
1819
1209
|
|
1820
1210
|
if getv(from_object, ['image_config']) is not None:
|
1821
|
-
setv(
|
1822
|
-
to_object,
|
1823
|
-
['imageConfig'],
|
1824
|
-
_ImageConfig_to_vertex(getv(from_object, ['image_config']), to_object),
|
1825
|
-
)
|
1211
|
+
setv(to_object, ['imageConfig'], getv(from_object, ['image_config']))
|
1826
1212
|
|
1827
1213
|
return to_object
|
1828
1214
|
|
@@ -1879,10 +1265,7 @@ def _GenerateContentParameters_to_vertex(
|
|
1879
1265
|
setv(
|
1880
1266
|
to_object,
|
1881
1267
|
['contents'],
|
1882
|
-
[
|
1883
|
-
_Content_to_vertex(item, to_object)
|
1884
|
-
for item in t.t_contents(getv(from_object, ['contents']))
|
1885
|
-
],
|
1268
|
+
[item for item in t.t_contents(getv(from_object, ['contents']))],
|
1886
1269
|
)
|
1887
1270
|
|
1888
1271
|
if getv(from_object, ['config']) is not None:
|
@@ -1946,10 +1329,7 @@ def _GenerateContentResponse_from_vertex(
|
|
1946
1329
|
setv(
|
1947
1330
|
to_object,
|
1948
1331
|
['candidates'],
|
1949
|
-
[
|
1950
|
-
_Candidate_from_vertex(item, to_object)
|
1951
|
-
for item in getv(from_object, ['candidates'])
|
1952
|
-
],
|
1332
|
+
[item for item in getv(from_object, ['candidates'])],
|
1953
1333
|
)
|
1954
1334
|
|
1955
1335
|
if getv(from_object, ['createTime']) is not None:
|
@@ -2066,6 +1446,9 @@ def _GenerateImagesConfig_to_mldev(
|
|
2066
1446
|
if getv(from_object, ['add_watermark']) is not None:
|
2067
1447
|
raise ValueError('add_watermark parameter is not supported in Gemini API.')
|
2068
1448
|
|
1449
|
+
if getv(from_object, ['labels']) is not None:
|
1450
|
+
raise ValueError('labels parameter is not supported in Gemini API.')
|
1451
|
+
|
2069
1452
|
if getv(from_object, ['image_size']) is not None:
|
2070
1453
|
setv(
|
2071
1454
|
parent_object,
|
@@ -2179,6 +1562,9 @@ def _GenerateImagesConfig_to_vertex(
|
|
2179
1562
|
getv(from_object, ['add_watermark']),
|
2180
1563
|
)
|
2181
1564
|
|
1565
|
+
if getv(from_object, ['labels']) is not None:
|
1566
|
+
setv(parent_object, ['labels'], getv(from_object, ['labels']))
|
1567
|
+
|
2182
1568
|
if getv(from_object, ['image_size']) is not None:
|
2183
1569
|
setv(
|
2184
1570
|
parent_object,
|
@@ -2375,11 +1761,20 @@ def _GenerateVideosConfig_to_mldev(
|
|
2375
1761
|
raise ValueError('generate_audio parameter is not supported in Gemini API.')
|
2376
1762
|
|
2377
1763
|
if getv(from_object, ['last_frame']) is not None:
|
2378
|
-
|
1764
|
+
setv(
|
1765
|
+
parent_object,
|
1766
|
+
['instances[0]', 'lastFrame'],
|
1767
|
+
_Image_to_mldev(getv(from_object, ['last_frame']), to_object),
|
1768
|
+
)
|
2379
1769
|
|
2380
1770
|
if getv(from_object, ['reference_images']) is not None:
|
2381
|
-
|
2382
|
-
|
1771
|
+
setv(
|
1772
|
+
parent_object,
|
1773
|
+
['instances[0]', 'referenceImages'],
|
1774
|
+
[
|
1775
|
+
_VideoGenerationReferenceImage_to_mldev(item, to_object)
|
1776
|
+
for item in getv(from_object, ['reference_images'])
|
1777
|
+
],
|
2383
1778
|
)
|
2384
1779
|
|
2385
1780
|
if getv(from_object, ['mask']) is not None:
|
@@ -2609,7 +2004,11 @@ def _GenerateVideosParameters_to_mldev(
|
|
2609
2004
|
)
|
2610
2005
|
|
2611
2006
|
if getv(from_object, ['video']) is not None:
|
2612
|
-
|
2007
|
+
setv(
|
2008
|
+
to_object,
|
2009
|
+
['instances[0]', 'video'],
|
2010
|
+
_Video_to_mldev(getv(from_object, ['video']), to_object),
|
2011
|
+
)
|
2613
2012
|
|
2614
2013
|
if getv(from_object, ['source']) is not None:
|
2615
2014
|
_GenerateVideosSource_to_mldev(getv(from_object, ['source']), to_object)
|
@@ -2741,7 +2140,11 @@ def _GenerateVideosSource_to_mldev(
|
|
2741
2140
|
)
|
2742
2141
|
|
2743
2142
|
if getv(from_object, ['video']) is not None:
|
2744
|
-
|
2143
|
+
setv(
|
2144
|
+
parent_object,
|
2145
|
+
['instances[0]', 'video'],
|
2146
|
+
_Video_to_mldev(getv(from_object, ['video']), to_object),
|
2147
|
+
)
|
2745
2148
|
|
2746
2149
|
return to_object
|
2747
2150
|
|
@@ -2787,12 +2190,7 @@ def _GeneratedImageMask_from_vertex(
|
|
2787
2190
|
|
2788
2191
|
if getv(from_object, ['labels']) is not None:
|
2789
2192
|
setv(
|
2790
|
-
to_object,
|
2791
|
-
['labels'],
|
2792
|
-
[
|
2793
|
-
_EntityLabel_from_vertex(item, to_object)
|
2794
|
-
for item in getv(from_object, ['labels'])
|
2795
|
-
],
|
2193
|
+
to_object, ['labels'], [item for item in getv(from_object, ['labels'])]
|
2796
2194
|
)
|
2797
2195
|
|
2798
2196
|
return to_object
|
@@ -2889,145 +2287,180 @@ def _GeneratedVideo_from_vertex(
|
|
2889
2287
|
return to_object
|
2890
2288
|
|
2891
2289
|
|
2892
|
-
def
|
2893
|
-
api_client: BaseApiClient,
|
2290
|
+
def _GenerationConfig_to_vertex(
|
2894
2291
|
from_object: Union[dict[str, Any], object],
|
2895
2292
|
parent_object: Optional[dict[str, Any]] = None,
|
2896
2293
|
) -> dict[str, Any]:
|
2897
2294
|
to_object: dict[str, Any] = {}
|
2898
|
-
if getv(from_object, ['
|
2295
|
+
if getv(from_object, ['model_selection_config']) is not None:
|
2899
2296
|
setv(
|
2900
2297
|
to_object,
|
2901
|
-
['
|
2902
|
-
|
2298
|
+
['modelConfig'],
|
2299
|
+
getv(from_object, ['model_selection_config']),
|
2903
2300
|
)
|
2904
2301
|
|
2905
|
-
|
2302
|
+
if getv(from_object, ['audio_timestamp']) is not None:
|
2303
|
+
setv(to_object, ['audioTimestamp'], getv(from_object, ['audio_timestamp']))
|
2906
2304
|
|
2305
|
+
if getv(from_object, ['candidate_count']) is not None:
|
2306
|
+
setv(to_object, ['candidateCount'], getv(from_object, ['candidate_count']))
|
2907
2307
|
|
2908
|
-
|
2909
|
-
api_client: BaseApiClient,
|
2910
|
-
from_object: Union[dict[str, Any], object],
|
2911
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2912
|
-
) -> dict[str, Any]:
|
2913
|
-
to_object: dict[str, Any] = {}
|
2914
|
-
if getv(from_object, ['model']) is not None:
|
2308
|
+
if getv(from_object, ['enable_affective_dialog']) is not None:
|
2915
2309
|
setv(
|
2916
2310
|
to_object,
|
2917
|
-
['
|
2918
|
-
|
2311
|
+
['enableAffectiveDialog'],
|
2312
|
+
getv(from_object, ['enable_affective_dialog']),
|
2919
2313
|
)
|
2920
2314
|
|
2921
|
-
|
2315
|
+
if getv(from_object, ['frequency_penalty']) is not None:
|
2316
|
+
setv(
|
2317
|
+
to_object,
|
2318
|
+
['frequencyPenalty'],
|
2319
|
+
getv(from_object, ['frequency_penalty']),
|
2320
|
+
)
|
2922
2321
|
|
2322
|
+
if getv(from_object, ['logprobs']) is not None:
|
2323
|
+
setv(to_object, ['logprobs'], getv(from_object, ['logprobs']))
|
2923
2324
|
|
2924
|
-
|
2925
|
-
|
2926
|
-
|
2927
|
-
)
|
2928
|
-
|
2929
|
-
if getv(from_object, ['
|
2325
|
+
if getv(from_object, ['max_output_tokens']) is not None:
|
2326
|
+
setv(
|
2327
|
+
to_object, ['maxOutputTokens'], getv(from_object, ['max_output_tokens'])
|
2328
|
+
)
|
2329
|
+
|
2330
|
+
if getv(from_object, ['media_resolution']) is not None:
|
2331
|
+
setv(
|
2332
|
+
to_object, ['mediaResolution'], getv(from_object, ['media_resolution'])
|
2333
|
+
)
|
2334
|
+
|
2335
|
+
if getv(from_object, ['presence_penalty']) is not None:
|
2336
|
+
setv(
|
2337
|
+
to_object, ['presencePenalty'], getv(from_object, ['presence_penalty'])
|
2338
|
+
)
|
2339
|
+
|
2340
|
+
if getv(from_object, ['response_json_schema']) is not None:
|
2930
2341
|
setv(
|
2931
2342
|
to_object,
|
2932
|
-
['
|
2933
|
-
|
2343
|
+
['responseJsonSchema'],
|
2344
|
+
getv(from_object, ['response_json_schema']),
|
2934
2345
|
)
|
2935
2346
|
|
2936
|
-
|
2347
|
+
if getv(from_object, ['response_logprobs']) is not None:
|
2348
|
+
setv(
|
2349
|
+
to_object,
|
2350
|
+
['responseLogprobs'],
|
2351
|
+
getv(from_object, ['response_logprobs']),
|
2352
|
+
)
|
2937
2353
|
|
2354
|
+
if getv(from_object, ['response_mime_type']) is not None:
|
2355
|
+
setv(
|
2356
|
+
to_object,
|
2357
|
+
['responseMimeType'],
|
2358
|
+
getv(from_object, ['response_mime_type']),
|
2359
|
+
)
|
2938
2360
|
|
2939
|
-
|
2940
|
-
from_object: Union[dict[str, Any], object],
|
2941
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2942
|
-
) -> dict[str, Any]:
|
2943
|
-
to_object: dict[str, Any] = {}
|
2944
|
-
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
2361
|
+
if getv(from_object, ['response_modalities']) is not None:
|
2945
2362
|
setv(
|
2946
2363
|
to_object,
|
2947
|
-
['
|
2948
|
-
|
2949
|
-
getv(from_object, ['dynamic_retrieval_config']), to_object
|
2950
|
-
),
|
2364
|
+
['responseModalities'],
|
2365
|
+
getv(from_object, ['response_modalities']),
|
2951
2366
|
)
|
2952
2367
|
|
2953
|
-
|
2368
|
+
if getv(from_object, ['response_schema']) is not None:
|
2369
|
+
setv(to_object, ['responseSchema'], getv(from_object, ['response_schema']))
|
2954
2370
|
|
2371
|
+
if getv(from_object, ['routing_config']) is not None:
|
2372
|
+
setv(to_object, ['routingConfig'], getv(from_object, ['routing_config']))
|
2955
2373
|
|
2956
|
-
|
2957
|
-
|
2958
|
-
|
2959
|
-
|
2960
|
-
to_object: dict[str, Any] = {}
|
2961
|
-
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
2374
|
+
if getv(from_object, ['seed']) is not None:
|
2375
|
+
setv(to_object, ['seed'], getv(from_object, ['seed']))
|
2376
|
+
|
2377
|
+
if getv(from_object, ['speech_config']) is not None:
|
2962
2378
|
setv(
|
2963
2379
|
to_object,
|
2964
|
-
['
|
2965
|
-
|
2966
|
-
getv(from_object, ['
|
2380
|
+
['speechConfig'],
|
2381
|
+
_SpeechConfig_to_vertex(
|
2382
|
+
getv(from_object, ['speech_config']), to_object
|
2967
2383
|
),
|
2968
2384
|
)
|
2969
2385
|
|
2386
|
+
if getv(from_object, ['stop_sequences']) is not None:
|
2387
|
+
setv(to_object, ['stopSequences'], getv(from_object, ['stop_sequences']))
|
2388
|
+
|
2389
|
+
if getv(from_object, ['temperature']) is not None:
|
2390
|
+
setv(to_object, ['temperature'], getv(from_object, ['temperature']))
|
2391
|
+
|
2392
|
+
if getv(from_object, ['thinking_config']) is not None:
|
2393
|
+
setv(to_object, ['thinkingConfig'], getv(from_object, ['thinking_config']))
|
2394
|
+
|
2395
|
+
if getv(from_object, ['top_k']) is not None:
|
2396
|
+
setv(to_object, ['topK'], getv(from_object, ['top_k']))
|
2397
|
+
|
2398
|
+
if getv(from_object, ['top_p']) is not None:
|
2399
|
+
setv(to_object, ['topP'], getv(from_object, ['top_p']))
|
2400
|
+
|
2970
2401
|
return to_object
|
2971
2402
|
|
2972
2403
|
|
2973
|
-
def
|
2404
|
+
def _GetModelParameters_to_mldev(
|
2405
|
+
api_client: BaseApiClient,
|
2974
2406
|
from_object: Union[dict[str, Any], object],
|
2975
2407
|
parent_object: Optional[dict[str, Any]] = None,
|
2976
2408
|
) -> dict[str, Any]:
|
2977
2409
|
to_object: dict[str, Any] = {}
|
2978
|
-
if getv(from_object, ['
|
2410
|
+
if getv(from_object, ['model']) is not None:
|
2979
2411
|
setv(
|
2980
2412
|
to_object,
|
2981
|
-
['
|
2982
|
-
|
2983
|
-
)
|
2984
|
-
|
2985
|
-
if getv(from_object, ['exclude_domains']) is not None:
|
2986
|
-
raise ValueError(
|
2987
|
-
'exclude_domains parameter is not supported in Gemini API.'
|
2413
|
+
['_url', 'name'],
|
2414
|
+
t.t_model(api_client, getv(from_object, ['model'])),
|
2988
2415
|
)
|
2989
2416
|
|
2990
2417
|
return to_object
|
2991
2418
|
|
2992
2419
|
|
2993
|
-
def
|
2420
|
+
def _GetModelParameters_to_vertex(
|
2421
|
+
api_client: BaseApiClient,
|
2994
2422
|
from_object: Union[dict[str, Any], object],
|
2995
2423
|
parent_object: Optional[dict[str, Any]] = None,
|
2996
2424
|
) -> dict[str, Any]:
|
2997
2425
|
to_object: dict[str, Any] = {}
|
2998
|
-
if getv(from_object, ['
|
2426
|
+
if getv(from_object, ['model']) is not None:
|
2999
2427
|
setv(
|
3000
2428
|
to_object,
|
3001
|
-
['
|
3002
|
-
|
3003
|
-
getv(from_object, ['time_range_filter']), to_object
|
3004
|
-
),
|
2429
|
+
['_url', 'name'],
|
2430
|
+
t.t_model(api_client, getv(from_object, ['model'])),
|
3005
2431
|
)
|
3006
2432
|
|
3007
|
-
if getv(from_object, ['exclude_domains']) is not None:
|
3008
|
-
setv(to_object, ['excludeDomains'], getv(from_object, ['exclude_domains']))
|
3009
|
-
|
3010
2433
|
return to_object
|
3011
2434
|
|
3012
2435
|
|
3013
|
-
def
|
2436
|
+
def _GoogleMaps_to_mldev(
|
3014
2437
|
from_object: Union[dict[str, Any], object],
|
3015
2438
|
parent_object: Optional[dict[str, Any]] = None,
|
3016
2439
|
) -> dict[str, Any]:
|
3017
2440
|
to_object: dict[str, Any] = {}
|
3018
|
-
if getv(from_object, ['
|
3019
|
-
|
2441
|
+
if getv(from_object, ['auth_config']) is not None:
|
2442
|
+
raise ValueError('auth_config parameter is not supported in Gemini API.')
|
2443
|
+
|
2444
|
+
if getv(from_object, ['enable_widget']) is not None:
|
2445
|
+
setv(to_object, ['enableWidget'], getv(from_object, ['enable_widget']))
|
3020
2446
|
|
3021
2447
|
return to_object
|
3022
2448
|
|
3023
2449
|
|
3024
|
-
def
|
2450
|
+
def _GoogleSearch_to_mldev(
|
3025
2451
|
from_object: Union[dict[str, Any], object],
|
3026
2452
|
parent_object: Optional[dict[str, Any]] = None,
|
3027
2453
|
) -> dict[str, Any]:
|
3028
2454
|
to_object: dict[str, Any] = {}
|
3029
|
-
if getv(from_object, ['
|
3030
|
-
setv(
|
2455
|
+
if getv(from_object, ['time_range_filter']) is not None:
|
2456
|
+
setv(
|
2457
|
+
to_object, ['timeRangeFilter'], getv(from_object, ['time_range_filter'])
|
2458
|
+
)
|
2459
|
+
|
2460
|
+
if getv(from_object, ['exclude_domains']) is not None:
|
2461
|
+
raise ValueError(
|
2462
|
+
'exclude_domains parameter is not supported in Gemini API.'
|
2463
|
+
)
|
3031
2464
|
|
3032
2465
|
return to_object
|
3033
2466
|
|
@@ -3114,62 +2547,6 @@ def _Image_to_vertex(
|
|
3114
2547
|
return to_object
|
3115
2548
|
|
3116
2549
|
|
3117
|
-
def _Interval_to_mldev(
|
3118
|
-
from_object: Union[dict[str, Any], object],
|
3119
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3120
|
-
) -> dict[str, Any]:
|
3121
|
-
to_object: dict[str, Any] = {}
|
3122
|
-
if getv(from_object, ['start_time']) is not None:
|
3123
|
-
setv(to_object, ['startTime'], getv(from_object, ['start_time']))
|
3124
|
-
|
3125
|
-
if getv(from_object, ['end_time']) is not None:
|
3126
|
-
setv(to_object, ['endTime'], getv(from_object, ['end_time']))
|
3127
|
-
|
3128
|
-
return to_object
|
3129
|
-
|
3130
|
-
|
3131
|
-
def _Interval_to_vertex(
|
3132
|
-
from_object: Union[dict[str, Any], object],
|
3133
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3134
|
-
) -> dict[str, Any]:
|
3135
|
-
to_object: dict[str, Any] = {}
|
3136
|
-
if getv(from_object, ['start_time']) is not None:
|
3137
|
-
setv(to_object, ['startTime'], getv(from_object, ['start_time']))
|
3138
|
-
|
3139
|
-
if getv(from_object, ['end_time']) is not None:
|
3140
|
-
setv(to_object, ['endTime'], getv(from_object, ['end_time']))
|
3141
|
-
|
3142
|
-
return to_object
|
3143
|
-
|
3144
|
-
|
3145
|
-
def _LatLng_to_mldev(
|
3146
|
-
from_object: Union[dict[str, Any], object],
|
3147
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3148
|
-
) -> dict[str, Any]:
|
3149
|
-
to_object: dict[str, Any] = {}
|
3150
|
-
if getv(from_object, ['latitude']) is not None:
|
3151
|
-
setv(to_object, ['latitude'], getv(from_object, ['latitude']))
|
3152
|
-
|
3153
|
-
if getv(from_object, ['longitude']) is not None:
|
3154
|
-
setv(to_object, ['longitude'], getv(from_object, ['longitude']))
|
3155
|
-
|
3156
|
-
return to_object
|
3157
|
-
|
3158
|
-
|
3159
|
-
def _LatLng_to_vertex(
|
3160
|
-
from_object: Union[dict[str, Any], object],
|
3161
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3162
|
-
) -> dict[str, Any]:
|
3163
|
-
to_object: dict[str, Any] = {}
|
3164
|
-
if getv(from_object, ['latitude']) is not None:
|
3165
|
-
setv(to_object, ['latitude'], getv(from_object, ['latitude']))
|
3166
|
-
|
3167
|
-
if getv(from_object, ['longitude']) is not None:
|
3168
|
-
setv(to_object, ['longitude'], getv(from_object, ['longitude']))
|
3169
|
-
|
3170
|
-
return to_object
|
3171
|
-
|
3172
|
-
|
3173
2550
|
def _ListModelsConfig_to_mldev(
|
3174
2551
|
api_client: BaseApiClient,
|
3175
2552
|
from_object: Union[dict[str, Any], object],
|
@@ -3333,21 +2710,6 @@ def _MaskReferenceConfig_to_vertex(
|
|
3333
2710
|
return to_object
|
3334
2711
|
|
3335
2712
|
|
3336
|
-
def _ModelSelectionConfig_to_vertex(
|
3337
|
-
from_object: Union[dict[str, Any], object],
|
3338
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3339
|
-
) -> dict[str, Any]:
|
3340
|
-
to_object: dict[str, Any] = {}
|
3341
|
-
if getv(from_object, ['feature_selection_preference']) is not None:
|
3342
|
-
setv(
|
3343
|
-
to_object,
|
3344
|
-
['featureSelectionPreference'],
|
3345
|
-
getv(from_object, ['feature_selection_preference']),
|
3346
|
-
)
|
3347
|
-
|
3348
|
-
return to_object
|
3349
|
-
|
3350
|
-
|
3351
2713
|
def _Model_from_mldev(
|
3352
2714
|
from_object: Union[dict[str, Any], object],
|
3353
2715
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -3366,11 +2728,7 @@ def _Model_from_mldev(
|
|
3366
2728
|
setv(to_object, ['version'], getv(from_object, ['version']))
|
3367
2729
|
|
3368
2730
|
if getv(from_object, ['_self']) is not None:
|
3369
|
-
setv(
|
3370
|
-
to_object,
|
3371
|
-
['tuned_model_info'],
|
3372
|
-
_TunedModelInfo_from_mldev(getv(from_object, ['_self']), to_object),
|
3373
|
-
)
|
2731
|
+
setv(to_object, ['tuned_model_info'], getv(from_object, ['_self']))
|
3374
2732
|
|
3375
2733
|
if getv(from_object, ['inputTokenLimit']) is not None:
|
3376
2734
|
setv(
|
@@ -3442,205 +2800,38 @@ def _Model_from_vertex(
|
|
3442
2800
|
setv(
|
3443
2801
|
to_object,
|
3444
2802
|
['checkpoints'],
|
3445
|
-
[
|
3446
|
-
_Checkpoint_from_vertex(item, to_object)
|
3447
|
-
for item in getv(from_object, ['checkpoints'])
|
3448
|
-
],
|
3449
|
-
)
|
3450
|
-
|
3451
|
-
return to_object
|
3452
|
-
|
3453
|
-
|
3454
|
-
def _MultiSpeakerVoiceConfig_to_mldev(
|
3455
|
-
from_object: Union[dict[str, Any], object],
|
3456
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3457
|
-
) -> dict[str, Any]:
|
3458
|
-
to_object: dict[str, Any] = {}
|
3459
|
-
if getv(from_object, ['speaker_voice_configs']) is not None:
|
3460
|
-
setv(
|
3461
|
-
to_object,
|
3462
|
-
['speakerVoiceConfigs'],
|
3463
|
-
[
|
3464
|
-
_SpeakerVoiceConfig_to_mldev(item, to_object)
|
3465
|
-
for item in getv(from_object, ['speaker_voice_configs'])
|
3466
|
-
],
|
2803
|
+
[item for item in getv(from_object, ['checkpoints'])],
|
3467
2804
|
)
|
3468
2805
|
|
3469
2806
|
return to_object
|
3470
2807
|
|
3471
2808
|
|
3472
|
-
def
|
2809
|
+
def _Part_to_mldev(
|
3473
2810
|
from_object: Union[dict[str, Any], object],
|
3474
2811
|
parent_object: Optional[dict[str, Any]] = None,
|
3475
2812
|
) -> dict[str, Any]:
|
3476
2813
|
to_object: dict[str, Any] = {}
|
3477
|
-
if getv(from_object, ['
|
3478
|
-
setv(
|
3479
|
-
to_object,
|
3480
|
-
['video_metadata'],
|
3481
|
-
_VideoMetadata_from_mldev(
|
3482
|
-
getv(from_object, ['videoMetadata']), to_object
|
3483
|
-
),
|
3484
|
-
)
|
2814
|
+
if getv(from_object, ['video_metadata']) is not None:
|
2815
|
+
setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
|
3485
2816
|
|
3486
2817
|
if getv(from_object, ['thought']) is not None:
|
3487
2818
|
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
3488
2819
|
|
3489
|
-
if getv(from_object, ['
|
2820
|
+
if getv(from_object, ['inline_data']) is not None:
|
3490
2821
|
setv(
|
3491
2822
|
to_object,
|
3492
|
-
['
|
3493
|
-
|
2823
|
+
['inlineData'],
|
2824
|
+
_Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
|
3494
2825
|
)
|
3495
2826
|
|
3496
|
-
if getv(from_object, ['
|
2827
|
+
if getv(from_object, ['file_data']) is not None:
|
3497
2828
|
setv(
|
3498
2829
|
to_object,
|
3499
|
-
['
|
3500
|
-
|
2830
|
+
['fileData'],
|
2831
|
+
_FileData_to_mldev(getv(from_object, ['file_data']), to_object),
|
3501
2832
|
)
|
3502
2833
|
|
3503
|
-
if getv(from_object, ['
|
3504
|
-
setv(
|
3505
|
-
to_object,
|
3506
|
-
['thought_signature'],
|
3507
|
-
getv(from_object, ['thoughtSignature']),
|
3508
|
-
)
|
3509
|
-
|
3510
|
-
if getv(from_object, ['functionCall']) is not None:
|
3511
|
-
setv(
|
3512
|
-
to_object,
|
3513
|
-
['function_call'],
|
3514
|
-
_FunctionCall_from_mldev(
|
3515
|
-
getv(from_object, ['functionCall']), to_object
|
3516
|
-
),
|
3517
|
-
)
|
3518
|
-
|
3519
|
-
if getv(from_object, ['codeExecutionResult']) is not None:
|
3520
|
-
setv(
|
3521
|
-
to_object,
|
3522
|
-
['code_execution_result'],
|
3523
|
-
getv(from_object, ['codeExecutionResult']),
|
3524
|
-
)
|
3525
|
-
|
3526
|
-
if getv(from_object, ['executableCode']) is not None:
|
3527
|
-
setv(to_object, ['executable_code'], getv(from_object, ['executableCode']))
|
3528
|
-
|
3529
|
-
if getv(from_object, ['functionResponse']) is not None:
|
3530
|
-
setv(
|
3531
|
-
to_object,
|
3532
|
-
['function_response'],
|
3533
|
-
getv(from_object, ['functionResponse']),
|
3534
|
-
)
|
3535
|
-
|
3536
|
-
if getv(from_object, ['text']) is not None:
|
3537
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
3538
|
-
|
3539
|
-
return to_object
|
3540
|
-
|
3541
|
-
|
3542
|
-
def _Part_from_vertex(
|
3543
|
-
from_object: Union[dict[str, Any], object],
|
3544
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3545
|
-
) -> dict[str, Any]:
|
3546
|
-
to_object: dict[str, Any] = {}
|
3547
|
-
if getv(from_object, ['videoMetadata']) is not None:
|
3548
|
-
setv(
|
3549
|
-
to_object,
|
3550
|
-
['video_metadata'],
|
3551
|
-
_VideoMetadata_from_vertex(
|
3552
|
-
getv(from_object, ['videoMetadata']), to_object
|
3553
|
-
),
|
3554
|
-
)
|
3555
|
-
|
3556
|
-
if getv(from_object, ['thought']) is not None:
|
3557
|
-
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
3558
|
-
|
3559
|
-
if getv(from_object, ['inlineData']) is not None:
|
3560
|
-
setv(
|
3561
|
-
to_object,
|
3562
|
-
['inline_data'],
|
3563
|
-
_Blob_from_vertex(getv(from_object, ['inlineData']), to_object),
|
3564
|
-
)
|
3565
|
-
|
3566
|
-
if getv(from_object, ['fileData']) is not None:
|
3567
|
-
setv(
|
3568
|
-
to_object,
|
3569
|
-
['file_data'],
|
3570
|
-
_FileData_from_vertex(getv(from_object, ['fileData']), to_object),
|
3571
|
-
)
|
3572
|
-
|
3573
|
-
if getv(from_object, ['thoughtSignature']) is not None:
|
3574
|
-
setv(
|
3575
|
-
to_object,
|
3576
|
-
['thought_signature'],
|
3577
|
-
getv(from_object, ['thoughtSignature']),
|
3578
|
-
)
|
3579
|
-
|
3580
|
-
if getv(from_object, ['functionCall']) is not None:
|
3581
|
-
setv(
|
3582
|
-
to_object,
|
3583
|
-
['function_call'],
|
3584
|
-
_FunctionCall_from_vertex(
|
3585
|
-
getv(from_object, ['functionCall']), to_object
|
3586
|
-
),
|
3587
|
-
)
|
3588
|
-
|
3589
|
-
if getv(from_object, ['codeExecutionResult']) is not None:
|
3590
|
-
setv(
|
3591
|
-
to_object,
|
3592
|
-
['code_execution_result'],
|
3593
|
-
getv(from_object, ['codeExecutionResult']),
|
3594
|
-
)
|
3595
|
-
|
3596
|
-
if getv(from_object, ['executableCode']) is not None:
|
3597
|
-
setv(to_object, ['executable_code'], getv(from_object, ['executableCode']))
|
3598
|
-
|
3599
|
-
if getv(from_object, ['functionResponse']) is not None:
|
3600
|
-
setv(
|
3601
|
-
to_object,
|
3602
|
-
['function_response'],
|
3603
|
-
getv(from_object, ['functionResponse']),
|
3604
|
-
)
|
3605
|
-
|
3606
|
-
if getv(from_object, ['text']) is not None:
|
3607
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
3608
|
-
|
3609
|
-
return to_object
|
3610
|
-
|
3611
|
-
|
3612
|
-
def _Part_to_mldev(
|
3613
|
-
from_object: Union[dict[str, Any], object],
|
3614
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3615
|
-
) -> dict[str, Any]:
|
3616
|
-
to_object: dict[str, Any] = {}
|
3617
|
-
if getv(from_object, ['video_metadata']) is not None:
|
3618
|
-
setv(
|
3619
|
-
to_object,
|
3620
|
-
['videoMetadata'],
|
3621
|
-
_VideoMetadata_to_mldev(
|
3622
|
-
getv(from_object, ['video_metadata']), to_object
|
3623
|
-
),
|
3624
|
-
)
|
3625
|
-
|
3626
|
-
if getv(from_object, ['thought']) is not None:
|
3627
|
-
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
3628
|
-
|
3629
|
-
if getv(from_object, ['inline_data']) is not None:
|
3630
|
-
setv(
|
3631
|
-
to_object,
|
3632
|
-
['inlineData'],
|
3633
|
-
_Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
|
3634
|
-
)
|
3635
|
-
|
3636
|
-
if getv(from_object, ['file_data']) is not None:
|
3637
|
-
setv(
|
3638
|
-
to_object,
|
3639
|
-
['fileData'],
|
3640
|
-
_FileData_to_mldev(getv(from_object, ['file_data']), to_object),
|
3641
|
-
)
|
3642
|
-
|
3643
|
-
if getv(from_object, ['thought_signature']) is not None:
|
2834
|
+
if getv(from_object, ['thought_signature']) is not None:
|
3644
2835
|
setv(
|
3645
2836
|
to_object,
|
3646
2837
|
['thoughtSignature'],
|
@@ -3648,11 +2839,7 @@ def _Part_to_mldev(
|
|
3648
2839
|
)
|
3649
2840
|
|
3650
2841
|
if getv(from_object, ['function_call']) is not None:
|
3651
|
-
setv(
|
3652
|
-
to_object,
|
3653
|
-
['functionCall'],
|
3654
|
-
_FunctionCall_to_mldev(getv(from_object, ['function_call']), to_object),
|
3655
|
-
)
|
2842
|
+
setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
|
3656
2843
|
|
3657
2844
|
if getv(from_object, ['code_execution_result']) is not None:
|
3658
2845
|
setv(
|
@@ -3677,98 +2864,6 @@ def _Part_to_mldev(
|
|
3677
2864
|
return to_object
|
3678
2865
|
|
3679
2866
|
|
3680
|
-
def _Part_to_vertex(
|
3681
|
-
from_object: Union[dict[str, Any], object],
|
3682
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3683
|
-
) -> dict[str, Any]:
|
3684
|
-
to_object: dict[str, Any] = {}
|
3685
|
-
if getv(from_object, ['video_metadata']) is not None:
|
3686
|
-
setv(
|
3687
|
-
to_object,
|
3688
|
-
['videoMetadata'],
|
3689
|
-
_VideoMetadata_to_vertex(
|
3690
|
-
getv(from_object, ['video_metadata']), to_object
|
3691
|
-
),
|
3692
|
-
)
|
3693
|
-
|
3694
|
-
if getv(from_object, ['thought']) is not None:
|
3695
|
-
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
3696
|
-
|
3697
|
-
if getv(from_object, ['inline_data']) is not None:
|
3698
|
-
setv(
|
3699
|
-
to_object,
|
3700
|
-
['inlineData'],
|
3701
|
-
_Blob_to_vertex(getv(from_object, ['inline_data']), to_object),
|
3702
|
-
)
|
3703
|
-
|
3704
|
-
if getv(from_object, ['file_data']) is not None:
|
3705
|
-
setv(
|
3706
|
-
to_object,
|
3707
|
-
['fileData'],
|
3708
|
-
_FileData_to_vertex(getv(from_object, ['file_data']), to_object),
|
3709
|
-
)
|
3710
|
-
|
3711
|
-
if getv(from_object, ['thought_signature']) is not None:
|
3712
|
-
setv(
|
3713
|
-
to_object,
|
3714
|
-
['thoughtSignature'],
|
3715
|
-
getv(from_object, ['thought_signature']),
|
3716
|
-
)
|
3717
|
-
|
3718
|
-
if getv(from_object, ['function_call']) is not None:
|
3719
|
-
setv(
|
3720
|
-
to_object,
|
3721
|
-
['functionCall'],
|
3722
|
-
_FunctionCall_to_vertex(
|
3723
|
-
getv(from_object, ['function_call']), to_object
|
3724
|
-
),
|
3725
|
-
)
|
3726
|
-
|
3727
|
-
if getv(from_object, ['code_execution_result']) is not None:
|
3728
|
-
setv(
|
3729
|
-
to_object,
|
3730
|
-
['codeExecutionResult'],
|
3731
|
-
getv(from_object, ['code_execution_result']),
|
3732
|
-
)
|
3733
|
-
|
3734
|
-
if getv(from_object, ['executable_code']) is not None:
|
3735
|
-
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
3736
|
-
|
3737
|
-
if getv(from_object, ['function_response']) is not None:
|
3738
|
-
setv(
|
3739
|
-
to_object,
|
3740
|
-
['functionResponse'],
|
3741
|
-
getv(from_object, ['function_response']),
|
3742
|
-
)
|
3743
|
-
|
3744
|
-
if getv(from_object, ['text']) is not None:
|
3745
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
3746
|
-
|
3747
|
-
return to_object
|
3748
|
-
|
3749
|
-
|
3750
|
-
def _PrebuiltVoiceConfig_to_mldev(
|
3751
|
-
from_object: Union[dict[str, Any], object],
|
3752
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3753
|
-
) -> dict[str, Any]:
|
3754
|
-
to_object: dict[str, Any] = {}
|
3755
|
-
if getv(from_object, ['voice_name']) is not None:
|
3756
|
-
setv(to_object, ['voiceName'], getv(from_object, ['voice_name']))
|
3757
|
-
|
3758
|
-
return to_object
|
3759
|
-
|
3760
|
-
|
3761
|
-
def _PrebuiltVoiceConfig_to_vertex(
|
3762
|
-
from_object: Union[dict[str, Any], object],
|
3763
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3764
|
-
) -> dict[str, Any]:
|
3765
|
-
to_object: dict[str, Any] = {}
|
3766
|
-
if getv(from_object, ['voice_name']) is not None:
|
3767
|
-
setv(to_object, ['voiceName'], getv(from_object, ['voice_name']))
|
3768
|
-
|
3769
|
-
return to_object
|
3770
|
-
|
3771
|
-
|
3772
2867
|
def _ProductImage_to_vertex(
|
3773
2868
|
from_object: Union[dict[str, Any], object],
|
3774
2869
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -3856,6 +2951,9 @@ def _RecontextImageConfig_to_vertex(
|
|
3856
2951
|
getv(from_object, ['enhance_prompt']),
|
3857
2952
|
)
|
3858
2953
|
|
2954
|
+
if getv(from_object, ['labels']) is not None:
|
2955
|
+
setv(parent_object, ['labels'], getv(from_object, ['labels']))
|
2956
|
+
|
3859
2957
|
return to_object
|
3860
2958
|
|
3861
2959
|
|
@@ -3969,56 +3067,16 @@ def _ReferenceImageAPI_to_vertex(
|
|
3969
3067
|
setv(
|
3970
3068
|
to_object,
|
3971
3069
|
['styleImageConfig'],
|
3972
|
-
|
3973
|
-
getv(from_object, ['style_image_config']), to_object
|
3974
|
-
),
|
3070
|
+
getv(from_object, ['style_image_config']),
|
3975
3071
|
)
|
3976
3072
|
|
3977
3073
|
if getv(from_object, ['subject_image_config']) is not None:
|
3978
3074
|
setv(
|
3979
3075
|
to_object,
|
3980
3076
|
['subjectImageConfig'],
|
3981
|
-
|
3982
|
-
getv(from_object, ['subject_image_config']), to_object
|
3983
|
-
),
|
3984
|
-
)
|
3985
|
-
|
3986
|
-
return to_object
|
3987
|
-
|
3988
|
-
|
3989
|
-
def _RetrievalConfig_to_mldev(
|
3990
|
-
from_object: Union[dict[str, Any], object],
|
3991
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3992
|
-
) -> dict[str, Any]:
|
3993
|
-
to_object: dict[str, Any] = {}
|
3994
|
-
if getv(from_object, ['lat_lng']) is not None:
|
3995
|
-
setv(
|
3996
|
-
to_object,
|
3997
|
-
['latLng'],
|
3998
|
-
_LatLng_to_mldev(getv(from_object, ['lat_lng']), to_object),
|
3077
|
+
getv(from_object, ['subject_image_config']),
|
3999
3078
|
)
|
4000
3079
|
|
4001
|
-
if getv(from_object, ['language_code']) is not None:
|
4002
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
4003
|
-
|
4004
|
-
return to_object
|
4005
|
-
|
4006
|
-
|
4007
|
-
def _RetrievalConfig_to_vertex(
|
4008
|
-
from_object: Union[dict[str, Any], object],
|
4009
|
-
parent_object: Optional[dict[str, Any]] = None,
|
4010
|
-
) -> dict[str, Any]:
|
4011
|
-
to_object: dict[str, Any] = {}
|
4012
|
-
if getv(from_object, ['lat_lng']) is not None:
|
4013
|
-
setv(
|
4014
|
-
to_object,
|
4015
|
-
['latLng'],
|
4016
|
-
_LatLng_to_vertex(getv(from_object, ['lat_lng']), to_object),
|
4017
|
-
)
|
4018
|
-
|
4019
|
-
if getv(from_object, ['language_code']) is not None:
|
4020
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
4021
|
-
|
4022
3080
|
return to_object
|
4023
3081
|
|
4024
3082
|
|
@@ -4085,203 +3143,6 @@ def _SafetySetting_to_mldev(
|
|
4085
3143
|
return to_object
|
4086
3144
|
|
4087
3145
|
|
4088
|
-
def _SafetySetting_to_vertex(
|
4089
|
-
from_object: Union[dict[str, Any], object],
|
4090
|
-
parent_object: Optional[dict[str, Any]] = None,
|
4091
|
-
) -> dict[str, Any]:
|
4092
|
-
to_object: dict[str, Any] = {}
|
4093
|
-
if getv(from_object, ['method']) is not None:
|
4094
|
-
setv(to_object, ['method'], getv(from_object, ['method']))
|
4095
|
-
|
4096
|
-
if getv(from_object, ['category']) is not None:
|
4097
|
-
setv(to_object, ['category'], getv(from_object, ['category']))
|
4098
|
-
|
4099
|
-
if getv(from_object, ['threshold']) is not None:
|
4100
|
-
setv(to_object, ['threshold'], getv(from_object, ['threshold']))
|
4101
|
-
|
4102
|
-
return to_object
|
4103
|
-
|
4104
|
-
|
4105
|
-
def _Schema_to_mldev(
|
4106
|
-
from_object: Union[dict[str, Any], object],
|
4107
|
-
parent_object: Optional[dict[str, Any]] = None,
|
4108
|
-
) -> dict[str, Any]:
|
4109
|
-
to_object: dict[str, Any] = {}
|
4110
|
-
if getv(from_object, ['additional_properties']) is not None:
|
4111
|
-
raise ValueError(
|
4112
|
-
'additional_properties parameter is not supported in Gemini API.'
|
4113
|
-
)
|
4114
|
-
|
4115
|
-
if getv(from_object, ['defs']) is not None:
|
4116
|
-
raise ValueError('defs parameter is not supported in Gemini API.')
|
4117
|
-
|
4118
|
-
if getv(from_object, ['ref']) is not None:
|
4119
|
-
raise ValueError('ref parameter is not supported in Gemini API.')
|
4120
|
-
|
4121
|
-
if getv(from_object, ['any_of']) is not None:
|
4122
|
-
setv(to_object, ['anyOf'], getv(from_object, ['any_of']))
|
4123
|
-
|
4124
|
-
if getv(from_object, ['default']) is not None:
|
4125
|
-
setv(to_object, ['default'], getv(from_object, ['default']))
|
4126
|
-
|
4127
|
-
if getv(from_object, ['description']) is not None:
|
4128
|
-
setv(to_object, ['description'], getv(from_object, ['description']))
|
4129
|
-
|
4130
|
-
if getv(from_object, ['enum']) is not None:
|
4131
|
-
setv(to_object, ['enum'], getv(from_object, ['enum']))
|
4132
|
-
|
4133
|
-
if getv(from_object, ['example']) is not None:
|
4134
|
-
setv(to_object, ['example'], getv(from_object, ['example']))
|
4135
|
-
|
4136
|
-
if getv(from_object, ['format']) is not None:
|
4137
|
-
setv(to_object, ['format'], getv(from_object, ['format']))
|
4138
|
-
|
4139
|
-
if getv(from_object, ['items']) is not None:
|
4140
|
-
setv(to_object, ['items'], getv(from_object, ['items']))
|
4141
|
-
|
4142
|
-
if getv(from_object, ['max_items']) is not None:
|
4143
|
-
setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
|
4144
|
-
|
4145
|
-
if getv(from_object, ['max_length']) is not None:
|
4146
|
-
setv(to_object, ['maxLength'], getv(from_object, ['max_length']))
|
4147
|
-
|
4148
|
-
if getv(from_object, ['max_properties']) is not None:
|
4149
|
-
setv(to_object, ['maxProperties'], getv(from_object, ['max_properties']))
|
4150
|
-
|
4151
|
-
if getv(from_object, ['maximum']) is not None:
|
4152
|
-
setv(to_object, ['maximum'], getv(from_object, ['maximum']))
|
4153
|
-
|
4154
|
-
if getv(from_object, ['min_items']) is not None:
|
4155
|
-
setv(to_object, ['minItems'], getv(from_object, ['min_items']))
|
4156
|
-
|
4157
|
-
if getv(from_object, ['min_length']) is not None:
|
4158
|
-
setv(to_object, ['minLength'], getv(from_object, ['min_length']))
|
4159
|
-
|
4160
|
-
if getv(from_object, ['min_properties']) is not None:
|
4161
|
-
setv(to_object, ['minProperties'], getv(from_object, ['min_properties']))
|
4162
|
-
|
4163
|
-
if getv(from_object, ['minimum']) is not None:
|
4164
|
-
setv(to_object, ['minimum'], getv(from_object, ['minimum']))
|
4165
|
-
|
4166
|
-
if getv(from_object, ['nullable']) is not None:
|
4167
|
-
setv(to_object, ['nullable'], getv(from_object, ['nullable']))
|
4168
|
-
|
4169
|
-
if getv(from_object, ['pattern']) is not None:
|
4170
|
-
setv(to_object, ['pattern'], getv(from_object, ['pattern']))
|
4171
|
-
|
4172
|
-
if getv(from_object, ['properties']) is not None:
|
4173
|
-
setv(to_object, ['properties'], getv(from_object, ['properties']))
|
4174
|
-
|
4175
|
-
if getv(from_object, ['property_ordering']) is not None:
|
4176
|
-
setv(
|
4177
|
-
to_object,
|
4178
|
-
['propertyOrdering'],
|
4179
|
-
getv(from_object, ['property_ordering']),
|
4180
|
-
)
|
4181
|
-
|
4182
|
-
if getv(from_object, ['required']) is not None:
|
4183
|
-
setv(to_object, ['required'], getv(from_object, ['required']))
|
4184
|
-
|
4185
|
-
if getv(from_object, ['title']) is not None:
|
4186
|
-
setv(to_object, ['title'], getv(from_object, ['title']))
|
4187
|
-
|
4188
|
-
if getv(from_object, ['type']) is not None:
|
4189
|
-
setv(to_object, ['type'], getv(from_object, ['type']))
|
4190
|
-
|
4191
|
-
return to_object
|
4192
|
-
|
4193
|
-
|
4194
|
-
def _Schema_to_vertex(
|
4195
|
-
from_object: Union[dict[str, Any], object],
|
4196
|
-
parent_object: Optional[dict[str, Any]] = None,
|
4197
|
-
) -> dict[str, Any]:
|
4198
|
-
to_object: dict[str, Any] = {}
|
4199
|
-
if getv(from_object, ['additional_properties']) is not None:
|
4200
|
-
setv(
|
4201
|
-
to_object,
|
4202
|
-
['additionalProperties'],
|
4203
|
-
getv(from_object, ['additional_properties']),
|
4204
|
-
)
|
4205
|
-
|
4206
|
-
if getv(from_object, ['defs']) is not None:
|
4207
|
-
setv(to_object, ['defs'], getv(from_object, ['defs']))
|
4208
|
-
|
4209
|
-
if getv(from_object, ['ref']) is not None:
|
4210
|
-
setv(to_object, ['ref'], getv(from_object, ['ref']))
|
4211
|
-
|
4212
|
-
if getv(from_object, ['any_of']) is not None:
|
4213
|
-
setv(to_object, ['anyOf'], getv(from_object, ['any_of']))
|
4214
|
-
|
4215
|
-
if getv(from_object, ['default']) is not None:
|
4216
|
-
setv(to_object, ['default'], getv(from_object, ['default']))
|
4217
|
-
|
4218
|
-
if getv(from_object, ['description']) is not None:
|
4219
|
-
setv(to_object, ['description'], getv(from_object, ['description']))
|
4220
|
-
|
4221
|
-
if getv(from_object, ['enum']) is not None:
|
4222
|
-
setv(to_object, ['enum'], getv(from_object, ['enum']))
|
4223
|
-
|
4224
|
-
if getv(from_object, ['example']) is not None:
|
4225
|
-
setv(to_object, ['example'], getv(from_object, ['example']))
|
4226
|
-
|
4227
|
-
if getv(from_object, ['format']) is not None:
|
4228
|
-
setv(to_object, ['format'], getv(from_object, ['format']))
|
4229
|
-
|
4230
|
-
if getv(from_object, ['items']) is not None:
|
4231
|
-
setv(to_object, ['items'], getv(from_object, ['items']))
|
4232
|
-
|
4233
|
-
if getv(from_object, ['max_items']) is not None:
|
4234
|
-
setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
|
4235
|
-
|
4236
|
-
if getv(from_object, ['max_length']) is not None:
|
4237
|
-
setv(to_object, ['maxLength'], getv(from_object, ['max_length']))
|
4238
|
-
|
4239
|
-
if getv(from_object, ['max_properties']) is not None:
|
4240
|
-
setv(to_object, ['maxProperties'], getv(from_object, ['max_properties']))
|
4241
|
-
|
4242
|
-
if getv(from_object, ['maximum']) is not None:
|
4243
|
-
setv(to_object, ['maximum'], getv(from_object, ['maximum']))
|
4244
|
-
|
4245
|
-
if getv(from_object, ['min_items']) is not None:
|
4246
|
-
setv(to_object, ['minItems'], getv(from_object, ['min_items']))
|
4247
|
-
|
4248
|
-
if getv(from_object, ['min_length']) is not None:
|
4249
|
-
setv(to_object, ['minLength'], getv(from_object, ['min_length']))
|
4250
|
-
|
4251
|
-
if getv(from_object, ['min_properties']) is not None:
|
4252
|
-
setv(to_object, ['minProperties'], getv(from_object, ['min_properties']))
|
4253
|
-
|
4254
|
-
if getv(from_object, ['minimum']) is not None:
|
4255
|
-
setv(to_object, ['minimum'], getv(from_object, ['minimum']))
|
4256
|
-
|
4257
|
-
if getv(from_object, ['nullable']) is not None:
|
4258
|
-
setv(to_object, ['nullable'], getv(from_object, ['nullable']))
|
4259
|
-
|
4260
|
-
if getv(from_object, ['pattern']) is not None:
|
4261
|
-
setv(to_object, ['pattern'], getv(from_object, ['pattern']))
|
4262
|
-
|
4263
|
-
if getv(from_object, ['properties']) is not None:
|
4264
|
-
setv(to_object, ['properties'], getv(from_object, ['properties']))
|
4265
|
-
|
4266
|
-
if getv(from_object, ['property_ordering']) is not None:
|
4267
|
-
setv(
|
4268
|
-
to_object,
|
4269
|
-
['propertyOrdering'],
|
4270
|
-
getv(from_object, ['property_ordering']),
|
4271
|
-
)
|
4272
|
-
|
4273
|
-
if getv(from_object, ['required']) is not None:
|
4274
|
-
setv(to_object, ['required'], getv(from_object, ['required']))
|
4275
|
-
|
4276
|
-
if getv(from_object, ['title']) is not None:
|
4277
|
-
setv(to_object, ['title'], getv(from_object, ['title']))
|
4278
|
-
|
4279
|
-
if getv(from_object, ['type']) is not None:
|
4280
|
-
setv(to_object, ['type'], getv(from_object, ['type']))
|
4281
|
-
|
4282
|
-
return to_object
|
4283
|
-
|
4284
|
-
|
4285
3146
|
def _ScribbleImage_to_vertex(
|
4286
3147
|
from_object: Union[dict[str, Any], object],
|
4287
3148
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -4334,6 +3195,9 @@ def _SegmentImageConfig_to_vertex(
|
|
4334
3195
|
getv(from_object, ['binary_color_threshold']),
|
4335
3196
|
)
|
4336
3197
|
|
3198
|
+
if getv(from_object, ['labels']) is not None:
|
3199
|
+
setv(parent_object, ['labels'], getv(from_object, ['labels']))
|
3200
|
+
|
4337
3201
|
return to_object
|
4338
3202
|
|
4339
3203
|
|
@@ -4377,217 +3241,51 @@ def _SegmentImageResponse_from_vertex(
|
|
4377
3241
|
return to_object
|
4378
3242
|
|
4379
3243
|
|
4380
|
-
def _SegmentImageSource_to_vertex(
|
4381
|
-
from_object: Union[dict[str, Any], object],
|
4382
|
-
parent_object: Optional[dict[str, Any]] = None,
|
4383
|
-
) -> dict[str, Any]:
|
4384
|
-
to_object: dict[str, Any] = {}
|
4385
|
-
if getv(from_object, ['prompt']) is not None:
|
4386
|
-
setv(
|
4387
|
-
parent_object, ['instances[0]', 'prompt'], getv(from_object, ['prompt'])
|
4388
|
-
)
|
4389
|
-
|
4390
|
-
if getv(from_object, ['image']) is not None:
|
4391
|
-
setv(
|
4392
|
-
parent_object,
|
4393
|
-
['instances[0]', 'image'],
|
4394
|
-
_Image_to_vertex(getv(from_object, ['image']), to_object),
|
4395
|
-
)
|
4396
|
-
|
4397
|
-
if getv(from_object, ['scribble_image']) is not None:
|
4398
|
-
setv(
|
4399
|
-
parent_object,
|
4400
|
-
['instances[0]', 'scribble'],
|
4401
|
-
_ScribbleImage_to_vertex(
|
4402
|
-
getv(from_object, ['scribble_image']), to_object
|
4403
|
-
),
|
4404
|
-
)
|
4405
|
-
|
4406
|
-
return to_object
|
4407
|
-
|
4408
|
-
|
4409
|
-
def _SpeakerVoiceConfig_to_mldev(
|
4410
|
-
from_object: Union[dict[str, Any], object],
|
4411
|
-
parent_object: Optional[dict[str, Any]] = None,
|
4412
|
-
) -> dict[str, Any]:
|
4413
|
-
to_object: dict[str, Any] = {}
|
4414
|
-
if getv(from_object, ['speaker']) is not None:
|
4415
|
-
setv(to_object, ['speaker'], getv(from_object, ['speaker']))
|
4416
|
-
|
4417
|
-
if getv(from_object, ['voice_config']) is not None:
|
4418
|
-
setv(
|
4419
|
-
to_object,
|
4420
|
-
['voiceConfig'],
|
4421
|
-
_VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
|
4422
|
-
)
|
4423
|
-
|
4424
|
-
return to_object
|
4425
|
-
|
4426
|
-
|
4427
|
-
def _SpeechConfig_to_mldev(
|
4428
|
-
from_object: Union[dict[str, Any], object],
|
4429
|
-
parent_object: Optional[dict[str, Any]] = None,
|
4430
|
-
) -> dict[str, Any]:
|
4431
|
-
to_object: dict[str, Any] = {}
|
4432
|
-
if getv(from_object, ['voice_config']) is not None:
|
4433
|
-
setv(
|
4434
|
-
to_object,
|
4435
|
-
['voiceConfig'],
|
4436
|
-
_VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
|
4437
|
-
)
|
4438
|
-
|
4439
|
-
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
4440
|
-
setv(
|
4441
|
-
to_object,
|
4442
|
-
['multiSpeakerVoiceConfig'],
|
4443
|
-
_MultiSpeakerVoiceConfig_to_mldev(
|
4444
|
-
getv(from_object, ['multi_speaker_voice_config']), to_object
|
4445
|
-
),
|
4446
|
-
)
|
4447
|
-
|
4448
|
-
if getv(from_object, ['language_code']) is not None:
|
4449
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
4450
|
-
|
4451
|
-
return to_object
|
4452
|
-
|
4453
|
-
|
4454
|
-
def _SpeechConfig_to_vertex(
|
4455
|
-
from_object: Union[dict[str, Any], object],
|
4456
|
-
parent_object: Optional[dict[str, Any]] = None,
|
4457
|
-
) -> dict[str, Any]:
|
4458
|
-
to_object: dict[str, Any] = {}
|
4459
|
-
if getv(from_object, ['voice_config']) is not None:
|
4460
|
-
setv(
|
4461
|
-
to_object,
|
4462
|
-
['voiceConfig'],
|
4463
|
-
_VoiceConfig_to_vertex(getv(from_object, ['voice_config']), to_object),
|
4464
|
-
)
|
4465
|
-
|
4466
|
-
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
4467
|
-
raise ValueError(
|
4468
|
-
'multi_speaker_voice_config parameter is not supported in Vertex AI.'
|
4469
|
-
)
|
4470
|
-
|
4471
|
-
if getv(from_object, ['language_code']) is not None:
|
4472
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
4473
|
-
|
4474
|
-
return to_object
|
4475
|
-
|
4476
|
-
|
4477
|
-
def _StyleReferenceConfig_to_vertex(
|
4478
|
-
from_object: Union[dict[str, Any], object],
|
4479
|
-
parent_object: Optional[dict[str, Any]] = None,
|
4480
|
-
) -> dict[str, Any]:
|
4481
|
-
to_object: dict[str, Any] = {}
|
4482
|
-
if getv(from_object, ['style_description']) is not None:
|
4483
|
-
setv(
|
4484
|
-
to_object,
|
4485
|
-
['styleDescription'],
|
4486
|
-
getv(from_object, ['style_description']),
|
4487
|
-
)
|
4488
|
-
|
4489
|
-
return to_object
|
4490
|
-
|
4491
|
-
|
4492
|
-
def _SubjectReferenceConfig_to_vertex(
|
4493
|
-
from_object: Union[dict[str, Any], object],
|
4494
|
-
parent_object: Optional[dict[str, Any]] = None,
|
4495
|
-
) -> dict[str, Any]:
|
4496
|
-
to_object: dict[str, Any] = {}
|
4497
|
-
if getv(from_object, ['subject_type']) is not None:
|
4498
|
-
setv(to_object, ['subjectType'], getv(from_object, ['subject_type']))
|
4499
|
-
|
4500
|
-
if getv(from_object, ['subject_description']) is not None:
|
4501
|
-
setv(
|
4502
|
-
to_object,
|
4503
|
-
['subjectDescription'],
|
4504
|
-
getv(from_object, ['subject_description']),
|
4505
|
-
)
|
4506
|
-
|
4507
|
-
return to_object
|
4508
|
-
|
4509
|
-
|
4510
|
-
def _ThinkingConfig_to_mldev(
|
4511
|
-
from_object: Union[dict[str, Any], object],
|
4512
|
-
parent_object: Optional[dict[str, Any]] = None,
|
4513
|
-
) -> dict[str, Any]:
|
4514
|
-
to_object: dict[str, Any] = {}
|
4515
|
-
if getv(from_object, ['include_thoughts']) is not None:
|
4516
|
-
setv(
|
4517
|
-
to_object, ['includeThoughts'], getv(from_object, ['include_thoughts'])
|
4518
|
-
)
|
4519
|
-
|
4520
|
-
if getv(from_object, ['thinking_budget']) is not None:
|
4521
|
-
setv(to_object, ['thinkingBudget'], getv(from_object, ['thinking_budget']))
|
4522
|
-
|
4523
|
-
return to_object
|
4524
|
-
|
4525
|
-
|
4526
|
-
def _ThinkingConfig_to_vertex(
|
4527
|
-
from_object: Union[dict[str, Any], object],
|
4528
|
-
parent_object: Optional[dict[str, Any]] = None,
|
4529
|
-
) -> dict[str, Any]:
|
4530
|
-
to_object: dict[str, Any] = {}
|
4531
|
-
if getv(from_object, ['include_thoughts']) is not None:
|
4532
|
-
setv(
|
4533
|
-
to_object, ['includeThoughts'], getv(from_object, ['include_thoughts'])
|
4534
|
-
)
|
4535
|
-
|
4536
|
-
if getv(from_object, ['thinking_budget']) is not None:
|
4537
|
-
setv(to_object, ['thinkingBudget'], getv(from_object, ['thinking_budget']))
|
4538
|
-
|
4539
|
-
return to_object
|
4540
|
-
|
4541
|
-
|
4542
|
-
def _ToolConfig_to_mldev(
|
3244
|
+
def _SegmentImageSource_to_vertex(
|
4543
3245
|
from_object: Union[dict[str, Any], object],
|
4544
3246
|
parent_object: Optional[dict[str, Any]] = None,
|
4545
3247
|
) -> dict[str, Any]:
|
4546
3248
|
to_object: dict[str, Any] = {}
|
4547
|
-
if getv(from_object, ['
|
3249
|
+
if getv(from_object, ['prompt']) is not None:
|
4548
3250
|
setv(
|
4549
|
-
|
4550
|
-
['functionCallingConfig'],
|
4551
|
-
_FunctionCallingConfig_to_mldev(
|
4552
|
-
getv(from_object, ['function_calling_config']), to_object
|
4553
|
-
),
|
3251
|
+
parent_object, ['instances[0]', 'prompt'], getv(from_object, ['prompt'])
|
4554
3252
|
)
|
4555
3253
|
|
4556
|
-
if getv(from_object, ['
|
3254
|
+
if getv(from_object, ['image']) is not None:
|
4557
3255
|
setv(
|
4558
|
-
|
4559
|
-
['
|
4560
|
-
|
4561
|
-
|
3256
|
+
parent_object,
|
3257
|
+
['instances[0]', 'image'],
|
3258
|
+
_Image_to_vertex(getv(from_object, ['image']), to_object),
|
3259
|
+
)
|
3260
|
+
|
3261
|
+
if getv(from_object, ['scribble_image']) is not None:
|
3262
|
+
setv(
|
3263
|
+
parent_object,
|
3264
|
+
['instances[0]', 'scribble'],
|
3265
|
+
_ScribbleImage_to_vertex(
|
3266
|
+
getv(from_object, ['scribble_image']), to_object
|
4562
3267
|
),
|
4563
3268
|
)
|
4564
3269
|
|
4565
3270
|
return to_object
|
4566
3271
|
|
4567
3272
|
|
4568
|
-
def
|
3273
|
+
def _SpeechConfig_to_vertex(
|
4569
3274
|
from_object: Union[dict[str, Any], object],
|
4570
3275
|
parent_object: Optional[dict[str, Any]] = None,
|
4571
3276
|
) -> dict[str, Any]:
|
4572
3277
|
to_object: dict[str, Any] = {}
|
4573
|
-
if getv(from_object, ['
|
4574
|
-
setv(
|
4575
|
-
to_object,
|
4576
|
-
['functionCallingConfig'],
|
4577
|
-
_FunctionCallingConfig_to_vertex(
|
4578
|
-
getv(from_object, ['function_calling_config']), to_object
|
4579
|
-
),
|
4580
|
-
)
|
3278
|
+
if getv(from_object, ['voice_config']) is not None:
|
3279
|
+
setv(to_object, ['voiceConfig'], getv(from_object, ['voice_config']))
|
4581
3280
|
|
4582
|
-
if getv(from_object, ['
|
4583
|
-
|
4584
|
-
|
4585
|
-
['retrievalConfig'],
|
4586
|
-
_RetrievalConfig_to_vertex(
|
4587
|
-
getv(from_object, ['retrieval_config']), to_object
|
4588
|
-
),
|
3281
|
+
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
3282
|
+
raise ValueError(
|
3283
|
+
'multi_speaker_voice_config parameter is not supported in Vertex AI.'
|
4589
3284
|
)
|
4590
3285
|
|
3286
|
+
if getv(from_object, ['language_code']) is not None:
|
3287
|
+
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
3288
|
+
|
4591
3289
|
return to_object
|
4592
3290
|
|
4593
3291
|
|
@@ -4600,10 +3298,7 @@ def _Tool_to_mldev(
|
|
4600
3298
|
setv(
|
4601
3299
|
to_object,
|
4602
3300
|
['functionDeclarations'],
|
4603
|
-
[
|
4604
|
-
_FunctionDeclaration_to_mldev(item, to_object)
|
4605
|
-
for item in getv(from_object, ['function_declarations'])
|
4606
|
-
],
|
3301
|
+
[item for item in getv(from_object, ['function_declarations'])],
|
4607
3302
|
)
|
4608
3303
|
|
4609
3304
|
if getv(from_object, ['retrieval']) is not None:
|
@@ -4620,9 +3315,7 @@ def _Tool_to_mldev(
|
|
4620
3315
|
setv(
|
4621
3316
|
to_object,
|
4622
3317
|
['googleSearchRetrieval'],
|
4623
|
-
|
4624
|
-
getv(from_object, ['google_search_retrieval']), to_object
|
4625
|
-
),
|
3318
|
+
getv(from_object, ['google_search_retrieval']),
|
4626
3319
|
)
|
4627
3320
|
|
4628
3321
|
if getv(from_object, ['enterprise_web_search']) is not None:
|
@@ -4631,21 +3324,17 @@ def _Tool_to_mldev(
|
|
4631
3324
|
)
|
4632
3325
|
|
4633
3326
|
if getv(from_object, ['google_maps']) is not None:
|
4634
|
-
raise ValueError('google_maps parameter is not supported in Gemini API.')
|
4635
|
-
|
4636
|
-
if getv(from_object, ['url_context']) is not None:
|
4637
3327
|
setv(
|
4638
3328
|
to_object,
|
4639
|
-
['
|
4640
|
-
|
3329
|
+
['googleMaps'],
|
3330
|
+
_GoogleMaps_to_mldev(getv(from_object, ['google_maps']), to_object),
|
4641
3331
|
)
|
4642
3332
|
|
3333
|
+
if getv(from_object, ['url_context']) is not None:
|
3334
|
+
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
3335
|
+
|
4643
3336
|
if getv(from_object, ['computer_use']) is not None:
|
4644
|
-
setv(
|
4645
|
-
to_object,
|
4646
|
-
['computerUse'],
|
4647
|
-
_ComputerUse_to_mldev(getv(from_object, ['computer_use']), to_object),
|
4648
|
-
)
|
3337
|
+
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
4649
3338
|
|
4650
3339
|
if getv(from_object, ['code_execution']) is not None:
|
4651
3340
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
@@ -4672,52 +3361,30 @@ def _Tool_to_vertex(
|
|
4672
3361
|
setv(to_object, ['retrieval'], getv(from_object, ['retrieval']))
|
4673
3362
|
|
4674
3363
|
if getv(from_object, ['google_search']) is not None:
|
4675
|
-
setv(
|
4676
|
-
to_object,
|
4677
|
-
['googleSearch'],
|
4678
|
-
_GoogleSearch_to_vertex(
|
4679
|
-
getv(from_object, ['google_search']), to_object
|
4680
|
-
),
|
4681
|
-
)
|
3364
|
+
setv(to_object, ['googleSearch'], getv(from_object, ['google_search']))
|
4682
3365
|
|
4683
3366
|
if getv(from_object, ['google_search_retrieval']) is not None:
|
4684
3367
|
setv(
|
4685
3368
|
to_object,
|
4686
3369
|
['googleSearchRetrieval'],
|
4687
|
-
|
4688
|
-
getv(from_object, ['google_search_retrieval']), to_object
|
4689
|
-
),
|
3370
|
+
getv(from_object, ['google_search_retrieval']),
|
4690
3371
|
)
|
4691
3372
|
|
4692
3373
|
if getv(from_object, ['enterprise_web_search']) is not None:
|
4693
3374
|
setv(
|
4694
3375
|
to_object,
|
4695
3376
|
['enterpriseWebSearch'],
|
4696
|
-
|
4697
|
-
getv(from_object, ['enterprise_web_search']), to_object
|
4698
|
-
),
|
3377
|
+
getv(from_object, ['enterprise_web_search']),
|
4699
3378
|
)
|
4700
3379
|
|
4701
3380
|
if getv(from_object, ['google_maps']) is not None:
|
4702
|
-
setv(
|
4703
|
-
to_object,
|
4704
|
-
['googleMaps'],
|
4705
|
-
_GoogleMaps_to_vertex(getv(from_object, ['google_maps']), to_object),
|
4706
|
-
)
|
3381
|
+
setv(to_object, ['googleMaps'], getv(from_object, ['google_maps']))
|
4707
3382
|
|
4708
3383
|
if getv(from_object, ['url_context']) is not None:
|
4709
|
-
setv(
|
4710
|
-
to_object,
|
4711
|
-
['urlContext'],
|
4712
|
-
_UrlContext_to_vertex(getv(from_object, ['url_context']), to_object),
|
4713
|
-
)
|
3384
|
+
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
4714
3385
|
|
4715
3386
|
if getv(from_object, ['computer_use']) is not None:
|
4716
|
-
setv(
|
4717
|
-
to_object,
|
4718
|
-
['computerUse'],
|
4719
|
-
_ComputerUse_to_vertex(getv(from_object, ['computer_use']), to_object),
|
4720
|
-
)
|
3387
|
+
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
4721
3388
|
|
4722
3389
|
if getv(from_object, ['code_execution']) is not None:
|
4723
3390
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
@@ -4725,23 +3392,6 @@ def _Tool_to_vertex(
|
|
4725
3392
|
return to_object
|
4726
3393
|
|
4727
3394
|
|
4728
|
-
def _TunedModelInfo_from_mldev(
|
4729
|
-
from_object: Union[dict[str, Any], object],
|
4730
|
-
parent_object: Optional[dict[str, Any]] = None,
|
4731
|
-
) -> dict[str, Any]:
|
4732
|
-
to_object: dict[str, Any] = {}
|
4733
|
-
if getv(from_object, ['baseModel']) is not None:
|
4734
|
-
setv(to_object, ['base_model'], getv(from_object, ['baseModel']))
|
4735
|
-
|
4736
|
-
if getv(from_object, ['createTime']) is not None:
|
4737
|
-
setv(to_object, ['create_time'], getv(from_object, ['createTime']))
|
4738
|
-
|
4739
|
-
if getv(from_object, ['updateTime']) is not None:
|
4740
|
-
setv(to_object, ['update_time'], getv(from_object, ['updateTime']))
|
4741
|
-
|
4742
|
-
return to_object
|
4743
|
-
|
4744
|
-
|
4745
3395
|
def _TunedModelInfo_from_vertex(
|
4746
3396
|
from_object: Union[dict[str, Any], object],
|
4747
3397
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -4896,6 +3546,9 @@ def _UpscaleImageAPIConfig_to_vertex(
|
|
4896
3546
|
getv(from_object, ['image_preservation_factor']),
|
4897
3547
|
)
|
4898
3548
|
|
3549
|
+
if getv(from_object, ['labels']) is not None:
|
3550
|
+
setv(parent_object, ['labels'], getv(from_object, ['labels']))
|
3551
|
+
|
4899
3552
|
if getv(from_object, ['number_of_images']) is not None:
|
4900
3553
|
setv(
|
4901
3554
|
parent_object,
|
@@ -4965,96 +3618,6 @@ def _UpscaleImageResponse_from_vertex(
|
|
4965
3618
|
return to_object
|
4966
3619
|
|
4967
3620
|
|
4968
|
-
def _UrlContextMetadata_from_mldev(
|
4969
|
-
from_object: Union[dict[str, Any], object],
|
4970
|
-
parent_object: Optional[dict[str, Any]] = None,
|
4971
|
-
) -> dict[str, Any]:
|
4972
|
-
to_object: dict[str, Any] = {}
|
4973
|
-
if getv(from_object, ['urlMetadata']) is not None:
|
4974
|
-
setv(
|
4975
|
-
to_object,
|
4976
|
-
['url_metadata'],
|
4977
|
-
[
|
4978
|
-
_UrlMetadata_from_mldev(item, to_object)
|
4979
|
-
for item in getv(from_object, ['urlMetadata'])
|
4980
|
-
],
|
4981
|
-
)
|
4982
|
-
|
4983
|
-
return to_object
|
4984
|
-
|
4985
|
-
|
4986
|
-
def _UrlContextMetadata_from_vertex(
|
4987
|
-
from_object: Union[dict[str, Any], object],
|
4988
|
-
parent_object: Optional[dict[str, Any]] = None,
|
4989
|
-
) -> dict[str, Any]:
|
4990
|
-
to_object: dict[str, Any] = {}
|
4991
|
-
if getv(from_object, ['urlMetadata']) is not None:
|
4992
|
-
setv(
|
4993
|
-
to_object,
|
4994
|
-
['url_metadata'],
|
4995
|
-
[
|
4996
|
-
_UrlMetadata_from_vertex(item, to_object)
|
4997
|
-
for item in getv(from_object, ['urlMetadata'])
|
4998
|
-
],
|
4999
|
-
)
|
5000
|
-
|
5001
|
-
return to_object
|
5002
|
-
|
5003
|
-
|
5004
|
-
def _UrlContext_to_mldev(
|
5005
|
-
from_object: Union[dict[str, Any], object],
|
5006
|
-
parent_object: Optional[dict[str, Any]] = None,
|
5007
|
-
) -> dict[str, Any]:
|
5008
|
-
to_object: dict[str, Any] = {}
|
5009
|
-
|
5010
|
-
return to_object
|
5011
|
-
|
5012
|
-
|
5013
|
-
def _UrlContext_to_vertex(
|
5014
|
-
from_object: Union[dict[str, Any], object],
|
5015
|
-
parent_object: Optional[dict[str, Any]] = None,
|
5016
|
-
) -> dict[str, Any]:
|
5017
|
-
to_object: dict[str, Any] = {}
|
5018
|
-
|
5019
|
-
return to_object
|
5020
|
-
|
5021
|
-
|
5022
|
-
def _UrlMetadata_from_mldev(
|
5023
|
-
from_object: Union[dict[str, Any], object],
|
5024
|
-
parent_object: Optional[dict[str, Any]] = None,
|
5025
|
-
) -> dict[str, Any]:
|
5026
|
-
to_object: dict[str, Any] = {}
|
5027
|
-
if getv(from_object, ['retrievedUrl']) is not None:
|
5028
|
-
setv(to_object, ['retrieved_url'], getv(from_object, ['retrievedUrl']))
|
5029
|
-
|
5030
|
-
if getv(from_object, ['urlRetrievalStatus']) is not None:
|
5031
|
-
setv(
|
5032
|
-
to_object,
|
5033
|
-
['url_retrieval_status'],
|
5034
|
-
getv(from_object, ['urlRetrievalStatus']),
|
5035
|
-
)
|
5036
|
-
|
5037
|
-
return to_object
|
5038
|
-
|
5039
|
-
|
5040
|
-
def _UrlMetadata_from_vertex(
|
5041
|
-
from_object: Union[dict[str, Any], object],
|
5042
|
-
parent_object: Optional[dict[str, Any]] = None,
|
5043
|
-
) -> dict[str, Any]:
|
5044
|
-
to_object: dict[str, Any] = {}
|
5045
|
-
if getv(from_object, ['retrievedUrl']) is not None:
|
5046
|
-
setv(to_object, ['retrieved_url'], getv(from_object, ['retrievedUrl']))
|
5047
|
-
|
5048
|
-
if getv(from_object, ['urlRetrievalStatus']) is not None:
|
5049
|
-
setv(
|
5050
|
-
to_object,
|
5051
|
-
['url_retrieval_status'],
|
5052
|
-
getv(from_object, ['urlRetrievalStatus']),
|
5053
|
-
)
|
5054
|
-
|
5055
|
-
return to_object
|
5056
|
-
|
5057
|
-
|
5058
3621
|
def _VideoGenerationMask_to_vertex(
|
5059
3622
|
from_object: Union[dict[str, Any], object],
|
5060
3623
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -5073,7 +3636,7 @@ def _VideoGenerationMask_to_vertex(
|
|
5073
3636
|
return to_object
|
5074
3637
|
|
5075
3638
|
|
5076
|
-
def
|
3639
|
+
def _VideoGenerationReferenceImage_to_mldev(
|
5077
3640
|
from_object: Union[dict[str, Any], object],
|
5078
3641
|
parent_object: Optional[dict[str, Any]] = None,
|
5079
3642
|
) -> dict[str, Any]:
|
@@ -5082,79 +3645,32 @@ def _VideoGenerationReferenceImage_to_vertex(
|
|
5082
3645
|
setv(
|
5083
3646
|
to_object,
|
5084
3647
|
['image'],
|
5085
|
-
|
3648
|
+
_Image_to_mldev(getv(from_object, ['image']), to_object),
|
5086
3649
|
)
|
5087
3650
|
|
5088
3651
|
if getv(from_object, ['reference_type']) is not None:
|
3652
|
+
_VideoGenerationReferenceType_to_mldev_enum_validate(
|
3653
|
+
getv(from_object, ['reference_type'])
|
3654
|
+
)
|
5089
3655
|
setv(to_object, ['referenceType'], getv(from_object, ['reference_type']))
|
5090
3656
|
|
5091
3657
|
return to_object
|
5092
3658
|
|
5093
3659
|
|
5094
|
-
def
|
5095
|
-
from_object: Union[dict[str, Any], object],
|
5096
|
-
parent_object: Optional[dict[str, Any]] = None,
|
5097
|
-
) -> dict[str, Any]:
|
5098
|
-
to_object: dict[str, Any] = {}
|
5099
|
-
if getv(from_object, ['fps']) is not None:
|
5100
|
-
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
5101
|
-
|
5102
|
-
if getv(from_object, ['endOffset']) is not None:
|
5103
|
-
setv(to_object, ['end_offset'], getv(from_object, ['endOffset']))
|
5104
|
-
|
5105
|
-
if getv(from_object, ['startOffset']) is not None:
|
5106
|
-
setv(to_object, ['start_offset'], getv(from_object, ['startOffset']))
|
5107
|
-
|
5108
|
-
return to_object
|
5109
|
-
|
5110
|
-
|
5111
|
-
def _VideoMetadata_from_vertex(
|
5112
|
-
from_object: Union[dict[str, Any], object],
|
5113
|
-
parent_object: Optional[dict[str, Any]] = None,
|
5114
|
-
) -> dict[str, Any]:
|
5115
|
-
to_object: dict[str, Any] = {}
|
5116
|
-
if getv(from_object, ['fps']) is not None:
|
5117
|
-
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
5118
|
-
|
5119
|
-
if getv(from_object, ['endOffset']) is not None:
|
5120
|
-
setv(to_object, ['end_offset'], getv(from_object, ['endOffset']))
|
5121
|
-
|
5122
|
-
if getv(from_object, ['startOffset']) is not None:
|
5123
|
-
setv(to_object, ['start_offset'], getv(from_object, ['startOffset']))
|
5124
|
-
|
5125
|
-
return to_object
|
5126
|
-
|
5127
|
-
|
5128
|
-
def _VideoMetadata_to_mldev(
|
5129
|
-
from_object: Union[dict[str, Any], object],
|
5130
|
-
parent_object: Optional[dict[str, Any]] = None,
|
5131
|
-
) -> dict[str, Any]:
|
5132
|
-
to_object: dict[str, Any] = {}
|
5133
|
-
if getv(from_object, ['fps']) is not None:
|
5134
|
-
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
5135
|
-
|
5136
|
-
if getv(from_object, ['end_offset']) is not None:
|
5137
|
-
setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
|
5138
|
-
|
5139
|
-
if getv(from_object, ['start_offset']) is not None:
|
5140
|
-
setv(to_object, ['startOffset'], getv(from_object, ['start_offset']))
|
5141
|
-
|
5142
|
-
return to_object
|
5143
|
-
|
5144
|
-
|
5145
|
-
def _VideoMetadata_to_vertex(
|
3660
|
+
def _VideoGenerationReferenceImage_to_vertex(
|
5146
3661
|
from_object: Union[dict[str, Any], object],
|
5147
3662
|
parent_object: Optional[dict[str, Any]] = None,
|
5148
3663
|
) -> dict[str, Any]:
|
5149
3664
|
to_object: dict[str, Any] = {}
|
5150
|
-
if getv(from_object, ['
|
5151
|
-
setv(
|
5152
|
-
|
5153
|
-
|
5154
|
-
|
3665
|
+
if getv(from_object, ['image']) is not None:
|
3666
|
+
setv(
|
3667
|
+
to_object,
|
3668
|
+
['image'],
|
3669
|
+
_Image_to_vertex(getv(from_object, ['image']), to_object),
|
3670
|
+
)
|
5155
3671
|
|
5156
|
-
if getv(from_object, ['
|
5157
|
-
setv(to_object, ['
|
3672
|
+
if getv(from_object, ['reference_type']) is not None:
|
3673
|
+
setv(to_object, ['referenceType'], getv(from_object, ['reference_type']))
|
5158
3674
|
|
5159
3675
|
return to_object
|
5160
3676
|
|
@@ -5201,58 +3717,45 @@ def _Video_from_vertex(
|
|
5201
3717
|
return to_object
|
5202
3718
|
|
5203
3719
|
|
5204
|
-
def
|
3720
|
+
def _Video_to_mldev(
|
5205
3721
|
from_object: Union[dict[str, Any], object],
|
5206
3722
|
parent_object: Optional[dict[str, Any]] = None,
|
5207
3723
|
) -> dict[str, Any]:
|
5208
3724
|
to_object: dict[str, Any] = {}
|
5209
3725
|
if getv(from_object, ['uri']) is not None:
|
5210
|
-
setv(to_object, ['
|
3726
|
+
setv(to_object, ['video', 'uri'], getv(from_object, ['uri']))
|
5211
3727
|
|
5212
3728
|
if getv(from_object, ['video_bytes']) is not None:
|
5213
3729
|
setv(
|
5214
3730
|
to_object,
|
5215
|
-
['
|
3731
|
+
['video', 'encodedVideo'],
|
5216
3732
|
base_t.t_bytes(getv(from_object, ['video_bytes'])),
|
5217
3733
|
)
|
5218
3734
|
|
5219
3735
|
if getv(from_object, ['mime_type']) is not None:
|
5220
|
-
setv(to_object, ['
|
3736
|
+
setv(to_object, ['encoding'], getv(from_object, ['mime_type']))
|
5221
3737
|
|
5222
3738
|
return to_object
|
5223
3739
|
|
5224
3740
|
|
5225
|
-
def
|
3741
|
+
def _Video_to_vertex(
|
5226
3742
|
from_object: Union[dict[str, Any], object],
|
5227
3743
|
parent_object: Optional[dict[str, Any]] = None,
|
5228
3744
|
) -> dict[str, Any]:
|
5229
3745
|
to_object: dict[str, Any] = {}
|
5230
|
-
if getv(from_object, ['
|
5231
|
-
setv(
|
5232
|
-
to_object,
|
5233
|
-
['prebuiltVoiceConfig'],
|
5234
|
-
_PrebuiltVoiceConfig_to_mldev(
|
5235
|
-
getv(from_object, ['prebuilt_voice_config']), to_object
|
5236
|
-
),
|
5237
|
-
)
|
5238
|
-
|
5239
|
-
return to_object
|
5240
|
-
|
3746
|
+
if getv(from_object, ['uri']) is not None:
|
3747
|
+
setv(to_object, ['gcsUri'], getv(from_object, ['uri']))
|
5241
3748
|
|
5242
|
-
|
5243
|
-
from_object: Union[dict[str, Any], object],
|
5244
|
-
parent_object: Optional[dict[str, Any]] = None,
|
5245
|
-
) -> dict[str, Any]:
|
5246
|
-
to_object: dict[str, Any] = {}
|
5247
|
-
if getv(from_object, ['prebuilt_voice_config']) is not None:
|
3749
|
+
if getv(from_object, ['video_bytes']) is not None:
|
5248
3750
|
setv(
|
5249
3751
|
to_object,
|
5250
|
-
['
|
5251
|
-
|
5252
|
-
getv(from_object, ['prebuilt_voice_config']), to_object
|
5253
|
-
),
|
3752
|
+
['bytesBase64Encoded'],
|
3753
|
+
base_t.t_bytes(getv(from_object, ['video_bytes'])),
|
5254
3754
|
)
|
5255
3755
|
|
3756
|
+
if getv(from_object, ['mime_type']) is not None:
|
3757
|
+
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
3758
|
+
|
5256
3759
|
return to_object
|
5257
3760
|
|
5258
3761
|
|
@@ -5318,12 +3821,12 @@ class Models(_api_module.BaseModule):
|
|
5318
3821
|
self._api_client._verify_response(return_value)
|
5319
3822
|
return return_value
|
5320
3823
|
|
5321
|
-
response_dict =
|
3824
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5322
3825
|
|
5323
3826
|
if self._api_client.vertexai:
|
5324
3827
|
response_dict = _GenerateContentResponse_from_vertex(response_dict)
|
5325
3828
|
|
5326
|
-
|
3829
|
+
if not self._api_client.vertexai:
|
5327
3830
|
response_dict = _GenerateContentResponse_from_mldev(response_dict)
|
5328
3831
|
|
5329
3832
|
return_value = types.GenerateContentResponse._from_response(
|
@@ -5400,12 +3903,12 @@ class Models(_api_module.BaseModule):
|
|
5400
3903
|
'post', path, request_dict, http_options
|
5401
3904
|
):
|
5402
3905
|
|
5403
|
-
response_dict =
|
3906
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5404
3907
|
|
5405
3908
|
if self._api_client.vertexai:
|
5406
3909
|
response_dict = _GenerateContentResponse_from_vertex(response_dict)
|
5407
3910
|
|
5408
|
-
|
3911
|
+
if not self._api_client.vertexai:
|
5409
3912
|
response_dict = _GenerateContentResponse_from_mldev(response_dict)
|
5410
3913
|
|
5411
3914
|
return_value = types.GenerateContentResponse._from_response(
|
@@ -5493,12 +3996,12 @@ class Models(_api_module.BaseModule):
|
|
5493
3996
|
'post', path, request_dict, http_options
|
5494
3997
|
)
|
5495
3998
|
|
5496
|
-
response_dict =
|
3999
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5497
4000
|
|
5498
4001
|
if self._api_client.vertexai:
|
5499
4002
|
response_dict = _EmbedContentResponse_from_vertex(response_dict)
|
5500
4003
|
|
5501
|
-
|
4004
|
+
if not self._api_client.vertexai:
|
5502
4005
|
response_dict = _EmbedContentResponse_from_mldev(response_dict)
|
5503
4006
|
|
5504
4007
|
return_value = types.EmbedContentResponse._from_response(
|
@@ -5565,12 +4068,12 @@ class Models(_api_module.BaseModule):
|
|
5565
4068
|
'post', path, request_dict, http_options
|
5566
4069
|
)
|
5567
4070
|
|
5568
|
-
response_dict =
|
4071
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5569
4072
|
|
5570
4073
|
if self._api_client.vertexai:
|
5571
4074
|
response_dict = _GenerateImagesResponse_from_vertex(response_dict)
|
5572
4075
|
|
5573
|
-
|
4076
|
+
if not self._api_client.vertexai:
|
5574
4077
|
response_dict = _GenerateImagesResponse_from_mldev(response_dict)
|
5575
4078
|
|
5576
4079
|
return_value = types.GenerateImagesResponse._from_response(
|
@@ -5632,7 +4135,7 @@ class Models(_api_module.BaseModule):
|
|
5632
4135
|
'post', path, request_dict, http_options
|
5633
4136
|
)
|
5634
4137
|
|
5635
|
-
response_dict =
|
4138
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5636
4139
|
|
5637
4140
|
if self._api_client.vertexai:
|
5638
4141
|
response_dict = _EditImageResponse_from_vertex(response_dict)
|
@@ -5696,7 +4199,7 @@ class Models(_api_module.BaseModule):
|
|
5696
4199
|
'post', path, request_dict, http_options
|
5697
4200
|
)
|
5698
4201
|
|
5699
|
-
response_dict =
|
4202
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5700
4203
|
|
5701
4204
|
if self._api_client.vertexai:
|
5702
4205
|
response_dict = _UpscaleImageResponse_from_vertex(response_dict)
|
@@ -5804,7 +4307,7 @@ class Models(_api_module.BaseModule):
|
|
5804
4307
|
'post', path, request_dict, http_options
|
5805
4308
|
)
|
5806
4309
|
|
5807
|
-
response_dict =
|
4310
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5808
4311
|
|
5809
4312
|
if self._api_client.vertexai:
|
5810
4313
|
response_dict = _RecontextImageResponse_from_vertex(response_dict)
|
@@ -5887,7 +4390,7 @@ class Models(_api_module.BaseModule):
|
|
5887
4390
|
'post', path, request_dict, http_options
|
5888
4391
|
)
|
5889
4392
|
|
5890
|
-
response_dict =
|
4393
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5891
4394
|
|
5892
4395
|
if self._api_client.vertexai:
|
5893
4396
|
response_dict = _SegmentImageResponse_from_vertex(response_dict)
|
@@ -5945,12 +4448,12 @@ class Models(_api_module.BaseModule):
|
|
5945
4448
|
|
5946
4449
|
response = self._api_client.request('get', path, request_dict, http_options)
|
5947
4450
|
|
5948
|
-
response_dict =
|
4451
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5949
4452
|
|
5950
4453
|
if self._api_client.vertexai:
|
5951
4454
|
response_dict = _Model_from_vertex(response_dict)
|
5952
4455
|
|
5953
|
-
|
4456
|
+
if not self._api_client.vertexai:
|
5954
4457
|
response_dict = _Model_from_mldev(response_dict)
|
5955
4458
|
|
5956
4459
|
return_value = types.Model._from_response(
|
@@ -6005,12 +4508,12 @@ class Models(_api_module.BaseModule):
|
|
6005
4508
|
|
6006
4509
|
response = self._api_client.request('get', path, request_dict, http_options)
|
6007
4510
|
|
6008
|
-
response_dict =
|
4511
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
6009
4512
|
|
6010
4513
|
if self._api_client.vertexai:
|
6011
4514
|
response_dict = _ListModelsResponse_from_vertex(response_dict)
|
6012
4515
|
|
6013
|
-
|
4516
|
+
if not self._api_client.vertexai:
|
6014
4517
|
response_dict = _ListModelsResponse_from_mldev(response_dict)
|
6015
4518
|
|
6016
4519
|
return_value = types.ListModelsResponse._from_response(
|
@@ -6073,12 +4576,12 @@ class Models(_api_module.BaseModule):
|
|
6073
4576
|
'patch', path, request_dict, http_options
|
6074
4577
|
)
|
6075
4578
|
|
6076
|
-
response_dict =
|
4579
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
6077
4580
|
|
6078
4581
|
if self._api_client.vertexai:
|
6079
4582
|
response_dict = _Model_from_vertex(response_dict)
|
6080
4583
|
|
6081
|
-
|
4584
|
+
if not self._api_client.vertexai:
|
6082
4585
|
response_dict = _Model_from_mldev(response_dict)
|
6083
4586
|
|
6084
4587
|
return_value = types.Model._from_response(
|
@@ -6139,12 +4642,12 @@ class Models(_api_module.BaseModule):
|
|
6139
4642
|
'delete', path, request_dict, http_options
|
6140
4643
|
)
|
6141
4644
|
|
6142
|
-
response_dict =
|
4645
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
6143
4646
|
|
6144
4647
|
if self._api_client.vertexai:
|
6145
4648
|
response_dict = _DeleteModelResponse_from_vertex(response_dict)
|
6146
4649
|
|
6147
|
-
|
4650
|
+
if not self._api_client.vertexai:
|
6148
4651
|
response_dict = _DeleteModelResponse_from_mldev(response_dict)
|
6149
4652
|
|
6150
4653
|
return_value = types.DeleteModelResponse._from_response(
|
@@ -6230,12 +4733,12 @@ class Models(_api_module.BaseModule):
|
|
6230
4733
|
'post', path, request_dict, http_options
|
6231
4734
|
)
|
6232
4735
|
|
6233
|
-
response_dict =
|
4736
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
6234
4737
|
|
6235
4738
|
if self._api_client.vertexai:
|
6236
4739
|
response_dict = _CountTokensResponse_from_vertex(response_dict)
|
6237
4740
|
|
6238
|
-
|
4741
|
+
if not self._api_client.vertexai:
|
6239
4742
|
response_dict = _CountTokensResponse_from_mldev(response_dict)
|
6240
4743
|
|
6241
4744
|
return_value = types.CountTokensResponse._from_response(
|
@@ -6316,7 +4819,7 @@ class Models(_api_module.BaseModule):
|
|
6316
4819
|
'post', path, request_dict, http_options
|
6317
4820
|
)
|
6318
4821
|
|
6319
|
-
response_dict =
|
4822
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
6320
4823
|
|
6321
4824
|
if self._api_client.vertexai:
|
6322
4825
|
response_dict = _ComputeTokensResponse_from_vertex(response_dict)
|
@@ -6391,12 +4894,12 @@ class Models(_api_module.BaseModule):
|
|
6391
4894
|
'post', path, request_dict, http_options
|
6392
4895
|
)
|
6393
4896
|
|
6394
|
-
response_dict =
|
4897
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
6395
4898
|
|
6396
4899
|
if self._api_client.vertexai:
|
6397
4900
|
response_dict = _GenerateVideosOperation_from_vertex(response_dict)
|
6398
4901
|
|
6399
|
-
|
4902
|
+
if not self._api_client.vertexai:
|
6400
4903
|
response_dict = _GenerateVideosOperation_from_mldev(response_dict)
|
6401
4904
|
|
6402
4905
|
return_value = types.GenerateVideosOperation._from_response(
|
@@ -6877,6 +5380,7 @@ class Models(_api_module.BaseModule):
|
|
6877
5380
|
image_preservation_factor=config_dct.get(
|
6878
5381
|
'image_preservation_factor', None
|
6879
5382
|
),
|
5383
|
+
labels=config_dct.get('labels', None),
|
6880
5384
|
) # pylint: disable=protected-access
|
6881
5385
|
|
6882
5386
|
# Provide default values through API config.
|
@@ -7066,12 +5570,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7066
5570
|
self._api_client._verify_response(return_value)
|
7067
5571
|
return return_value
|
7068
5572
|
|
7069
|
-
response_dict =
|
5573
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7070
5574
|
|
7071
5575
|
if self._api_client.vertexai:
|
7072
5576
|
response_dict = _GenerateContentResponse_from_vertex(response_dict)
|
7073
5577
|
|
7074
|
-
|
5578
|
+
if not self._api_client.vertexai:
|
7075
5579
|
response_dict = _GenerateContentResponse_from_mldev(response_dict)
|
7076
5580
|
|
7077
5581
|
return_value = types.GenerateContentResponse._from_response(
|
@@ -7151,12 +5655,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7151
5655
|
async def async_generator(): # type: ignore[no-untyped-def]
|
7152
5656
|
async for response in response_stream:
|
7153
5657
|
|
7154
|
-
response_dict =
|
5658
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7155
5659
|
|
7156
5660
|
if self._api_client.vertexai:
|
7157
5661
|
response_dict = _GenerateContentResponse_from_vertex(response_dict)
|
7158
5662
|
|
7159
|
-
|
5663
|
+
if not self._api_client.vertexai:
|
7160
5664
|
response_dict = _GenerateContentResponse_from_mldev(response_dict)
|
7161
5665
|
|
7162
5666
|
return_value = types.GenerateContentResponse._from_response(
|
@@ -7246,12 +5750,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7246
5750
|
'post', path, request_dict, http_options
|
7247
5751
|
)
|
7248
5752
|
|
7249
|
-
response_dict =
|
5753
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7250
5754
|
|
7251
5755
|
if self._api_client.vertexai:
|
7252
5756
|
response_dict = _EmbedContentResponse_from_vertex(response_dict)
|
7253
5757
|
|
7254
|
-
|
5758
|
+
if not self._api_client.vertexai:
|
7255
5759
|
response_dict = _EmbedContentResponse_from_mldev(response_dict)
|
7256
5760
|
|
7257
5761
|
return_value = types.EmbedContentResponse._from_response(
|
@@ -7318,12 +5822,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7318
5822
|
'post', path, request_dict, http_options
|
7319
5823
|
)
|
7320
5824
|
|
7321
|
-
response_dict =
|
5825
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7322
5826
|
|
7323
5827
|
if self._api_client.vertexai:
|
7324
5828
|
response_dict = _GenerateImagesResponse_from_vertex(response_dict)
|
7325
5829
|
|
7326
|
-
|
5830
|
+
if not self._api_client.vertexai:
|
7327
5831
|
response_dict = _GenerateImagesResponse_from_mldev(response_dict)
|
7328
5832
|
|
7329
5833
|
return_value = types.GenerateImagesResponse._from_response(
|
@@ -7385,7 +5889,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
7385
5889
|
'post', path, request_dict, http_options
|
7386
5890
|
)
|
7387
5891
|
|
7388
|
-
response_dict =
|
5892
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7389
5893
|
|
7390
5894
|
if self._api_client.vertexai:
|
7391
5895
|
response_dict = _EditImageResponse_from_vertex(response_dict)
|
@@ -7449,7 +5953,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
7449
5953
|
'post', path, request_dict, http_options
|
7450
5954
|
)
|
7451
5955
|
|
7452
|
-
response_dict =
|
5956
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7453
5957
|
|
7454
5958
|
if self._api_client.vertexai:
|
7455
5959
|
response_dict = _UpscaleImageResponse_from_vertex(response_dict)
|
@@ -7557,7 +6061,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
7557
6061
|
'post', path, request_dict, http_options
|
7558
6062
|
)
|
7559
6063
|
|
7560
|
-
response_dict =
|
6064
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7561
6065
|
|
7562
6066
|
if self._api_client.vertexai:
|
7563
6067
|
response_dict = _RecontextImageResponse_from_vertex(response_dict)
|
@@ -7643,7 +6147,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
7643
6147
|
'post', path, request_dict, http_options
|
7644
6148
|
)
|
7645
6149
|
|
7646
|
-
response_dict =
|
6150
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7647
6151
|
|
7648
6152
|
if self._api_client.vertexai:
|
7649
6153
|
response_dict = _SegmentImageResponse_from_vertex(response_dict)
|
@@ -7703,12 +6207,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7703
6207
|
'get', path, request_dict, http_options
|
7704
6208
|
)
|
7705
6209
|
|
7706
|
-
response_dict =
|
6210
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7707
6211
|
|
7708
6212
|
if self._api_client.vertexai:
|
7709
6213
|
response_dict = _Model_from_vertex(response_dict)
|
7710
6214
|
|
7711
|
-
|
6215
|
+
if not self._api_client.vertexai:
|
7712
6216
|
response_dict = _Model_from_mldev(response_dict)
|
7713
6217
|
|
7714
6218
|
return_value = types.Model._from_response(
|
@@ -7765,12 +6269,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7765
6269
|
'get', path, request_dict, http_options
|
7766
6270
|
)
|
7767
6271
|
|
7768
|
-
response_dict =
|
6272
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7769
6273
|
|
7770
6274
|
if self._api_client.vertexai:
|
7771
6275
|
response_dict = _ListModelsResponse_from_vertex(response_dict)
|
7772
6276
|
|
7773
|
-
|
6277
|
+
if not self._api_client.vertexai:
|
7774
6278
|
response_dict = _ListModelsResponse_from_mldev(response_dict)
|
7775
6279
|
|
7776
6280
|
return_value = types.ListModelsResponse._from_response(
|
@@ -7833,12 +6337,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7833
6337
|
'patch', path, request_dict, http_options
|
7834
6338
|
)
|
7835
6339
|
|
7836
|
-
response_dict =
|
6340
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7837
6341
|
|
7838
6342
|
if self._api_client.vertexai:
|
7839
6343
|
response_dict = _Model_from_vertex(response_dict)
|
7840
6344
|
|
7841
|
-
|
6345
|
+
if not self._api_client.vertexai:
|
7842
6346
|
response_dict = _Model_from_mldev(response_dict)
|
7843
6347
|
|
7844
6348
|
return_value = types.Model._from_response(
|
@@ -7899,12 +6403,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7899
6403
|
'delete', path, request_dict, http_options
|
7900
6404
|
)
|
7901
6405
|
|
7902
|
-
response_dict =
|
6406
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7903
6407
|
|
7904
6408
|
if self._api_client.vertexai:
|
7905
6409
|
response_dict = _DeleteModelResponse_from_vertex(response_dict)
|
7906
6410
|
|
7907
|
-
|
6411
|
+
if not self._api_client.vertexai:
|
7908
6412
|
response_dict = _DeleteModelResponse_from_mldev(response_dict)
|
7909
6413
|
|
7910
6414
|
return_value = types.DeleteModelResponse._from_response(
|
@@ -7990,12 +6494,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7990
6494
|
'post', path, request_dict, http_options
|
7991
6495
|
)
|
7992
6496
|
|
7993
|
-
response_dict =
|
6497
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7994
6498
|
|
7995
6499
|
if self._api_client.vertexai:
|
7996
6500
|
response_dict = _CountTokensResponse_from_vertex(response_dict)
|
7997
6501
|
|
7998
|
-
|
6502
|
+
if not self._api_client.vertexai:
|
7999
6503
|
response_dict = _CountTokensResponse_from_mldev(response_dict)
|
8000
6504
|
|
8001
6505
|
return_value = types.CountTokensResponse._from_response(
|
@@ -8075,7 +6579,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
8075
6579
|
'post', path, request_dict, http_options
|
8076
6580
|
)
|
8077
6581
|
|
8078
|
-
response_dict =
|
6582
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
8079
6583
|
|
8080
6584
|
if self._api_client.vertexai:
|
8081
6585
|
response_dict = _ComputeTokensResponse_from_vertex(response_dict)
|
@@ -8150,12 +6654,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
8150
6654
|
'post', path, request_dict, http_options
|
8151
6655
|
)
|
8152
6656
|
|
8153
|
-
response_dict =
|
6657
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
8154
6658
|
|
8155
6659
|
if self._api_client.vertexai:
|
8156
6660
|
response_dict = _GenerateVideosOperation_from_vertex(response_dict)
|
8157
6661
|
|
8158
|
-
|
6662
|
+
if not self._api_client.vertexai:
|
8159
6663
|
response_dict = _GenerateVideosOperation_from_mldev(response_dict)
|
8160
6664
|
|
8161
6665
|
return_value = types.GenerateVideosOperation._from_response(
|
@@ -8668,6 +7172,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
8668
7172
|
image_preservation_factor=config_dct.get(
|
8669
7173
|
'image_preservation_factor', None
|
8670
7174
|
),
|
7175
|
+
labels=config_dct.get('labels', None),
|
8671
7176
|
) # pylint: disable=protected-access
|
8672
7177
|
|
8673
7178
|
# Provide default values through API config.
|