google-genai 1.40.0__py3-none-any.whl → 1.42.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- google/genai/_api_client.py +2 -1
- google/genai/_common.py +213 -77
- google/genai/_extra_utils.py +72 -1
- google/genai/_live_converters.py +729 -3078
- google/genai/_replay_api_client.py +8 -4
- google/genai/_tokens_converters.py +20 -424
- google/genai/_transformers.py +42 -12
- google/genai/batches.py +113 -1063
- google/genai/caches.py +67 -863
- google/genai/errors.py +9 -2
- google/genai/files.py +29 -268
- google/genai/live.py +10 -11
- google/genai/live_music.py +24 -27
- google/genai/models.py +322 -1835
- google/genai/operations.py +6 -32
- google/genai/tokens.py +2 -12
- google/genai/tunings.py +24 -197
- google/genai/types.py +187 -5
- google/genai/version.py +1 -1
- {google_genai-1.40.0.dist-info → google_genai-1.42.0.dist-info}/METADATA +40 -38
- google_genai-1.42.0.dist-info/RECORD +39 -0
- google_genai-1.40.0.dist-info/RECORD +0 -39
- {google_genai-1.40.0.dist-info → google_genai-1.42.0.dist-info}/WHEEL +0 -0
- {google_genai-1.40.0.dist-info → google_genai-1.42.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.40.0.dist-info → google_genai-1.42.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,166 @@ 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
|
-
from_object: Union[dict[str, Any], object],
|
2926
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2927
|
-
) -> dict[str, Any]:
|
2928
|
-
to_object: dict[str, Any] = {}
|
2929
|
-
if getv(from_object, ['auth_config']) is not None:
|
2325
|
+
if getv(from_object, ['max_output_tokens']) is not None:
|
2930
2326
|
setv(
|
2931
|
-
to_object,
|
2932
|
-
['authConfig'],
|
2933
|
-
_AuthConfig_to_vertex(getv(from_object, ['auth_config']), to_object),
|
2327
|
+
to_object, ['maxOutputTokens'], getv(from_object, ['max_output_tokens'])
|
2934
2328
|
)
|
2935
2329
|
|
2936
|
-
|
2330
|
+
if getv(from_object, ['media_resolution']) is not None:
|
2331
|
+
setv(
|
2332
|
+
to_object, ['mediaResolution'], getv(from_object, ['media_resolution'])
|
2333
|
+
)
|
2937
2334
|
|
2335
|
+
if getv(from_object, ['presence_penalty']) is not None:
|
2336
|
+
setv(
|
2337
|
+
to_object, ['presencePenalty'], getv(from_object, ['presence_penalty'])
|
2338
|
+
)
|
2938
2339
|
|
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:
|
2340
|
+
if getv(from_object, ['response_json_schema']) is not None:
|
2945
2341
|
setv(
|
2946
2342
|
to_object,
|
2947
|
-
['
|
2948
|
-
|
2949
|
-
getv(from_object, ['dynamic_retrieval_config']), to_object
|
2950
|
-
),
|
2343
|
+
['responseJsonSchema'],
|
2344
|
+
getv(from_object, ['response_json_schema']),
|
2951
2345
|
)
|
2952
2346
|
|
2953
|
-
|
2347
|
+
if getv(from_object, ['response_logprobs']) is not None:
|
2348
|
+
setv(
|
2349
|
+
to_object,
|
2350
|
+
['responseLogprobs'],
|
2351
|
+
getv(from_object, ['response_logprobs']),
|
2352
|
+
)
|
2954
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
|
+
)
|
2955
2360
|
|
2956
|
-
|
2957
|
-
from_object: Union[dict[str, Any], object],
|
2958
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2959
|
-
) -> dict[str, Any]:
|
2960
|
-
to_object: dict[str, Any] = {}
|
2961
|
-
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
2361
|
+
if getv(from_object, ['response_modalities']) is not None:
|
2962
2362
|
setv(
|
2963
2363
|
to_object,
|
2964
|
-
['
|
2965
|
-
|
2966
|
-
getv(from_object, ['dynamic_retrieval_config']), to_object
|
2967
|
-
),
|
2364
|
+
['responseModalities'],
|
2365
|
+
getv(from_object, ['response_modalities']),
|
2968
2366
|
)
|
2969
2367
|
|
2970
|
-
|
2368
|
+
if getv(from_object, ['response_schema']) is not None:
|
2369
|
+
setv(to_object, ['responseSchema'], getv(from_object, ['response_schema']))
|
2971
2370
|
|
2371
|
+
if getv(from_object, ['routing_config']) is not None:
|
2372
|
+
setv(to_object, ['routingConfig'], getv(from_object, ['routing_config']))
|
2972
2373
|
|
2973
|
-
|
2974
|
-
|
2975
|
-
|
2976
|
-
|
2977
|
-
to_object: dict[str, Any] = {}
|
2978
|
-
if getv(from_object, ['time_range_filter']) 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:
|
2979
2378
|
setv(
|
2980
2379
|
to_object,
|
2981
|
-
['
|
2982
|
-
|
2380
|
+
['speechConfig'],
|
2381
|
+
_SpeechConfig_to_vertex(
|
2382
|
+
getv(from_object, ['speech_config']), to_object
|
2383
|
+
),
|
2983
2384
|
)
|
2984
2385
|
|
2985
|
-
if getv(from_object, ['
|
2986
|
-
|
2987
|
-
|
2988
|
-
|
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']))
|
2989
2400
|
|
2990
2401
|
return to_object
|
2991
2402
|
|
2992
2403
|
|
2993
|
-
def
|
2404
|
+
def _GetModelParameters_to_mldev(
|
2405
|
+
api_client: BaseApiClient,
|
2994
2406
|
from_object: Union[dict[str, Any], object],
|
2995
2407
|
parent_object: Optional[dict[str, Any]] = None,
|
2996
2408
|
) -> dict[str, Any]:
|
2997
2409
|
to_object: dict[str, Any] = {}
|
2998
|
-
if getv(from_object, ['
|
2410
|
+
if getv(from_object, ['model']) is not None:
|
2999
2411
|
setv(
|
3000
2412
|
to_object,
|
3001
|
-
['
|
3002
|
-
|
3003
|
-
getv(from_object, ['time_range_filter']), to_object
|
3004
|
-
),
|
2413
|
+
['_url', 'name'],
|
2414
|
+
t.t_model(api_client, getv(from_object, ['model'])),
|
3005
2415
|
)
|
3006
2416
|
|
3007
|
-
if getv(from_object, ['exclude_domains']) is not None:
|
3008
|
-
setv(to_object, ['excludeDomains'], getv(from_object, ['exclude_domains']))
|
3009
|
-
|
3010
2417
|
return to_object
|
3011
2418
|
|
3012
2419
|
|
3013
|
-
def
|
2420
|
+
def _GetModelParameters_to_vertex(
|
2421
|
+
api_client: BaseApiClient,
|
3014
2422
|
from_object: Union[dict[str, Any], object],
|
3015
2423
|
parent_object: Optional[dict[str, Any]] = None,
|
3016
2424
|
) -> dict[str, Any]:
|
3017
2425
|
to_object: dict[str, Any] = {}
|
3018
|
-
if getv(from_object, ['
|
3019
|
-
setv(
|
2426
|
+
if getv(from_object, ['model']) is not None:
|
2427
|
+
setv(
|
2428
|
+
to_object,
|
2429
|
+
['_url', 'name'],
|
2430
|
+
t.t_model(api_client, getv(from_object, ['model'])),
|
2431
|
+
)
|
3020
2432
|
|
3021
2433
|
return to_object
|
3022
2434
|
|
3023
2435
|
|
3024
|
-
def
|
2436
|
+
def _GoogleSearch_to_mldev(
|
3025
2437
|
from_object: Union[dict[str, Any], object],
|
3026
2438
|
parent_object: Optional[dict[str, Any]] = None,
|
3027
2439
|
) -> dict[str, Any]:
|
3028
2440
|
to_object: dict[str, Any] = {}
|
3029
|
-
if getv(from_object, ['
|
3030
|
-
setv(
|
2441
|
+
if getv(from_object, ['time_range_filter']) is not None:
|
2442
|
+
setv(
|
2443
|
+
to_object, ['timeRangeFilter'], getv(from_object, ['time_range_filter'])
|
2444
|
+
)
|
2445
|
+
|
2446
|
+
if getv(from_object, ['exclude_domains']) is not None:
|
2447
|
+
raise ValueError(
|
2448
|
+
'exclude_domains parameter is not supported in Gemini API.'
|
2449
|
+
)
|
3031
2450
|
|
3032
2451
|
return to_object
|
3033
2452
|
|
@@ -3114,62 +2533,6 @@ def _Image_to_vertex(
|
|
3114
2533
|
return to_object
|
3115
2534
|
|
3116
2535
|
|
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
2536
|
def _ListModelsConfig_to_mldev(
|
3174
2537
|
api_client: BaseApiClient,
|
3175
2538
|
from_object: Union[dict[str, Any], object],
|
@@ -3333,21 +2696,6 @@ def _MaskReferenceConfig_to_vertex(
|
|
3333
2696
|
return to_object
|
3334
2697
|
|
3335
2698
|
|
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
2699
|
def _Model_from_mldev(
|
3352
2700
|
from_object: Union[dict[str, Any], object],
|
3353
2701
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -3366,11 +2714,7 @@ def _Model_from_mldev(
|
|
3366
2714
|
setv(to_object, ['version'], getv(from_object, ['version']))
|
3367
2715
|
|
3368
2716
|
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
|
-
)
|
2717
|
+
setv(to_object, ['tuned_model_info'], getv(from_object, ['_self']))
|
3374
2718
|
|
3375
2719
|
if getv(from_object, ['inputTokenLimit']) is not None:
|
3376
2720
|
setv(
|
@@ -3442,202 +2786,35 @@ def _Model_from_vertex(
|
|
3442
2786
|
setv(
|
3443
2787
|
to_object,
|
3444
2788
|
['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
|
-
],
|
2789
|
+
[item for item in getv(from_object, ['checkpoints'])],
|
3467
2790
|
)
|
3468
2791
|
|
3469
2792
|
return to_object
|
3470
2793
|
|
3471
2794
|
|
3472
|
-
def
|
2795
|
+
def _Part_to_mldev(
|
3473
2796
|
from_object: Union[dict[str, Any], object],
|
3474
2797
|
parent_object: Optional[dict[str, Any]] = None,
|
3475
2798
|
) -> dict[str, Any]:
|
3476
2799
|
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
|
-
)
|
2800
|
+
if getv(from_object, ['video_metadata']) is not None:
|
2801
|
+
setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
|
3485
2802
|
|
3486
2803
|
if getv(from_object, ['thought']) is not None:
|
3487
2804
|
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
3488
2805
|
|
3489
|
-
if getv(from_object, ['
|
2806
|
+
if getv(from_object, ['inline_data']) is not None:
|
3490
2807
|
setv(
|
3491
2808
|
to_object,
|
3492
|
-
['
|
3493
|
-
|
2809
|
+
['inlineData'],
|
2810
|
+
_Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
|
3494
2811
|
)
|
3495
2812
|
|
3496
|
-
if getv(from_object, ['
|
2813
|
+
if getv(from_object, ['file_data']) is not None:
|
3497
2814
|
setv(
|
3498
2815
|
to_object,
|
3499
|
-
['
|
3500
|
-
|
3501
|
-
)
|
3502
|
-
|
3503
|
-
if getv(from_object, ['thoughtSignature']) is not None:
|
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),
|
2816
|
+
['fileData'],
|
2817
|
+
_FileData_to_mldev(getv(from_object, ['file_data']), to_object),
|
3641
2818
|
)
|
3642
2819
|
|
3643
2820
|
if getv(from_object, ['thought_signature']) is not None:
|
@@ -3648,11 +2825,7 @@ def _Part_to_mldev(
|
|
3648
2825
|
)
|
3649
2826
|
|
3650
2827
|
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
|
-
)
|
2828
|
+
setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
|
3656
2829
|
|
3657
2830
|
if getv(from_object, ['code_execution_result']) is not None:
|
3658
2831
|
setv(
|
@@ -3677,98 +2850,6 @@ def _Part_to_mldev(
|
|
3677
2850
|
return to_object
|
3678
2851
|
|
3679
2852
|
|
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
2853
|
def _ProductImage_to_vertex(
|
3773
2854
|
from_object: Union[dict[str, Any], object],
|
3774
2855
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -3856,6 +2937,9 @@ def _RecontextImageConfig_to_vertex(
|
|
3856
2937
|
getv(from_object, ['enhance_prompt']),
|
3857
2938
|
)
|
3858
2939
|
|
2940
|
+
if getv(from_object, ['labels']) is not None:
|
2941
|
+
setv(parent_object, ['labels'], getv(from_object, ['labels']))
|
2942
|
+
|
3859
2943
|
return to_object
|
3860
2944
|
|
3861
2945
|
|
@@ -3969,56 +3053,16 @@ def _ReferenceImageAPI_to_vertex(
|
|
3969
3053
|
setv(
|
3970
3054
|
to_object,
|
3971
3055
|
['styleImageConfig'],
|
3972
|
-
|
3973
|
-
getv(from_object, ['style_image_config']), to_object
|
3974
|
-
),
|
3056
|
+
getv(from_object, ['style_image_config']),
|
3975
3057
|
)
|
3976
3058
|
|
3977
3059
|
if getv(from_object, ['subject_image_config']) is not None:
|
3978
3060
|
setv(
|
3979
3061
|
to_object,
|
3980
3062
|
['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),
|
3063
|
+
getv(from_object, ['subject_image_config']),
|
3999
3064
|
)
|
4000
3065
|
|
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
3066
|
return to_object
|
4023
3067
|
|
4024
3068
|
|
@@ -4085,203 +3129,6 @@ def _SafetySetting_to_mldev(
|
|
4085
3129
|
return to_object
|
4086
3130
|
|
4087
3131
|
|
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
3132
|
def _ScribbleImage_to_vertex(
|
4286
3133
|
from_object: Union[dict[str, Any], object],
|
4287
3134
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -4334,6 +3181,9 @@ def _SegmentImageConfig_to_vertex(
|
|
4334
3181
|
getv(from_object, ['binary_color_threshold']),
|
4335
3182
|
)
|
4336
3183
|
|
3184
|
+
if getv(from_object, ['labels']) is not None:
|
3185
|
+
setv(parent_object, ['labels'], getv(from_object, ['labels']))
|
3186
|
+
|
4337
3187
|
return to_object
|
4338
3188
|
|
4339
3189
|
|
@@ -4370,224 +3220,58 @@ def _SegmentImageResponse_from_vertex(
|
|
4370
3220
|
['generated_masks'],
|
4371
3221
|
[
|
4372
3222
|
_GeneratedImageMask_from_vertex(item, to_object)
|
4373
|
-
for item in getv(from_object, ['predictions'])
|
4374
|
-
],
|
4375
|
-
)
|
4376
|
-
|
4377
|
-
return to_object
|
4378
|
-
|
4379
|
-
|
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'])
|
3223
|
+
for item in getv(from_object, ['predictions'])
|
3224
|
+
],
|
4534
3225
|
)
|
4535
3226
|
|
4536
|
-
if getv(from_object, ['thinking_budget']) is not None:
|
4537
|
-
setv(to_object, ['thinkingBudget'], getv(from_object, ['thinking_budget']))
|
4538
|
-
|
4539
3227
|
return to_object
|
4540
3228
|
|
4541
3229
|
|
4542
|
-
def
|
3230
|
+
def _SegmentImageSource_to_vertex(
|
4543
3231
|
from_object: Union[dict[str, Any], object],
|
4544
3232
|
parent_object: Optional[dict[str, Any]] = None,
|
4545
3233
|
) -> dict[str, Any]:
|
4546
3234
|
to_object: dict[str, Any] = {}
|
4547
|
-
if getv(from_object, ['
|
3235
|
+
if getv(from_object, ['prompt']) is not None:
|
4548
3236
|
setv(
|
4549
|
-
|
4550
|
-
['functionCallingConfig'],
|
4551
|
-
_FunctionCallingConfig_to_mldev(
|
4552
|
-
getv(from_object, ['function_calling_config']), to_object
|
4553
|
-
),
|
3237
|
+
parent_object, ['instances[0]', 'prompt'], getv(from_object, ['prompt'])
|
4554
3238
|
)
|
4555
3239
|
|
4556
|
-
if getv(from_object, ['
|
3240
|
+
if getv(from_object, ['image']) is not None:
|
4557
3241
|
setv(
|
4558
|
-
|
4559
|
-
['
|
4560
|
-
|
4561
|
-
|
3242
|
+
parent_object,
|
3243
|
+
['instances[0]', 'image'],
|
3244
|
+
_Image_to_vertex(getv(from_object, ['image']), to_object),
|
3245
|
+
)
|
3246
|
+
|
3247
|
+
if getv(from_object, ['scribble_image']) is not None:
|
3248
|
+
setv(
|
3249
|
+
parent_object,
|
3250
|
+
['instances[0]', 'scribble'],
|
3251
|
+
_ScribbleImage_to_vertex(
|
3252
|
+
getv(from_object, ['scribble_image']), to_object
|
4562
3253
|
),
|
4563
3254
|
)
|
4564
3255
|
|
4565
3256
|
return to_object
|
4566
3257
|
|
4567
3258
|
|
4568
|
-
def
|
3259
|
+
def _SpeechConfig_to_vertex(
|
4569
3260
|
from_object: Union[dict[str, Any], object],
|
4570
3261
|
parent_object: Optional[dict[str, Any]] = None,
|
4571
3262
|
) -> dict[str, Any]:
|
4572
3263
|
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
|
-
)
|
3264
|
+
if getv(from_object, ['voice_config']) is not None:
|
3265
|
+
setv(to_object, ['voiceConfig'], getv(from_object, ['voice_config']))
|
4581
3266
|
|
4582
|
-
if getv(from_object, ['
|
4583
|
-
|
4584
|
-
|
4585
|
-
['retrievalConfig'],
|
4586
|
-
_RetrievalConfig_to_vertex(
|
4587
|
-
getv(from_object, ['retrieval_config']), to_object
|
4588
|
-
),
|
3267
|
+
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
3268
|
+
raise ValueError(
|
3269
|
+
'multi_speaker_voice_config parameter is not supported in Vertex AI.'
|
4589
3270
|
)
|
4590
3271
|
|
3272
|
+
if getv(from_object, ['language_code']) is not None:
|
3273
|
+
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
3274
|
+
|
4591
3275
|
return to_object
|
4592
3276
|
|
4593
3277
|
|
@@ -4600,10 +3284,7 @@ def _Tool_to_mldev(
|
|
4600
3284
|
setv(
|
4601
3285
|
to_object,
|
4602
3286
|
['functionDeclarations'],
|
4603
|
-
[
|
4604
|
-
_FunctionDeclaration_to_mldev(item, to_object)
|
4605
|
-
for item in getv(from_object, ['function_declarations'])
|
4606
|
-
],
|
3287
|
+
[item for item in getv(from_object, ['function_declarations'])],
|
4607
3288
|
)
|
4608
3289
|
|
4609
3290
|
if getv(from_object, ['retrieval']) is not None:
|
@@ -4620,9 +3301,7 @@ def _Tool_to_mldev(
|
|
4620
3301
|
setv(
|
4621
3302
|
to_object,
|
4622
3303
|
['googleSearchRetrieval'],
|
4623
|
-
|
4624
|
-
getv(from_object, ['google_search_retrieval']), to_object
|
4625
|
-
),
|
3304
|
+
getv(from_object, ['google_search_retrieval']),
|
4626
3305
|
)
|
4627
3306
|
|
4628
3307
|
if getv(from_object, ['enterprise_web_search']) is not None:
|
@@ -4634,18 +3313,10 @@ def _Tool_to_mldev(
|
|
4634
3313
|
raise ValueError('google_maps parameter is not supported in Gemini API.')
|
4635
3314
|
|
4636
3315
|
if getv(from_object, ['url_context']) is not None:
|
4637
|
-
setv(
|
4638
|
-
to_object,
|
4639
|
-
['urlContext'],
|
4640
|
-
_UrlContext_to_mldev(getv(from_object, ['url_context']), to_object),
|
4641
|
-
)
|
3316
|
+
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
4642
3317
|
|
4643
3318
|
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
|
-
)
|
3319
|
+
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
4649
3320
|
|
4650
3321
|
if getv(from_object, ['code_execution']) is not None:
|
4651
3322
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
@@ -4672,52 +3343,30 @@ def _Tool_to_vertex(
|
|
4672
3343
|
setv(to_object, ['retrieval'], getv(from_object, ['retrieval']))
|
4673
3344
|
|
4674
3345
|
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
|
-
)
|
3346
|
+
setv(to_object, ['googleSearch'], getv(from_object, ['google_search']))
|
4682
3347
|
|
4683
3348
|
if getv(from_object, ['google_search_retrieval']) is not None:
|
4684
3349
|
setv(
|
4685
3350
|
to_object,
|
4686
3351
|
['googleSearchRetrieval'],
|
4687
|
-
|
4688
|
-
getv(from_object, ['google_search_retrieval']), to_object
|
4689
|
-
),
|
3352
|
+
getv(from_object, ['google_search_retrieval']),
|
4690
3353
|
)
|
4691
3354
|
|
4692
3355
|
if getv(from_object, ['enterprise_web_search']) is not None:
|
4693
3356
|
setv(
|
4694
3357
|
to_object,
|
4695
3358
|
['enterpriseWebSearch'],
|
4696
|
-
|
4697
|
-
getv(from_object, ['enterprise_web_search']), to_object
|
4698
|
-
),
|
3359
|
+
getv(from_object, ['enterprise_web_search']),
|
4699
3360
|
)
|
4700
3361
|
|
4701
3362
|
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
|
-
)
|
3363
|
+
setv(to_object, ['googleMaps'], getv(from_object, ['google_maps']))
|
4707
3364
|
|
4708
3365
|
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
|
-
)
|
3366
|
+
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
4714
3367
|
|
4715
3368
|
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
|
-
)
|
3369
|
+
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
4721
3370
|
|
4722
3371
|
if getv(from_object, ['code_execution']) is not None:
|
4723
3372
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
@@ -4725,23 +3374,6 @@ def _Tool_to_vertex(
|
|
4725
3374
|
return to_object
|
4726
3375
|
|
4727
3376
|
|
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
3377
|
def _TunedModelInfo_from_vertex(
|
4746
3378
|
from_object: Union[dict[str, Any], object],
|
4747
3379
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -4896,6 +3528,9 @@ def _UpscaleImageAPIConfig_to_vertex(
|
|
4896
3528
|
getv(from_object, ['image_preservation_factor']),
|
4897
3529
|
)
|
4898
3530
|
|
3531
|
+
if getv(from_object, ['labels']) is not None:
|
3532
|
+
setv(parent_object, ['labels'], getv(from_object, ['labels']))
|
3533
|
+
|
4899
3534
|
if getv(from_object, ['number_of_images']) is not None:
|
4900
3535
|
setv(
|
4901
3536
|
parent_object,
|
@@ -4965,96 +3600,6 @@ def _UpscaleImageResponse_from_vertex(
|
|
4965
3600
|
return to_object
|
4966
3601
|
|
4967
3602
|
|
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
3603
|
def _VideoGenerationMask_to_vertex(
|
5059
3604
|
from_object: Union[dict[str, Any], object],
|
5060
3605
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -5073,7 +3618,7 @@ def _VideoGenerationMask_to_vertex(
|
|
5073
3618
|
return to_object
|
5074
3619
|
|
5075
3620
|
|
5076
|
-
def
|
3621
|
+
def _VideoGenerationReferenceImage_to_mldev(
|
5077
3622
|
from_object: Union[dict[str, Any], object],
|
5078
3623
|
parent_object: Optional[dict[str, Any]] = None,
|
5079
3624
|
) -> dict[str, Any]:
|
@@ -5082,79 +3627,32 @@ def _VideoGenerationReferenceImage_to_vertex(
|
|
5082
3627
|
setv(
|
5083
3628
|
to_object,
|
5084
3629
|
['image'],
|
5085
|
-
|
3630
|
+
_Image_to_mldev(getv(from_object, ['image']), to_object),
|
5086
3631
|
)
|
5087
3632
|
|
5088
3633
|
if getv(from_object, ['reference_type']) is not None:
|
3634
|
+
_VideoGenerationReferenceType_to_mldev_enum_validate(
|
3635
|
+
getv(from_object, ['reference_type'])
|
3636
|
+
)
|
5089
3637
|
setv(to_object, ['referenceType'], getv(from_object, ['reference_type']))
|
5090
3638
|
|
5091
3639
|
return to_object
|
5092
3640
|
|
5093
3641
|
|
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(
|
3642
|
+
def _VideoGenerationReferenceImage_to_vertex(
|
5146
3643
|
from_object: Union[dict[str, Any], object],
|
5147
3644
|
parent_object: Optional[dict[str, Any]] = None,
|
5148
3645
|
) -> dict[str, Any]:
|
5149
3646
|
to_object: dict[str, Any] = {}
|
5150
|
-
if getv(from_object, ['
|
5151
|
-
setv(
|
5152
|
-
|
5153
|
-
|
5154
|
-
|
3647
|
+
if getv(from_object, ['image']) is not None:
|
3648
|
+
setv(
|
3649
|
+
to_object,
|
3650
|
+
['image'],
|
3651
|
+
_Image_to_vertex(getv(from_object, ['image']), to_object),
|
3652
|
+
)
|
5155
3653
|
|
5156
|
-
if getv(from_object, ['
|
5157
|
-
setv(to_object, ['
|
3654
|
+
if getv(from_object, ['reference_type']) is not None:
|
3655
|
+
setv(to_object, ['referenceType'], getv(from_object, ['reference_type']))
|
5158
3656
|
|
5159
3657
|
return to_object
|
5160
3658
|
|
@@ -5201,58 +3699,45 @@ def _Video_from_vertex(
|
|
5201
3699
|
return to_object
|
5202
3700
|
|
5203
3701
|
|
5204
|
-
def
|
3702
|
+
def _Video_to_mldev(
|
5205
3703
|
from_object: Union[dict[str, Any], object],
|
5206
3704
|
parent_object: Optional[dict[str, Any]] = None,
|
5207
3705
|
) -> dict[str, Any]:
|
5208
3706
|
to_object: dict[str, Any] = {}
|
5209
3707
|
if getv(from_object, ['uri']) is not None:
|
5210
|
-
setv(to_object, ['
|
3708
|
+
setv(to_object, ['video', 'uri'], getv(from_object, ['uri']))
|
5211
3709
|
|
5212
3710
|
if getv(from_object, ['video_bytes']) is not None:
|
5213
3711
|
setv(
|
5214
3712
|
to_object,
|
5215
|
-
['
|
3713
|
+
['video', 'encodedVideo'],
|
5216
3714
|
base_t.t_bytes(getv(from_object, ['video_bytes'])),
|
5217
3715
|
)
|
5218
3716
|
|
5219
3717
|
if getv(from_object, ['mime_type']) is not None:
|
5220
|
-
setv(to_object, ['
|
3718
|
+
setv(to_object, ['encoding'], getv(from_object, ['mime_type']))
|
5221
3719
|
|
5222
3720
|
return to_object
|
5223
3721
|
|
5224
3722
|
|
5225
|
-
def
|
3723
|
+
def _Video_to_vertex(
|
5226
3724
|
from_object: Union[dict[str, Any], object],
|
5227
3725
|
parent_object: Optional[dict[str, Any]] = None,
|
5228
3726
|
) -> dict[str, Any]:
|
5229
3727
|
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
|
-
|
3728
|
+
if getv(from_object, ['uri']) is not None:
|
3729
|
+
setv(to_object, ['gcsUri'], getv(from_object, ['uri']))
|
5241
3730
|
|
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:
|
3731
|
+
if getv(from_object, ['video_bytes']) is not None:
|
5248
3732
|
setv(
|
5249
3733
|
to_object,
|
5250
|
-
['
|
5251
|
-
|
5252
|
-
getv(from_object, ['prebuilt_voice_config']), to_object
|
5253
|
-
),
|
3734
|
+
['bytesBase64Encoded'],
|
3735
|
+
base_t.t_bytes(getv(from_object, ['video_bytes'])),
|
5254
3736
|
)
|
5255
3737
|
|
3738
|
+
if getv(from_object, ['mime_type']) is not None:
|
3739
|
+
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
3740
|
+
|
5256
3741
|
return to_object
|
5257
3742
|
|
5258
3743
|
|
@@ -5318,12 +3803,12 @@ class Models(_api_module.BaseModule):
|
|
5318
3803
|
self._api_client._verify_response(return_value)
|
5319
3804
|
return return_value
|
5320
3805
|
|
5321
|
-
response_dict =
|
3806
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5322
3807
|
|
5323
3808
|
if self._api_client.vertexai:
|
5324
3809
|
response_dict = _GenerateContentResponse_from_vertex(response_dict)
|
5325
3810
|
|
5326
|
-
|
3811
|
+
if not self._api_client.vertexai:
|
5327
3812
|
response_dict = _GenerateContentResponse_from_mldev(response_dict)
|
5328
3813
|
|
5329
3814
|
return_value = types.GenerateContentResponse._from_response(
|
@@ -5400,12 +3885,12 @@ class Models(_api_module.BaseModule):
|
|
5400
3885
|
'post', path, request_dict, http_options
|
5401
3886
|
):
|
5402
3887
|
|
5403
|
-
response_dict =
|
3888
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5404
3889
|
|
5405
3890
|
if self._api_client.vertexai:
|
5406
3891
|
response_dict = _GenerateContentResponse_from_vertex(response_dict)
|
5407
3892
|
|
5408
|
-
|
3893
|
+
if not self._api_client.vertexai:
|
5409
3894
|
response_dict = _GenerateContentResponse_from_mldev(response_dict)
|
5410
3895
|
|
5411
3896
|
return_value = types.GenerateContentResponse._from_response(
|
@@ -5493,12 +3978,12 @@ class Models(_api_module.BaseModule):
|
|
5493
3978
|
'post', path, request_dict, http_options
|
5494
3979
|
)
|
5495
3980
|
|
5496
|
-
response_dict =
|
3981
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5497
3982
|
|
5498
3983
|
if self._api_client.vertexai:
|
5499
3984
|
response_dict = _EmbedContentResponse_from_vertex(response_dict)
|
5500
3985
|
|
5501
|
-
|
3986
|
+
if not self._api_client.vertexai:
|
5502
3987
|
response_dict = _EmbedContentResponse_from_mldev(response_dict)
|
5503
3988
|
|
5504
3989
|
return_value = types.EmbedContentResponse._from_response(
|
@@ -5565,12 +4050,12 @@ class Models(_api_module.BaseModule):
|
|
5565
4050
|
'post', path, request_dict, http_options
|
5566
4051
|
)
|
5567
4052
|
|
5568
|
-
response_dict =
|
4053
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5569
4054
|
|
5570
4055
|
if self._api_client.vertexai:
|
5571
4056
|
response_dict = _GenerateImagesResponse_from_vertex(response_dict)
|
5572
4057
|
|
5573
|
-
|
4058
|
+
if not self._api_client.vertexai:
|
5574
4059
|
response_dict = _GenerateImagesResponse_from_mldev(response_dict)
|
5575
4060
|
|
5576
4061
|
return_value = types.GenerateImagesResponse._from_response(
|
@@ -5632,7 +4117,7 @@ class Models(_api_module.BaseModule):
|
|
5632
4117
|
'post', path, request_dict, http_options
|
5633
4118
|
)
|
5634
4119
|
|
5635
|
-
response_dict =
|
4120
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5636
4121
|
|
5637
4122
|
if self._api_client.vertexai:
|
5638
4123
|
response_dict = _EditImageResponse_from_vertex(response_dict)
|
@@ -5696,7 +4181,7 @@ class Models(_api_module.BaseModule):
|
|
5696
4181
|
'post', path, request_dict, http_options
|
5697
4182
|
)
|
5698
4183
|
|
5699
|
-
response_dict =
|
4184
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5700
4185
|
|
5701
4186
|
if self._api_client.vertexai:
|
5702
4187
|
response_dict = _UpscaleImageResponse_from_vertex(response_dict)
|
@@ -5804,7 +4289,7 @@ class Models(_api_module.BaseModule):
|
|
5804
4289
|
'post', path, request_dict, http_options
|
5805
4290
|
)
|
5806
4291
|
|
5807
|
-
response_dict =
|
4292
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5808
4293
|
|
5809
4294
|
if self._api_client.vertexai:
|
5810
4295
|
response_dict = _RecontextImageResponse_from_vertex(response_dict)
|
@@ -5887,7 +4372,7 @@ class Models(_api_module.BaseModule):
|
|
5887
4372
|
'post', path, request_dict, http_options
|
5888
4373
|
)
|
5889
4374
|
|
5890
|
-
response_dict =
|
4375
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5891
4376
|
|
5892
4377
|
if self._api_client.vertexai:
|
5893
4378
|
response_dict = _SegmentImageResponse_from_vertex(response_dict)
|
@@ -5945,12 +4430,12 @@ class Models(_api_module.BaseModule):
|
|
5945
4430
|
|
5946
4431
|
response = self._api_client.request('get', path, request_dict, http_options)
|
5947
4432
|
|
5948
|
-
response_dict =
|
4433
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
5949
4434
|
|
5950
4435
|
if self._api_client.vertexai:
|
5951
4436
|
response_dict = _Model_from_vertex(response_dict)
|
5952
4437
|
|
5953
|
-
|
4438
|
+
if not self._api_client.vertexai:
|
5954
4439
|
response_dict = _Model_from_mldev(response_dict)
|
5955
4440
|
|
5956
4441
|
return_value = types.Model._from_response(
|
@@ -6005,12 +4490,12 @@ class Models(_api_module.BaseModule):
|
|
6005
4490
|
|
6006
4491
|
response = self._api_client.request('get', path, request_dict, http_options)
|
6007
4492
|
|
6008
|
-
response_dict =
|
4493
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
6009
4494
|
|
6010
4495
|
if self._api_client.vertexai:
|
6011
4496
|
response_dict = _ListModelsResponse_from_vertex(response_dict)
|
6012
4497
|
|
6013
|
-
|
4498
|
+
if not self._api_client.vertexai:
|
6014
4499
|
response_dict = _ListModelsResponse_from_mldev(response_dict)
|
6015
4500
|
|
6016
4501
|
return_value = types.ListModelsResponse._from_response(
|
@@ -6073,12 +4558,12 @@ class Models(_api_module.BaseModule):
|
|
6073
4558
|
'patch', path, request_dict, http_options
|
6074
4559
|
)
|
6075
4560
|
|
6076
|
-
response_dict =
|
4561
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
6077
4562
|
|
6078
4563
|
if self._api_client.vertexai:
|
6079
4564
|
response_dict = _Model_from_vertex(response_dict)
|
6080
4565
|
|
6081
|
-
|
4566
|
+
if not self._api_client.vertexai:
|
6082
4567
|
response_dict = _Model_from_mldev(response_dict)
|
6083
4568
|
|
6084
4569
|
return_value = types.Model._from_response(
|
@@ -6139,12 +4624,12 @@ class Models(_api_module.BaseModule):
|
|
6139
4624
|
'delete', path, request_dict, http_options
|
6140
4625
|
)
|
6141
4626
|
|
6142
|
-
response_dict =
|
4627
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
6143
4628
|
|
6144
4629
|
if self._api_client.vertexai:
|
6145
4630
|
response_dict = _DeleteModelResponse_from_vertex(response_dict)
|
6146
4631
|
|
6147
|
-
|
4632
|
+
if not self._api_client.vertexai:
|
6148
4633
|
response_dict = _DeleteModelResponse_from_mldev(response_dict)
|
6149
4634
|
|
6150
4635
|
return_value = types.DeleteModelResponse._from_response(
|
@@ -6230,12 +4715,12 @@ class Models(_api_module.BaseModule):
|
|
6230
4715
|
'post', path, request_dict, http_options
|
6231
4716
|
)
|
6232
4717
|
|
6233
|
-
response_dict =
|
4718
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
6234
4719
|
|
6235
4720
|
if self._api_client.vertexai:
|
6236
4721
|
response_dict = _CountTokensResponse_from_vertex(response_dict)
|
6237
4722
|
|
6238
|
-
|
4723
|
+
if not self._api_client.vertexai:
|
6239
4724
|
response_dict = _CountTokensResponse_from_mldev(response_dict)
|
6240
4725
|
|
6241
4726
|
return_value = types.CountTokensResponse._from_response(
|
@@ -6316,7 +4801,7 @@ class Models(_api_module.BaseModule):
|
|
6316
4801
|
'post', path, request_dict, http_options
|
6317
4802
|
)
|
6318
4803
|
|
6319
|
-
response_dict =
|
4804
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
6320
4805
|
|
6321
4806
|
if self._api_client.vertexai:
|
6322
4807
|
response_dict = _ComputeTokensResponse_from_vertex(response_dict)
|
@@ -6391,12 +4876,12 @@ class Models(_api_module.BaseModule):
|
|
6391
4876
|
'post', path, request_dict, http_options
|
6392
4877
|
)
|
6393
4878
|
|
6394
|
-
response_dict =
|
4879
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
6395
4880
|
|
6396
4881
|
if self._api_client.vertexai:
|
6397
4882
|
response_dict = _GenerateVideosOperation_from_vertex(response_dict)
|
6398
4883
|
|
6399
|
-
|
4884
|
+
if not self._api_client.vertexai:
|
6400
4885
|
response_dict = _GenerateVideosOperation_from_mldev(response_dict)
|
6401
4886
|
|
6402
4887
|
return_value = types.GenerateVideosOperation._from_response(
|
@@ -6877,6 +5362,7 @@ class Models(_api_module.BaseModule):
|
|
6877
5362
|
image_preservation_factor=config_dct.get(
|
6878
5363
|
'image_preservation_factor', None
|
6879
5364
|
),
|
5365
|
+
labels=config_dct.get('labels', None),
|
6880
5366
|
) # pylint: disable=protected-access
|
6881
5367
|
|
6882
5368
|
# Provide default values through API config.
|
@@ -7066,12 +5552,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7066
5552
|
self._api_client._verify_response(return_value)
|
7067
5553
|
return return_value
|
7068
5554
|
|
7069
|
-
response_dict =
|
5555
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7070
5556
|
|
7071
5557
|
if self._api_client.vertexai:
|
7072
5558
|
response_dict = _GenerateContentResponse_from_vertex(response_dict)
|
7073
5559
|
|
7074
|
-
|
5560
|
+
if not self._api_client.vertexai:
|
7075
5561
|
response_dict = _GenerateContentResponse_from_mldev(response_dict)
|
7076
5562
|
|
7077
5563
|
return_value = types.GenerateContentResponse._from_response(
|
@@ -7151,12 +5637,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7151
5637
|
async def async_generator(): # type: ignore[no-untyped-def]
|
7152
5638
|
async for response in response_stream:
|
7153
5639
|
|
7154
|
-
response_dict =
|
5640
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7155
5641
|
|
7156
5642
|
if self._api_client.vertexai:
|
7157
5643
|
response_dict = _GenerateContentResponse_from_vertex(response_dict)
|
7158
5644
|
|
7159
|
-
|
5645
|
+
if not self._api_client.vertexai:
|
7160
5646
|
response_dict = _GenerateContentResponse_from_mldev(response_dict)
|
7161
5647
|
|
7162
5648
|
return_value = types.GenerateContentResponse._from_response(
|
@@ -7246,12 +5732,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7246
5732
|
'post', path, request_dict, http_options
|
7247
5733
|
)
|
7248
5734
|
|
7249
|
-
response_dict =
|
5735
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7250
5736
|
|
7251
5737
|
if self._api_client.vertexai:
|
7252
5738
|
response_dict = _EmbedContentResponse_from_vertex(response_dict)
|
7253
5739
|
|
7254
|
-
|
5740
|
+
if not self._api_client.vertexai:
|
7255
5741
|
response_dict = _EmbedContentResponse_from_mldev(response_dict)
|
7256
5742
|
|
7257
5743
|
return_value = types.EmbedContentResponse._from_response(
|
@@ -7318,12 +5804,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7318
5804
|
'post', path, request_dict, http_options
|
7319
5805
|
)
|
7320
5806
|
|
7321
|
-
response_dict =
|
5807
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7322
5808
|
|
7323
5809
|
if self._api_client.vertexai:
|
7324
5810
|
response_dict = _GenerateImagesResponse_from_vertex(response_dict)
|
7325
5811
|
|
7326
|
-
|
5812
|
+
if not self._api_client.vertexai:
|
7327
5813
|
response_dict = _GenerateImagesResponse_from_mldev(response_dict)
|
7328
5814
|
|
7329
5815
|
return_value = types.GenerateImagesResponse._from_response(
|
@@ -7385,7 +5871,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
7385
5871
|
'post', path, request_dict, http_options
|
7386
5872
|
)
|
7387
5873
|
|
7388
|
-
response_dict =
|
5874
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7389
5875
|
|
7390
5876
|
if self._api_client.vertexai:
|
7391
5877
|
response_dict = _EditImageResponse_from_vertex(response_dict)
|
@@ -7449,7 +5935,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
7449
5935
|
'post', path, request_dict, http_options
|
7450
5936
|
)
|
7451
5937
|
|
7452
|
-
response_dict =
|
5938
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7453
5939
|
|
7454
5940
|
if self._api_client.vertexai:
|
7455
5941
|
response_dict = _UpscaleImageResponse_from_vertex(response_dict)
|
@@ -7557,7 +6043,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
7557
6043
|
'post', path, request_dict, http_options
|
7558
6044
|
)
|
7559
6045
|
|
7560
|
-
response_dict =
|
6046
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7561
6047
|
|
7562
6048
|
if self._api_client.vertexai:
|
7563
6049
|
response_dict = _RecontextImageResponse_from_vertex(response_dict)
|
@@ -7643,7 +6129,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
7643
6129
|
'post', path, request_dict, http_options
|
7644
6130
|
)
|
7645
6131
|
|
7646
|
-
response_dict =
|
6132
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7647
6133
|
|
7648
6134
|
if self._api_client.vertexai:
|
7649
6135
|
response_dict = _SegmentImageResponse_from_vertex(response_dict)
|
@@ -7703,12 +6189,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7703
6189
|
'get', path, request_dict, http_options
|
7704
6190
|
)
|
7705
6191
|
|
7706
|
-
response_dict =
|
6192
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7707
6193
|
|
7708
6194
|
if self._api_client.vertexai:
|
7709
6195
|
response_dict = _Model_from_vertex(response_dict)
|
7710
6196
|
|
7711
|
-
|
6197
|
+
if not self._api_client.vertexai:
|
7712
6198
|
response_dict = _Model_from_mldev(response_dict)
|
7713
6199
|
|
7714
6200
|
return_value = types.Model._from_response(
|
@@ -7765,12 +6251,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7765
6251
|
'get', path, request_dict, http_options
|
7766
6252
|
)
|
7767
6253
|
|
7768
|
-
response_dict =
|
6254
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7769
6255
|
|
7770
6256
|
if self._api_client.vertexai:
|
7771
6257
|
response_dict = _ListModelsResponse_from_vertex(response_dict)
|
7772
6258
|
|
7773
|
-
|
6259
|
+
if not self._api_client.vertexai:
|
7774
6260
|
response_dict = _ListModelsResponse_from_mldev(response_dict)
|
7775
6261
|
|
7776
6262
|
return_value = types.ListModelsResponse._from_response(
|
@@ -7833,12 +6319,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7833
6319
|
'patch', path, request_dict, http_options
|
7834
6320
|
)
|
7835
6321
|
|
7836
|
-
response_dict =
|
6322
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7837
6323
|
|
7838
6324
|
if self._api_client.vertexai:
|
7839
6325
|
response_dict = _Model_from_vertex(response_dict)
|
7840
6326
|
|
7841
|
-
|
6327
|
+
if not self._api_client.vertexai:
|
7842
6328
|
response_dict = _Model_from_mldev(response_dict)
|
7843
6329
|
|
7844
6330
|
return_value = types.Model._from_response(
|
@@ -7899,12 +6385,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7899
6385
|
'delete', path, request_dict, http_options
|
7900
6386
|
)
|
7901
6387
|
|
7902
|
-
response_dict =
|
6388
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7903
6389
|
|
7904
6390
|
if self._api_client.vertexai:
|
7905
6391
|
response_dict = _DeleteModelResponse_from_vertex(response_dict)
|
7906
6392
|
|
7907
|
-
|
6393
|
+
if not self._api_client.vertexai:
|
7908
6394
|
response_dict = _DeleteModelResponse_from_mldev(response_dict)
|
7909
6395
|
|
7910
6396
|
return_value = types.DeleteModelResponse._from_response(
|
@@ -7990,12 +6476,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
7990
6476
|
'post', path, request_dict, http_options
|
7991
6477
|
)
|
7992
6478
|
|
7993
|
-
response_dict =
|
6479
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
7994
6480
|
|
7995
6481
|
if self._api_client.vertexai:
|
7996
6482
|
response_dict = _CountTokensResponse_from_vertex(response_dict)
|
7997
6483
|
|
7998
|
-
|
6484
|
+
if not self._api_client.vertexai:
|
7999
6485
|
response_dict = _CountTokensResponse_from_mldev(response_dict)
|
8000
6486
|
|
8001
6487
|
return_value = types.CountTokensResponse._from_response(
|
@@ -8075,7 +6561,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
8075
6561
|
'post', path, request_dict, http_options
|
8076
6562
|
)
|
8077
6563
|
|
8078
|
-
response_dict =
|
6564
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
8079
6565
|
|
8080
6566
|
if self._api_client.vertexai:
|
8081
6567
|
response_dict = _ComputeTokensResponse_from_vertex(response_dict)
|
@@ -8150,12 +6636,12 @@ class AsyncModels(_api_module.BaseModule):
|
|
8150
6636
|
'post', path, request_dict, http_options
|
8151
6637
|
)
|
8152
6638
|
|
8153
|
-
response_dict =
|
6639
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
8154
6640
|
|
8155
6641
|
if self._api_client.vertexai:
|
8156
6642
|
response_dict = _GenerateVideosOperation_from_vertex(response_dict)
|
8157
6643
|
|
8158
|
-
|
6644
|
+
if not self._api_client.vertexai:
|
8159
6645
|
response_dict = _GenerateVideosOperation_from_mldev(response_dict)
|
8160
6646
|
|
8161
6647
|
return_value = types.GenerateVideosOperation._from_response(
|
@@ -8668,6 +7154,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
8668
7154
|
image_preservation_factor=config_dct.get(
|
8669
7155
|
'image_preservation_factor', None
|
8670
7156
|
),
|
7157
|
+
labels=config_dct.get('labels', None),
|
8671
7158
|
) # pylint: disable=protected-access
|
8672
7159
|
|
8673
7160
|
# Provide default values through API config.
|