google-genai 1.3.0__py3-none-any.whl → 1.5.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 +143 -69
- google/genai/_api_module.py +1 -1
- google/genai/_automatic_function_calling_util.py +15 -15
- google/genai/_common.py +6 -3
- google/genai/_extra_utils.py +62 -46
- google/genai/_replay_api_client.py +73 -4
- google/genai/_test_api_client.py +8 -8
- google/genai/_transformers.py +194 -66
- google/genai/batches.py +180 -134
- google/genai/caches.py +316 -216
- google/genai/chats.py +179 -35
- google/genai/client.py +3 -3
- google/genai/errors.py +1 -2
- google/genai/files.py +175 -119
- google/genai/live.py +73 -64
- google/genai/models.py +898 -637
- google/genai/operations.py +96 -66
- google/genai/pagers.py +16 -7
- google/genai/tunings.py +172 -112
- google/genai/types.py +228 -178
- google/genai/version.py +1 -1
- {google_genai-1.3.0.dist-info → google_genai-1.5.0.dist-info}/METADATA +8 -1
- google_genai-1.5.0.dist-info/RECORD +27 -0
- {google_genai-1.3.0.dist-info → google_genai-1.5.0.dist-info}/WHEEL +1 -1
- google_genai-1.3.0.dist-info/RECORD +0 -27
- {google_genai-1.3.0.dist-info → google_genai-1.5.0.dist-info}/LICENSE +0 -0
- {google_genai-1.3.0.dist-info → google_genai-1.5.0.dist-info}/top_level.txt +0 -0
google/genai/models.py
CHANGED
@@ -23,7 +23,7 @@ from . import _common
|
|
23
23
|
from . import _extra_utils
|
24
24
|
from . import _transformers as t
|
25
25
|
from . import types
|
26
|
-
from ._api_client import
|
26
|
+
from ._api_client import BaseApiClient
|
27
27
|
from ._common import get_value_by_path as getv
|
28
28
|
from ._common import set_value_by_path as setv
|
29
29
|
from .pagers import AsyncPager, Pager
|
@@ -32,11 +32,11 @@ logger = logging.getLogger('google_genai.models')
|
|
32
32
|
|
33
33
|
|
34
34
|
def _Part_to_mldev(
|
35
|
-
api_client:
|
35
|
+
api_client: BaseApiClient,
|
36
36
|
from_object: Union[dict, object],
|
37
|
-
parent_object: dict = None,
|
37
|
+
parent_object: Optional[dict] = None,
|
38
38
|
) -> dict:
|
39
|
-
to_object = {}
|
39
|
+
to_object: dict[str, Any] = {}
|
40
40
|
if getv(from_object, ['video_metadata']) is not None:
|
41
41
|
raise ValueError('video_metadata parameter is not supported in Gemini API.')
|
42
42
|
|
@@ -76,11 +76,11 @@ def _Part_to_mldev(
|
|
76
76
|
|
77
77
|
|
78
78
|
def _Part_to_vertex(
|
79
|
-
api_client:
|
79
|
+
api_client: BaseApiClient,
|
80
80
|
from_object: Union[dict, object],
|
81
|
-
parent_object: dict = None,
|
81
|
+
parent_object: Optional[dict] = None,
|
82
82
|
) -> dict:
|
83
|
-
to_object = {}
|
83
|
+
to_object: dict[str, Any] = {}
|
84
84
|
if getv(from_object, ['video_metadata']) is not None:
|
85
85
|
setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
|
86
86
|
|
@@ -120,11 +120,11 @@ def _Part_to_vertex(
|
|
120
120
|
|
121
121
|
|
122
122
|
def _Content_to_mldev(
|
123
|
-
api_client:
|
123
|
+
api_client: BaseApiClient,
|
124
124
|
from_object: Union[dict, object],
|
125
|
-
parent_object: dict = None,
|
125
|
+
parent_object: Optional[dict] = None,
|
126
126
|
) -> dict:
|
127
|
-
to_object = {}
|
127
|
+
to_object: dict[str, Any] = {}
|
128
128
|
if getv(from_object, ['parts']) is not None:
|
129
129
|
setv(
|
130
130
|
to_object,
|
@@ -142,11 +142,11 @@ def _Content_to_mldev(
|
|
142
142
|
|
143
143
|
|
144
144
|
def _Content_to_vertex(
|
145
|
-
api_client:
|
145
|
+
api_client: BaseApiClient,
|
146
146
|
from_object: Union[dict, object],
|
147
|
-
parent_object: dict = None,
|
147
|
+
parent_object: Optional[dict] = None,
|
148
148
|
) -> dict:
|
149
|
-
to_object = {}
|
149
|
+
to_object: dict[str, Any] = {}
|
150
150
|
if getv(from_object, ['parts']) is not None:
|
151
151
|
setv(
|
152
152
|
to_object,
|
@@ -164,24 +164,14 @@ def _Content_to_vertex(
|
|
164
164
|
|
165
165
|
|
166
166
|
def _Schema_to_mldev(
|
167
|
-
api_client:
|
167
|
+
api_client: BaseApiClient,
|
168
168
|
from_object: Union[dict, object],
|
169
|
-
parent_object: dict = None,
|
169
|
+
parent_object: Optional[dict] = None,
|
170
170
|
) -> dict:
|
171
|
-
to_object = {}
|
172
|
-
if getv(from_object, ['min_items']) is not None:
|
173
|
-
raise ValueError('min_items parameter is not supported in Gemini API.')
|
174
|
-
|
171
|
+
to_object: dict[str, Any] = {}
|
175
172
|
if getv(from_object, ['example']) is not None:
|
176
173
|
raise ValueError('example parameter is not supported in Gemini API.')
|
177
174
|
|
178
|
-
if getv(from_object, ['property_ordering']) is not None:
|
179
|
-
setv(
|
180
|
-
to_object,
|
181
|
-
['propertyOrdering'],
|
182
|
-
getv(from_object, ['property_ordering']),
|
183
|
-
)
|
184
|
-
|
185
175
|
if getv(from_object, ['pattern']) is not None:
|
186
176
|
raise ValueError('pattern parameter is not supported in Gemini API.')
|
187
177
|
|
@@ -206,21 +196,12 @@ def _Schema_to_mldev(
|
|
206
196
|
if getv(from_object, ['min_properties']) is not None:
|
207
197
|
raise ValueError('min_properties parameter is not supported in Gemini API.')
|
208
198
|
|
209
|
-
if getv(from_object, ['max_items']) is not None:
|
210
|
-
raise ValueError('max_items parameter is not supported in Gemini API.')
|
211
|
-
|
212
199
|
if getv(from_object, ['maximum']) is not None:
|
213
200
|
raise ValueError('maximum parameter is not supported in Gemini API.')
|
214
201
|
|
215
|
-
if getv(from_object, ['nullable']) is not None:
|
216
|
-
raise ValueError('nullable parameter is not supported in Gemini API.')
|
217
|
-
|
218
202
|
if getv(from_object, ['max_properties']) is not None:
|
219
203
|
raise ValueError('max_properties parameter is not supported in Gemini API.')
|
220
204
|
|
221
|
-
if getv(from_object, ['type']) is not None:
|
222
|
-
setv(to_object, ['type'], getv(from_object, ['type']))
|
223
|
-
|
224
205
|
if getv(from_object, ['description']) is not None:
|
225
206
|
setv(to_object, ['description'], getv(from_object, ['description']))
|
226
207
|
|
@@ -233,34 +214,43 @@ def _Schema_to_mldev(
|
|
233
214
|
if getv(from_object, ['items']) is not None:
|
234
215
|
setv(to_object, ['items'], getv(from_object, ['items']))
|
235
216
|
|
217
|
+
if getv(from_object, ['max_items']) is not None:
|
218
|
+
setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
|
219
|
+
|
220
|
+
if getv(from_object, ['min_items']) is not None:
|
221
|
+
setv(to_object, ['minItems'], getv(from_object, ['min_items']))
|
222
|
+
|
223
|
+
if getv(from_object, ['nullable']) is not None:
|
224
|
+
setv(to_object, ['nullable'], getv(from_object, ['nullable']))
|
225
|
+
|
236
226
|
if getv(from_object, ['properties']) is not None:
|
237
227
|
setv(to_object, ['properties'], getv(from_object, ['properties']))
|
238
228
|
|
229
|
+
if getv(from_object, ['property_ordering']) is not None:
|
230
|
+
setv(
|
231
|
+
to_object,
|
232
|
+
['propertyOrdering'],
|
233
|
+
getv(from_object, ['property_ordering']),
|
234
|
+
)
|
235
|
+
|
239
236
|
if getv(from_object, ['required']) is not None:
|
240
237
|
setv(to_object, ['required'], getv(from_object, ['required']))
|
241
238
|
|
239
|
+
if getv(from_object, ['type']) is not None:
|
240
|
+
setv(to_object, ['type'], getv(from_object, ['type']))
|
241
|
+
|
242
242
|
return to_object
|
243
243
|
|
244
244
|
|
245
245
|
def _Schema_to_vertex(
|
246
|
-
api_client:
|
246
|
+
api_client: BaseApiClient,
|
247
247
|
from_object: Union[dict, object],
|
248
|
-
parent_object: dict = None,
|
248
|
+
parent_object: Optional[dict] = None,
|
249
249
|
) -> dict:
|
250
|
-
to_object = {}
|
251
|
-
if getv(from_object, ['min_items']) is not None:
|
252
|
-
setv(to_object, ['minItems'], getv(from_object, ['min_items']))
|
253
|
-
|
250
|
+
to_object: dict[str, Any] = {}
|
254
251
|
if getv(from_object, ['example']) is not None:
|
255
252
|
setv(to_object, ['example'], getv(from_object, ['example']))
|
256
253
|
|
257
|
-
if getv(from_object, ['property_ordering']) is not None:
|
258
|
-
setv(
|
259
|
-
to_object,
|
260
|
-
['propertyOrdering'],
|
261
|
-
getv(from_object, ['property_ordering']),
|
262
|
-
)
|
263
|
-
|
264
254
|
if getv(from_object, ['pattern']) is not None:
|
265
255
|
setv(to_object, ['pattern'], getv(from_object, ['pattern']))
|
266
256
|
|
@@ -285,21 +275,12 @@ def _Schema_to_vertex(
|
|
285
275
|
if getv(from_object, ['min_properties']) is not None:
|
286
276
|
setv(to_object, ['minProperties'], getv(from_object, ['min_properties']))
|
287
277
|
|
288
|
-
if getv(from_object, ['max_items']) is not None:
|
289
|
-
setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
|
290
|
-
|
291
278
|
if getv(from_object, ['maximum']) is not None:
|
292
279
|
setv(to_object, ['maximum'], getv(from_object, ['maximum']))
|
293
280
|
|
294
|
-
if getv(from_object, ['nullable']) is not None:
|
295
|
-
setv(to_object, ['nullable'], getv(from_object, ['nullable']))
|
296
|
-
|
297
281
|
if getv(from_object, ['max_properties']) is not None:
|
298
282
|
setv(to_object, ['maxProperties'], getv(from_object, ['max_properties']))
|
299
283
|
|
300
|
-
if getv(from_object, ['type']) is not None:
|
301
|
-
setv(to_object, ['type'], getv(from_object, ['type']))
|
302
|
-
|
303
284
|
if getv(from_object, ['description']) is not None:
|
304
285
|
setv(to_object, ['description'], getv(from_object, ['description']))
|
305
286
|
|
@@ -312,21 +293,40 @@ def _Schema_to_vertex(
|
|
312
293
|
if getv(from_object, ['items']) is not None:
|
313
294
|
setv(to_object, ['items'], getv(from_object, ['items']))
|
314
295
|
|
296
|
+
if getv(from_object, ['max_items']) is not None:
|
297
|
+
setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
|
298
|
+
|
299
|
+
if getv(from_object, ['min_items']) is not None:
|
300
|
+
setv(to_object, ['minItems'], getv(from_object, ['min_items']))
|
301
|
+
|
302
|
+
if getv(from_object, ['nullable']) is not None:
|
303
|
+
setv(to_object, ['nullable'], getv(from_object, ['nullable']))
|
304
|
+
|
315
305
|
if getv(from_object, ['properties']) is not None:
|
316
306
|
setv(to_object, ['properties'], getv(from_object, ['properties']))
|
317
307
|
|
308
|
+
if getv(from_object, ['property_ordering']) is not None:
|
309
|
+
setv(
|
310
|
+
to_object,
|
311
|
+
['propertyOrdering'],
|
312
|
+
getv(from_object, ['property_ordering']),
|
313
|
+
)
|
314
|
+
|
318
315
|
if getv(from_object, ['required']) is not None:
|
319
316
|
setv(to_object, ['required'], getv(from_object, ['required']))
|
320
317
|
|
318
|
+
if getv(from_object, ['type']) is not None:
|
319
|
+
setv(to_object, ['type'], getv(from_object, ['type']))
|
320
|
+
|
321
321
|
return to_object
|
322
322
|
|
323
323
|
|
324
324
|
def _SafetySetting_to_mldev(
|
325
|
-
api_client:
|
325
|
+
api_client: BaseApiClient,
|
326
326
|
from_object: Union[dict, object],
|
327
|
-
parent_object: dict = None,
|
327
|
+
parent_object: Optional[dict] = None,
|
328
328
|
) -> dict:
|
329
|
-
to_object = {}
|
329
|
+
to_object: dict[str, Any] = {}
|
330
330
|
if getv(from_object, ['method']) is not None:
|
331
331
|
raise ValueError('method parameter is not supported in Gemini API.')
|
332
332
|
|
@@ -340,11 +340,11 @@ def _SafetySetting_to_mldev(
|
|
340
340
|
|
341
341
|
|
342
342
|
def _SafetySetting_to_vertex(
|
343
|
-
api_client:
|
343
|
+
api_client: BaseApiClient,
|
344
344
|
from_object: Union[dict, object],
|
345
|
-
parent_object: dict = None,
|
345
|
+
parent_object: Optional[dict] = None,
|
346
346
|
) -> dict:
|
347
|
-
to_object = {}
|
347
|
+
to_object: dict[str, Any] = {}
|
348
348
|
if getv(from_object, ['method']) is not None:
|
349
349
|
setv(to_object, ['method'], getv(from_object, ['method']))
|
350
350
|
|
@@ -358,11 +358,11 @@ def _SafetySetting_to_vertex(
|
|
358
358
|
|
359
359
|
|
360
360
|
def _FunctionDeclaration_to_mldev(
|
361
|
-
api_client:
|
361
|
+
api_client: BaseApiClient,
|
362
362
|
from_object: Union[dict, object],
|
363
|
-
parent_object: dict = None,
|
363
|
+
parent_object: Optional[dict] = None,
|
364
364
|
) -> dict:
|
365
|
-
to_object = {}
|
365
|
+
to_object: dict[str, Any] = {}
|
366
366
|
if getv(from_object, ['response']) is not None:
|
367
367
|
raise ValueError('response parameter is not supported in Gemini API.')
|
368
368
|
|
@@ -379,11 +379,11 @@ def _FunctionDeclaration_to_mldev(
|
|
379
379
|
|
380
380
|
|
381
381
|
def _FunctionDeclaration_to_vertex(
|
382
|
-
api_client:
|
382
|
+
api_client: BaseApiClient,
|
383
383
|
from_object: Union[dict, object],
|
384
|
-
parent_object: dict = None,
|
384
|
+
parent_object: Optional[dict] = None,
|
385
385
|
) -> dict:
|
386
|
-
to_object = {}
|
386
|
+
to_object: dict[str, Any] = {}
|
387
387
|
if getv(from_object, ['response']) is not None:
|
388
388
|
setv(
|
389
389
|
to_object,
|
@@ -406,31 +406,31 @@ def _FunctionDeclaration_to_vertex(
|
|
406
406
|
|
407
407
|
|
408
408
|
def _GoogleSearch_to_mldev(
|
409
|
-
api_client:
|
409
|
+
api_client: BaseApiClient,
|
410
410
|
from_object: Union[dict, object],
|
411
|
-
parent_object: dict = None,
|
411
|
+
parent_object: Optional[dict] = None,
|
412
412
|
) -> dict:
|
413
|
-
to_object = {}
|
413
|
+
to_object: dict[str, Any] = {}
|
414
414
|
|
415
415
|
return to_object
|
416
416
|
|
417
417
|
|
418
418
|
def _GoogleSearch_to_vertex(
|
419
|
-
api_client:
|
419
|
+
api_client: BaseApiClient,
|
420
420
|
from_object: Union[dict, object],
|
421
|
-
parent_object: dict = None,
|
421
|
+
parent_object: Optional[dict] = None,
|
422
422
|
) -> dict:
|
423
|
-
to_object = {}
|
423
|
+
to_object: dict[str, Any] = {}
|
424
424
|
|
425
425
|
return to_object
|
426
426
|
|
427
427
|
|
428
428
|
def _DynamicRetrievalConfig_to_mldev(
|
429
|
-
api_client:
|
429
|
+
api_client: BaseApiClient,
|
430
430
|
from_object: Union[dict, object],
|
431
|
-
parent_object: dict = None,
|
431
|
+
parent_object: Optional[dict] = None,
|
432
432
|
) -> dict:
|
433
|
-
to_object = {}
|
433
|
+
to_object: dict[str, Any] = {}
|
434
434
|
if getv(from_object, ['mode']) is not None:
|
435
435
|
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
436
436
|
|
@@ -445,11 +445,11 @@ def _DynamicRetrievalConfig_to_mldev(
|
|
445
445
|
|
446
446
|
|
447
447
|
def _DynamicRetrievalConfig_to_vertex(
|
448
|
-
api_client:
|
448
|
+
api_client: BaseApiClient,
|
449
449
|
from_object: Union[dict, object],
|
450
|
-
parent_object: dict = None,
|
450
|
+
parent_object: Optional[dict] = None,
|
451
451
|
) -> dict:
|
452
|
-
to_object = {}
|
452
|
+
to_object: dict[str, Any] = {}
|
453
453
|
if getv(from_object, ['mode']) is not None:
|
454
454
|
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
455
455
|
|
@@ -464,11 +464,11 @@ def _DynamicRetrievalConfig_to_vertex(
|
|
464
464
|
|
465
465
|
|
466
466
|
def _GoogleSearchRetrieval_to_mldev(
|
467
|
-
api_client:
|
467
|
+
api_client: BaseApiClient,
|
468
468
|
from_object: Union[dict, object],
|
469
|
-
parent_object: dict = None,
|
469
|
+
parent_object: Optional[dict] = None,
|
470
470
|
) -> dict:
|
471
|
-
to_object = {}
|
471
|
+
to_object: dict[str, Any] = {}
|
472
472
|
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
473
473
|
setv(
|
474
474
|
to_object,
|
@@ -484,11 +484,11 @@ def _GoogleSearchRetrieval_to_mldev(
|
|
484
484
|
|
485
485
|
|
486
486
|
def _GoogleSearchRetrieval_to_vertex(
|
487
|
-
api_client:
|
487
|
+
api_client: BaseApiClient,
|
488
488
|
from_object: Union[dict, object],
|
489
|
-
parent_object: dict = None,
|
489
|
+
parent_object: Optional[dict] = None,
|
490
490
|
) -> dict:
|
491
|
-
to_object = {}
|
491
|
+
to_object: dict[str, Any] = {}
|
492
492
|
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
493
493
|
setv(
|
494
494
|
to_object,
|
@@ -504,11 +504,11 @@ def _GoogleSearchRetrieval_to_vertex(
|
|
504
504
|
|
505
505
|
|
506
506
|
def _Tool_to_mldev(
|
507
|
-
api_client:
|
507
|
+
api_client: BaseApiClient,
|
508
508
|
from_object: Union[dict, object],
|
509
|
-
parent_object: dict = None,
|
509
|
+
parent_object: Optional[dict] = None,
|
510
510
|
) -> dict:
|
511
|
-
to_object = {}
|
511
|
+
to_object: dict[str, Any] = {}
|
512
512
|
if getv(from_object, ['function_declarations']) is not None:
|
513
513
|
setv(
|
514
514
|
to_object,
|
@@ -549,11 +549,11 @@ def _Tool_to_mldev(
|
|
549
549
|
|
550
550
|
|
551
551
|
def _Tool_to_vertex(
|
552
|
-
api_client:
|
552
|
+
api_client: BaseApiClient,
|
553
553
|
from_object: Union[dict, object],
|
554
|
-
parent_object: dict = None,
|
554
|
+
parent_object: Optional[dict] = None,
|
555
555
|
) -> dict:
|
556
|
-
to_object = {}
|
556
|
+
to_object: dict[str, Any] = {}
|
557
557
|
if getv(from_object, ['function_declarations']) is not None:
|
558
558
|
setv(
|
559
559
|
to_object,
|
@@ -594,11 +594,11 @@ def _Tool_to_vertex(
|
|
594
594
|
|
595
595
|
|
596
596
|
def _FunctionCallingConfig_to_mldev(
|
597
|
-
api_client:
|
597
|
+
api_client: BaseApiClient,
|
598
598
|
from_object: Union[dict, object],
|
599
|
-
parent_object: dict = None,
|
599
|
+
parent_object: Optional[dict] = None,
|
600
600
|
) -> dict:
|
601
|
-
to_object = {}
|
601
|
+
to_object: dict[str, Any] = {}
|
602
602
|
if getv(from_object, ['mode']) is not None:
|
603
603
|
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
604
604
|
|
@@ -613,11 +613,11 @@ def _FunctionCallingConfig_to_mldev(
|
|
613
613
|
|
614
614
|
|
615
615
|
def _FunctionCallingConfig_to_vertex(
|
616
|
-
api_client:
|
616
|
+
api_client: BaseApiClient,
|
617
617
|
from_object: Union[dict, object],
|
618
|
-
parent_object: dict = None,
|
618
|
+
parent_object: Optional[dict] = None,
|
619
619
|
) -> dict:
|
620
|
-
to_object = {}
|
620
|
+
to_object: dict[str, Any] = {}
|
621
621
|
if getv(from_object, ['mode']) is not None:
|
622
622
|
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
623
623
|
|
@@ -632,11 +632,11 @@ def _FunctionCallingConfig_to_vertex(
|
|
632
632
|
|
633
633
|
|
634
634
|
def _ToolConfig_to_mldev(
|
635
|
-
api_client:
|
635
|
+
api_client: BaseApiClient,
|
636
636
|
from_object: Union[dict, object],
|
637
|
-
parent_object: dict = None,
|
637
|
+
parent_object: Optional[dict] = None,
|
638
638
|
) -> dict:
|
639
|
-
to_object = {}
|
639
|
+
to_object: dict[str, Any] = {}
|
640
640
|
if getv(from_object, ['function_calling_config']) is not None:
|
641
641
|
setv(
|
642
642
|
to_object,
|
@@ -652,11 +652,11 @@ def _ToolConfig_to_mldev(
|
|
652
652
|
|
653
653
|
|
654
654
|
def _ToolConfig_to_vertex(
|
655
|
-
api_client:
|
655
|
+
api_client: BaseApiClient,
|
656
656
|
from_object: Union[dict, object],
|
657
|
-
parent_object: dict = None,
|
657
|
+
parent_object: Optional[dict] = None,
|
658
658
|
) -> dict:
|
659
|
-
to_object = {}
|
659
|
+
to_object: dict[str, Any] = {}
|
660
660
|
if getv(from_object, ['function_calling_config']) is not None:
|
661
661
|
setv(
|
662
662
|
to_object,
|
@@ -672,11 +672,11 @@ def _ToolConfig_to_vertex(
|
|
672
672
|
|
673
673
|
|
674
674
|
def _PrebuiltVoiceConfig_to_mldev(
|
675
|
-
api_client:
|
675
|
+
api_client: BaseApiClient,
|
676
676
|
from_object: Union[dict, object],
|
677
|
-
parent_object: dict = None,
|
677
|
+
parent_object: Optional[dict] = None,
|
678
678
|
) -> dict:
|
679
|
-
to_object = {}
|
679
|
+
to_object: dict[str, Any] = {}
|
680
680
|
if getv(from_object, ['voice_name']) is not None:
|
681
681
|
setv(to_object, ['voiceName'], getv(from_object, ['voice_name']))
|
682
682
|
|
@@ -684,11 +684,11 @@ def _PrebuiltVoiceConfig_to_mldev(
|
|
684
684
|
|
685
685
|
|
686
686
|
def _PrebuiltVoiceConfig_to_vertex(
|
687
|
-
api_client:
|
687
|
+
api_client: BaseApiClient,
|
688
688
|
from_object: Union[dict, object],
|
689
|
-
parent_object: dict = None,
|
689
|
+
parent_object: Optional[dict] = None,
|
690
690
|
) -> dict:
|
691
|
-
to_object = {}
|
691
|
+
to_object: dict[str, Any] = {}
|
692
692
|
if getv(from_object, ['voice_name']) is not None:
|
693
693
|
setv(to_object, ['voiceName'], getv(from_object, ['voice_name']))
|
694
694
|
|
@@ -696,11 +696,11 @@ def _PrebuiltVoiceConfig_to_vertex(
|
|
696
696
|
|
697
697
|
|
698
698
|
def _VoiceConfig_to_mldev(
|
699
|
-
api_client:
|
699
|
+
api_client: BaseApiClient,
|
700
700
|
from_object: Union[dict, object],
|
701
|
-
parent_object: dict = None,
|
701
|
+
parent_object: Optional[dict] = None,
|
702
702
|
) -> dict:
|
703
|
-
to_object = {}
|
703
|
+
to_object: dict[str, Any] = {}
|
704
704
|
if getv(from_object, ['prebuilt_voice_config']) is not None:
|
705
705
|
setv(
|
706
706
|
to_object,
|
@@ -714,11 +714,11 @@ def _VoiceConfig_to_mldev(
|
|
714
714
|
|
715
715
|
|
716
716
|
def _VoiceConfig_to_vertex(
|
717
|
-
api_client:
|
717
|
+
api_client: BaseApiClient,
|
718
718
|
from_object: Union[dict, object],
|
719
|
-
parent_object: dict = None,
|
719
|
+
parent_object: Optional[dict] = None,
|
720
720
|
) -> dict:
|
721
|
-
to_object = {}
|
721
|
+
to_object: dict[str, Any] = {}
|
722
722
|
if getv(from_object, ['prebuilt_voice_config']) is not None:
|
723
723
|
setv(
|
724
724
|
to_object,
|
@@ -732,11 +732,11 @@ def _VoiceConfig_to_vertex(
|
|
732
732
|
|
733
733
|
|
734
734
|
def _SpeechConfig_to_mldev(
|
735
|
-
api_client:
|
735
|
+
api_client: BaseApiClient,
|
736
736
|
from_object: Union[dict, object],
|
737
|
-
parent_object: dict = None,
|
737
|
+
parent_object: Optional[dict] = None,
|
738
738
|
) -> dict:
|
739
|
-
to_object = {}
|
739
|
+
to_object: dict[str, Any] = {}
|
740
740
|
if getv(from_object, ['voice_config']) is not None:
|
741
741
|
setv(
|
742
742
|
to_object,
|
@@ -750,11 +750,11 @@ def _SpeechConfig_to_mldev(
|
|
750
750
|
|
751
751
|
|
752
752
|
def _SpeechConfig_to_vertex(
|
753
|
-
api_client:
|
753
|
+
api_client: BaseApiClient,
|
754
754
|
from_object: Union[dict, object],
|
755
|
-
parent_object: dict = None,
|
755
|
+
parent_object: Optional[dict] = None,
|
756
756
|
) -> dict:
|
757
|
-
to_object = {}
|
757
|
+
to_object: dict[str, Any] = {}
|
758
758
|
if getv(from_object, ['voice_config']) is not None:
|
759
759
|
setv(
|
760
760
|
to_object,
|
@@ -768,11 +768,11 @@ def _SpeechConfig_to_vertex(
|
|
768
768
|
|
769
769
|
|
770
770
|
def _ThinkingConfig_to_mldev(
|
771
|
-
api_client:
|
771
|
+
api_client: BaseApiClient,
|
772
772
|
from_object: Union[dict, object],
|
773
|
-
parent_object: dict = None,
|
773
|
+
parent_object: Optional[dict] = None,
|
774
774
|
) -> dict:
|
775
|
-
to_object = {}
|
775
|
+
to_object: dict[str, Any] = {}
|
776
776
|
if getv(from_object, ['include_thoughts']) is not None:
|
777
777
|
setv(
|
778
778
|
to_object, ['includeThoughts'], getv(from_object, ['include_thoughts'])
|
@@ -782,11 +782,11 @@ def _ThinkingConfig_to_mldev(
|
|
782
782
|
|
783
783
|
|
784
784
|
def _ThinkingConfig_to_vertex(
|
785
|
-
api_client:
|
785
|
+
api_client: BaseApiClient,
|
786
786
|
from_object: Union[dict, object],
|
787
|
-
parent_object: dict = None,
|
787
|
+
parent_object: Optional[dict] = None,
|
788
788
|
) -> dict:
|
789
|
-
to_object = {}
|
789
|
+
to_object: dict[str, Any] = {}
|
790
790
|
if getv(from_object, ['include_thoughts']) is not None:
|
791
791
|
setv(
|
792
792
|
to_object, ['includeThoughts'], getv(from_object, ['include_thoughts'])
|
@@ -796,11 +796,11 @@ def _ThinkingConfig_to_vertex(
|
|
796
796
|
|
797
797
|
|
798
798
|
def _GenerateContentConfig_to_mldev(
|
799
|
-
api_client:
|
799
|
+
api_client: BaseApiClient,
|
800
800
|
from_object: Union[dict, object],
|
801
|
-
parent_object: dict = None,
|
801
|
+
parent_object: Optional[dict] = None,
|
802
802
|
) -> dict:
|
803
|
-
to_object = {}
|
803
|
+
to_object: dict[str, Any] = {}
|
804
804
|
|
805
805
|
if getv(from_object, ['system_instruction']) is not None:
|
806
806
|
setv(
|
@@ -961,11 +961,11 @@ def _GenerateContentConfig_to_mldev(
|
|
961
961
|
|
962
962
|
|
963
963
|
def _GenerateContentConfig_to_vertex(
|
964
|
-
api_client:
|
964
|
+
api_client: BaseApiClient,
|
965
965
|
from_object: Union[dict, object],
|
966
|
-
parent_object: dict = None,
|
966
|
+
parent_object: Optional[dict] = None,
|
967
967
|
) -> dict:
|
968
|
-
to_object = {}
|
968
|
+
to_object: dict[str, Any] = {}
|
969
969
|
|
970
970
|
if getv(from_object, ['system_instruction']) is not None:
|
971
971
|
setv(
|
@@ -1124,11 +1124,11 @@ def _GenerateContentConfig_to_vertex(
|
|
1124
1124
|
|
1125
1125
|
|
1126
1126
|
def _GenerateContentParameters_to_mldev(
|
1127
|
-
api_client:
|
1127
|
+
api_client: BaseApiClient,
|
1128
1128
|
from_object: Union[dict, object],
|
1129
|
-
parent_object: dict = None,
|
1129
|
+
parent_object: Optional[dict] = None,
|
1130
1130
|
) -> dict:
|
1131
|
-
to_object = {}
|
1131
|
+
to_object: dict[str, Any] = {}
|
1132
1132
|
if getv(from_object, ['model']) is not None:
|
1133
1133
|
setv(
|
1134
1134
|
to_object,
|
@@ -1161,11 +1161,11 @@ def _GenerateContentParameters_to_mldev(
|
|
1161
1161
|
|
1162
1162
|
|
1163
1163
|
def _GenerateContentParameters_to_vertex(
|
1164
|
-
api_client:
|
1164
|
+
api_client: BaseApiClient,
|
1165
1165
|
from_object: Union[dict, object],
|
1166
|
-
parent_object: dict = None,
|
1166
|
+
parent_object: Optional[dict] = None,
|
1167
1167
|
) -> dict:
|
1168
|
-
to_object = {}
|
1168
|
+
to_object: dict[str, Any] = {}
|
1169
1169
|
if getv(from_object, ['model']) is not None:
|
1170
1170
|
setv(
|
1171
1171
|
to_object,
|
@@ -1198,11 +1198,11 @@ def _GenerateContentParameters_to_vertex(
|
|
1198
1198
|
|
1199
1199
|
|
1200
1200
|
def _EmbedContentConfig_to_mldev(
|
1201
|
-
api_client:
|
1201
|
+
api_client: BaseApiClient,
|
1202
1202
|
from_object: Union[dict, object],
|
1203
|
-
parent_object: dict = None,
|
1203
|
+
parent_object: Optional[dict] = None,
|
1204
1204
|
) -> dict:
|
1205
|
-
to_object = {}
|
1205
|
+
to_object: dict[str, Any] = {}
|
1206
1206
|
|
1207
1207
|
if getv(from_object, ['task_type']) is not None:
|
1208
1208
|
setv(
|
@@ -1231,11 +1231,11 @@ def _EmbedContentConfig_to_mldev(
|
|
1231
1231
|
|
1232
1232
|
|
1233
1233
|
def _EmbedContentConfig_to_vertex(
|
1234
|
-
api_client:
|
1234
|
+
api_client: BaseApiClient,
|
1235
1235
|
from_object: Union[dict, object],
|
1236
|
-
parent_object: dict = None,
|
1236
|
+
parent_object: Optional[dict] = None,
|
1237
1237
|
) -> dict:
|
1238
|
-
to_object = {}
|
1238
|
+
to_object: dict[str, Any] = {}
|
1239
1239
|
|
1240
1240
|
if getv(from_object, ['task_type']) is not None:
|
1241
1241
|
setv(
|
@@ -1272,11 +1272,11 @@ def _EmbedContentConfig_to_vertex(
|
|
1272
1272
|
|
1273
1273
|
|
1274
1274
|
def _EmbedContentParameters_to_mldev(
|
1275
|
-
api_client:
|
1275
|
+
api_client: BaseApiClient,
|
1276
1276
|
from_object: Union[dict, object],
|
1277
|
-
parent_object: dict = None,
|
1277
|
+
parent_object: Optional[dict] = None,
|
1278
1278
|
) -> dict:
|
1279
|
-
to_object = {}
|
1279
|
+
to_object: dict[str, Any] = {}
|
1280
1280
|
if getv(from_object, ['model']) is not None:
|
1281
1281
|
setv(
|
1282
1282
|
to_object,
|
@@ -1309,11 +1309,11 @@ def _EmbedContentParameters_to_mldev(
|
|
1309
1309
|
|
1310
1310
|
|
1311
1311
|
def _EmbedContentParameters_to_vertex(
|
1312
|
-
api_client:
|
1312
|
+
api_client: BaseApiClient,
|
1313
1313
|
from_object: Union[dict, object],
|
1314
|
-
parent_object: dict = None,
|
1314
|
+
parent_object: Optional[dict] = None,
|
1315
1315
|
) -> dict:
|
1316
|
-
to_object = {}
|
1316
|
+
to_object: dict[str, Any] = {}
|
1317
1317
|
if getv(from_object, ['model']) is not None:
|
1318
1318
|
setv(
|
1319
1319
|
to_object,
|
@@ -1341,11 +1341,11 @@ def _EmbedContentParameters_to_vertex(
|
|
1341
1341
|
|
1342
1342
|
|
1343
1343
|
def _GenerateImagesConfig_to_mldev(
|
1344
|
-
api_client:
|
1344
|
+
api_client: BaseApiClient,
|
1345
1345
|
from_object: Union[dict, object],
|
1346
|
-
parent_object: dict = None,
|
1346
|
+
parent_object: Optional[dict] = None,
|
1347
1347
|
) -> dict:
|
1348
|
-
to_object = {}
|
1348
|
+
to_object: dict[str, Any] = {}
|
1349
1349
|
|
1350
1350
|
if getv(from_object, ['output_gcs_uri']) is not None:
|
1351
1351
|
raise ValueError('output_gcs_uri parameter is not supported in Gemini API.')
|
@@ -1364,6 +1364,13 @@ def _GenerateImagesConfig_to_mldev(
|
|
1364
1364
|
getv(from_object, ['number_of_images']),
|
1365
1365
|
)
|
1366
1366
|
|
1367
|
+
if getv(from_object, ['aspect_ratio']) is not None:
|
1368
|
+
setv(
|
1369
|
+
parent_object,
|
1370
|
+
['parameters', 'aspectRatio'],
|
1371
|
+
getv(from_object, ['aspect_ratio']),
|
1372
|
+
)
|
1373
|
+
|
1367
1374
|
if getv(from_object, ['guidance_scale']) is not None:
|
1368
1375
|
setv(
|
1369
1376
|
parent_object,
|
@@ -1432,13 +1439,6 @@ def _GenerateImagesConfig_to_mldev(
|
|
1432
1439
|
if getv(from_object, ['add_watermark']) is not None:
|
1433
1440
|
raise ValueError('add_watermark parameter is not supported in Gemini API.')
|
1434
1441
|
|
1435
|
-
if getv(from_object, ['aspect_ratio']) is not None:
|
1436
|
-
setv(
|
1437
|
-
parent_object,
|
1438
|
-
['parameters', 'aspectRatio'],
|
1439
|
-
getv(from_object, ['aspect_ratio']),
|
1440
|
-
)
|
1441
|
-
|
1442
1442
|
if getv(from_object, ['enhance_prompt']) is not None:
|
1443
1443
|
raise ValueError('enhance_prompt parameter is not supported in Gemini API.')
|
1444
1444
|
|
@@ -1446,11 +1446,11 @@ def _GenerateImagesConfig_to_mldev(
|
|
1446
1446
|
|
1447
1447
|
|
1448
1448
|
def _GenerateImagesConfig_to_vertex(
|
1449
|
-
api_client:
|
1449
|
+
api_client: BaseApiClient,
|
1450
1450
|
from_object: Union[dict, object],
|
1451
|
-
parent_object: dict = None,
|
1451
|
+
parent_object: Optional[dict] = None,
|
1452
1452
|
) -> dict:
|
1453
|
-
to_object = {}
|
1453
|
+
to_object: dict[str, Any] = {}
|
1454
1454
|
|
1455
1455
|
if getv(from_object, ['output_gcs_uri']) is not None:
|
1456
1456
|
setv(
|
@@ -1473,6 +1473,13 @@ def _GenerateImagesConfig_to_vertex(
|
|
1473
1473
|
getv(from_object, ['number_of_images']),
|
1474
1474
|
)
|
1475
1475
|
|
1476
|
+
if getv(from_object, ['aspect_ratio']) is not None:
|
1477
|
+
setv(
|
1478
|
+
parent_object,
|
1479
|
+
['parameters', 'aspectRatio'],
|
1480
|
+
getv(from_object, ['aspect_ratio']),
|
1481
|
+
)
|
1482
|
+
|
1476
1483
|
if getv(from_object, ['guidance_scale']) is not None:
|
1477
1484
|
setv(
|
1478
1485
|
parent_object,
|
@@ -1539,13 +1546,6 @@ def _GenerateImagesConfig_to_vertex(
|
|
1539
1546
|
getv(from_object, ['add_watermark']),
|
1540
1547
|
)
|
1541
1548
|
|
1542
|
-
if getv(from_object, ['aspect_ratio']) is not None:
|
1543
|
-
setv(
|
1544
|
-
parent_object,
|
1545
|
-
['parameters', 'aspectRatio'],
|
1546
|
-
getv(from_object, ['aspect_ratio']),
|
1547
|
-
)
|
1548
|
-
|
1549
1549
|
if getv(from_object, ['enhance_prompt']) is not None:
|
1550
1550
|
setv(
|
1551
1551
|
parent_object,
|
@@ -1557,11 +1557,11 @@ def _GenerateImagesConfig_to_vertex(
|
|
1557
1557
|
|
1558
1558
|
|
1559
1559
|
def _GenerateImagesParameters_to_mldev(
|
1560
|
-
api_client:
|
1560
|
+
api_client: BaseApiClient,
|
1561
1561
|
from_object: Union[dict, object],
|
1562
|
-
parent_object: dict = None,
|
1562
|
+
parent_object: Optional[dict] = None,
|
1563
1563
|
) -> dict:
|
1564
|
-
to_object = {}
|
1564
|
+
to_object: dict[str, Any] = {}
|
1565
1565
|
if getv(from_object, ['model']) is not None:
|
1566
1566
|
setv(
|
1567
1567
|
to_object,
|
@@ -1570,7 +1570,7 @@ def _GenerateImagesParameters_to_mldev(
|
|
1570
1570
|
)
|
1571
1571
|
|
1572
1572
|
if getv(from_object, ['prompt']) is not None:
|
1573
|
-
setv(to_object, ['instances', 'prompt'], getv(from_object, ['prompt']))
|
1573
|
+
setv(to_object, ['instances[0]', 'prompt'], getv(from_object, ['prompt']))
|
1574
1574
|
|
1575
1575
|
if getv(from_object, ['config']) is not None:
|
1576
1576
|
setv(
|
@@ -1585,11 +1585,11 @@ def _GenerateImagesParameters_to_mldev(
|
|
1585
1585
|
|
1586
1586
|
|
1587
1587
|
def _GenerateImagesParameters_to_vertex(
|
1588
|
-
api_client:
|
1588
|
+
api_client: BaseApiClient,
|
1589
1589
|
from_object: Union[dict, object],
|
1590
|
-
parent_object: dict = None,
|
1590
|
+
parent_object: Optional[dict] = None,
|
1591
1591
|
) -> dict:
|
1592
|
-
to_object = {}
|
1592
|
+
to_object: dict[str, Any] = {}
|
1593
1593
|
if getv(from_object, ['model']) is not None:
|
1594
1594
|
setv(
|
1595
1595
|
to_object,
|
@@ -1598,7 +1598,7 @@ def _GenerateImagesParameters_to_vertex(
|
|
1598
1598
|
)
|
1599
1599
|
|
1600
1600
|
if getv(from_object, ['prompt']) is not None:
|
1601
|
-
setv(to_object, ['instances', 'prompt'], getv(from_object, ['prompt']))
|
1601
|
+
setv(to_object, ['instances[0]', 'prompt'], getv(from_object, ['prompt']))
|
1602
1602
|
|
1603
1603
|
if getv(from_object, ['config']) is not None:
|
1604
1604
|
setv(
|
@@ -1613,11 +1613,11 @@ def _GenerateImagesParameters_to_vertex(
|
|
1613
1613
|
|
1614
1614
|
|
1615
1615
|
def _Image_to_mldev(
|
1616
|
-
api_client:
|
1616
|
+
api_client: BaseApiClient,
|
1617
1617
|
from_object: Union[dict, object],
|
1618
|
-
parent_object: dict = None,
|
1618
|
+
parent_object: Optional[dict] = None,
|
1619
1619
|
) -> dict:
|
1620
|
-
to_object = {}
|
1620
|
+
to_object: dict[str, Any] = {}
|
1621
1621
|
if getv(from_object, ['gcs_uri']) is not None:
|
1622
1622
|
raise ValueError('gcs_uri parameter is not supported in Gemini API.')
|
1623
1623
|
|
@@ -1635,11 +1635,11 @@ def _Image_to_mldev(
|
|
1635
1635
|
|
1636
1636
|
|
1637
1637
|
def _Image_to_vertex(
|
1638
|
-
api_client:
|
1638
|
+
api_client: BaseApiClient,
|
1639
1639
|
from_object: Union[dict, object],
|
1640
|
-
parent_object: dict = None,
|
1640
|
+
parent_object: Optional[dict] = None,
|
1641
1641
|
) -> dict:
|
1642
|
-
to_object = {}
|
1642
|
+
to_object: dict[str, Any] = {}
|
1643
1643
|
if getv(from_object, ['gcs_uri']) is not None:
|
1644
1644
|
setv(to_object, ['gcsUri'], getv(from_object, ['gcs_uri']))
|
1645
1645
|
|
@@ -1657,11 +1657,11 @@ def _Image_to_vertex(
|
|
1657
1657
|
|
1658
1658
|
|
1659
1659
|
def _MaskReferenceConfig_to_mldev(
|
1660
|
-
api_client:
|
1660
|
+
api_client: BaseApiClient,
|
1661
1661
|
from_object: Union[dict, object],
|
1662
|
-
parent_object: dict = None,
|
1662
|
+
parent_object: Optional[dict] = None,
|
1663
1663
|
) -> dict:
|
1664
|
-
to_object = {}
|
1664
|
+
to_object: dict[str, Any] = {}
|
1665
1665
|
if getv(from_object, ['mask_mode']) is not None:
|
1666
1666
|
raise ValueError('mask_mode parameter is not supported in Gemini API.')
|
1667
1667
|
|
@@ -1677,11 +1677,11 @@ def _MaskReferenceConfig_to_mldev(
|
|
1677
1677
|
|
1678
1678
|
|
1679
1679
|
def _MaskReferenceConfig_to_vertex(
|
1680
|
-
api_client:
|
1680
|
+
api_client: BaseApiClient,
|
1681
1681
|
from_object: Union[dict, object],
|
1682
|
-
parent_object: dict = None,
|
1682
|
+
parent_object: Optional[dict] = None,
|
1683
1683
|
) -> dict:
|
1684
|
-
to_object = {}
|
1684
|
+
to_object: dict[str, Any] = {}
|
1685
1685
|
if getv(from_object, ['mask_mode']) is not None:
|
1686
1686
|
setv(to_object, ['maskMode'], getv(from_object, ['mask_mode']))
|
1687
1687
|
|
@@ -1697,11 +1697,11 @@ def _MaskReferenceConfig_to_vertex(
|
|
1697
1697
|
|
1698
1698
|
|
1699
1699
|
def _ControlReferenceConfig_to_mldev(
|
1700
|
-
api_client:
|
1700
|
+
api_client: BaseApiClient,
|
1701
1701
|
from_object: Union[dict, object],
|
1702
|
-
parent_object: dict = None,
|
1702
|
+
parent_object: Optional[dict] = None,
|
1703
1703
|
) -> dict:
|
1704
|
-
to_object = {}
|
1704
|
+
to_object: dict[str, Any] = {}
|
1705
1705
|
if getv(from_object, ['control_type']) is not None:
|
1706
1706
|
raise ValueError('control_type parameter is not supported in Gemini API.')
|
1707
1707
|
|
@@ -1715,11 +1715,11 @@ def _ControlReferenceConfig_to_mldev(
|
|
1715
1715
|
|
1716
1716
|
|
1717
1717
|
def _ControlReferenceConfig_to_vertex(
|
1718
|
-
api_client:
|
1718
|
+
api_client: BaseApiClient,
|
1719
1719
|
from_object: Union[dict, object],
|
1720
|
-
parent_object: dict = None,
|
1720
|
+
parent_object: Optional[dict] = None,
|
1721
1721
|
) -> dict:
|
1722
|
-
to_object = {}
|
1722
|
+
to_object: dict[str, Any] = {}
|
1723
1723
|
if getv(from_object, ['control_type']) is not None:
|
1724
1724
|
setv(to_object, ['controlType'], getv(from_object, ['control_type']))
|
1725
1725
|
|
@@ -1734,11 +1734,11 @@ def _ControlReferenceConfig_to_vertex(
|
|
1734
1734
|
|
1735
1735
|
|
1736
1736
|
def _StyleReferenceConfig_to_mldev(
|
1737
|
-
api_client:
|
1737
|
+
api_client: BaseApiClient,
|
1738
1738
|
from_object: Union[dict, object],
|
1739
|
-
parent_object: dict = None,
|
1739
|
+
parent_object: Optional[dict] = None,
|
1740
1740
|
) -> dict:
|
1741
|
-
to_object = {}
|
1741
|
+
to_object: dict[str, Any] = {}
|
1742
1742
|
if getv(from_object, ['style_description']) is not None:
|
1743
1743
|
raise ValueError(
|
1744
1744
|
'style_description parameter is not supported in Gemini API.'
|
@@ -1748,11 +1748,11 @@ def _StyleReferenceConfig_to_mldev(
|
|
1748
1748
|
|
1749
1749
|
|
1750
1750
|
def _StyleReferenceConfig_to_vertex(
|
1751
|
-
api_client:
|
1751
|
+
api_client: BaseApiClient,
|
1752
1752
|
from_object: Union[dict, object],
|
1753
|
-
parent_object: dict = None,
|
1753
|
+
parent_object: Optional[dict] = None,
|
1754
1754
|
) -> dict:
|
1755
|
-
to_object = {}
|
1755
|
+
to_object: dict[str, Any] = {}
|
1756
1756
|
if getv(from_object, ['style_description']) is not None:
|
1757
1757
|
setv(
|
1758
1758
|
to_object,
|
@@ -1764,11 +1764,11 @@ def _StyleReferenceConfig_to_vertex(
|
|
1764
1764
|
|
1765
1765
|
|
1766
1766
|
def _SubjectReferenceConfig_to_mldev(
|
1767
|
-
api_client:
|
1767
|
+
api_client: BaseApiClient,
|
1768
1768
|
from_object: Union[dict, object],
|
1769
|
-
parent_object: dict = None,
|
1769
|
+
parent_object: Optional[dict] = None,
|
1770
1770
|
) -> dict:
|
1771
|
-
to_object = {}
|
1771
|
+
to_object: dict[str, Any] = {}
|
1772
1772
|
if getv(from_object, ['subject_type']) is not None:
|
1773
1773
|
raise ValueError('subject_type parameter is not supported in Gemini API.')
|
1774
1774
|
|
@@ -1781,11 +1781,11 @@ def _SubjectReferenceConfig_to_mldev(
|
|
1781
1781
|
|
1782
1782
|
|
1783
1783
|
def _SubjectReferenceConfig_to_vertex(
|
1784
|
-
api_client:
|
1784
|
+
api_client: BaseApiClient,
|
1785
1785
|
from_object: Union[dict, object],
|
1786
|
-
parent_object: dict = None,
|
1786
|
+
parent_object: Optional[dict] = None,
|
1787
1787
|
) -> dict:
|
1788
|
-
to_object = {}
|
1788
|
+
to_object: dict[str, Any] = {}
|
1789
1789
|
if getv(from_object, ['subject_type']) is not None:
|
1790
1790
|
setv(to_object, ['subjectType'], getv(from_object, ['subject_type']))
|
1791
1791
|
|
@@ -1800,11 +1800,11 @@ def _SubjectReferenceConfig_to_vertex(
|
|
1800
1800
|
|
1801
1801
|
|
1802
1802
|
def _ReferenceImageAPI_to_mldev(
|
1803
|
-
api_client:
|
1803
|
+
api_client: BaseApiClient,
|
1804
1804
|
from_object: Union[dict, object],
|
1805
|
-
parent_object: dict = None,
|
1805
|
+
parent_object: Optional[dict] = None,
|
1806
1806
|
) -> dict:
|
1807
|
-
to_object = {}
|
1807
|
+
to_object: dict[str, Any] = {}
|
1808
1808
|
if getv(from_object, ['reference_image']) is not None:
|
1809
1809
|
raise ValueError(
|
1810
1810
|
'reference_image parameter is not supported in Gemini API.'
|
@@ -1840,11 +1840,11 @@ def _ReferenceImageAPI_to_mldev(
|
|
1840
1840
|
|
1841
1841
|
|
1842
1842
|
def _ReferenceImageAPI_to_vertex(
|
1843
|
-
api_client:
|
1843
|
+
api_client: BaseApiClient,
|
1844
1844
|
from_object: Union[dict, object],
|
1845
|
-
parent_object: dict = None,
|
1845
|
+
parent_object: Optional[dict] = None,
|
1846
1846
|
) -> dict:
|
1847
|
-
to_object = {}
|
1847
|
+
to_object: dict[str, Any] = {}
|
1848
1848
|
if getv(from_object, ['reference_image']) is not None:
|
1849
1849
|
setv(
|
1850
1850
|
to_object,
|
@@ -1900,11 +1900,11 @@ def _ReferenceImageAPI_to_vertex(
|
|
1900
1900
|
|
1901
1901
|
|
1902
1902
|
def _EditImageConfig_to_mldev(
|
1903
|
-
api_client:
|
1903
|
+
api_client: BaseApiClient,
|
1904
1904
|
from_object: Union[dict, object],
|
1905
|
-
parent_object: dict = None,
|
1905
|
+
parent_object: Optional[dict] = None,
|
1906
1906
|
) -> dict:
|
1907
|
-
to_object = {}
|
1907
|
+
to_object: dict[str, Any] = {}
|
1908
1908
|
|
1909
1909
|
if getv(from_object, ['output_gcs_uri']) is not None:
|
1910
1910
|
raise ValueError('output_gcs_uri parameter is not supported in Gemini API.')
|
@@ -1923,6 +1923,13 @@ def _EditImageConfig_to_mldev(
|
|
1923
1923
|
getv(from_object, ['number_of_images']),
|
1924
1924
|
)
|
1925
1925
|
|
1926
|
+
if getv(from_object, ['aspect_ratio']) is not None:
|
1927
|
+
setv(
|
1928
|
+
parent_object,
|
1929
|
+
['parameters', 'aspectRatio'],
|
1930
|
+
getv(from_object, ['aspect_ratio']),
|
1931
|
+
)
|
1932
|
+
|
1926
1933
|
if getv(from_object, ['guidance_scale']) is not None:
|
1927
1934
|
setv(
|
1928
1935
|
parent_object,
|
@@ -2000,11 +2007,11 @@ def _EditImageConfig_to_mldev(
|
|
2000
2007
|
|
2001
2008
|
|
2002
2009
|
def _EditImageConfig_to_vertex(
|
2003
|
-
api_client:
|
2010
|
+
api_client: BaseApiClient,
|
2004
2011
|
from_object: Union[dict, object],
|
2005
|
-
parent_object: dict = None,
|
2012
|
+
parent_object: Optional[dict] = None,
|
2006
2013
|
) -> dict:
|
2007
|
-
to_object = {}
|
2014
|
+
to_object: dict[str, Any] = {}
|
2008
2015
|
|
2009
2016
|
if getv(from_object, ['output_gcs_uri']) is not None:
|
2010
2017
|
setv(
|
@@ -2027,6 +2034,13 @@ def _EditImageConfig_to_vertex(
|
|
2027
2034
|
getv(from_object, ['number_of_images']),
|
2028
2035
|
)
|
2029
2036
|
|
2037
|
+
if getv(from_object, ['aspect_ratio']) is not None:
|
2038
|
+
setv(
|
2039
|
+
parent_object,
|
2040
|
+
['parameters', 'aspectRatio'],
|
2041
|
+
getv(from_object, ['aspect_ratio']),
|
2042
|
+
)
|
2043
|
+
|
2030
2044
|
if getv(from_object, ['guidance_scale']) is not None:
|
2031
2045
|
setv(
|
2032
2046
|
parent_object,
|
@@ -2097,11 +2111,11 @@ def _EditImageConfig_to_vertex(
|
|
2097
2111
|
|
2098
2112
|
|
2099
2113
|
def _EditImageParameters_to_mldev(
|
2100
|
-
api_client:
|
2114
|
+
api_client: BaseApiClient,
|
2101
2115
|
from_object: Union[dict, object],
|
2102
|
-
parent_object: dict = None,
|
2116
|
+
parent_object: Optional[dict] = None,
|
2103
2117
|
) -> dict:
|
2104
|
-
to_object = {}
|
2118
|
+
to_object: dict[str, Any] = {}
|
2105
2119
|
if getv(from_object, ['model']) is not None:
|
2106
2120
|
setv(
|
2107
2121
|
to_object,
|
@@ -2110,12 +2124,12 @@ def _EditImageParameters_to_mldev(
|
|
2110
2124
|
)
|
2111
2125
|
|
2112
2126
|
if getv(from_object, ['prompt']) is not None:
|
2113
|
-
setv(to_object, ['instances', 'prompt'], getv(from_object, ['prompt']))
|
2127
|
+
setv(to_object, ['instances[0]', 'prompt'], getv(from_object, ['prompt']))
|
2114
2128
|
|
2115
2129
|
if getv(from_object, ['reference_images']) is not None:
|
2116
2130
|
setv(
|
2117
2131
|
to_object,
|
2118
|
-
['instances', 'referenceImages'],
|
2132
|
+
['instances[0]', 'referenceImages'],
|
2119
2133
|
[
|
2120
2134
|
_ReferenceImageAPI_to_mldev(api_client, item, to_object)
|
2121
2135
|
for item in getv(from_object, ['reference_images'])
|
@@ -2135,11 +2149,11 @@ def _EditImageParameters_to_mldev(
|
|
2135
2149
|
|
2136
2150
|
|
2137
2151
|
def _EditImageParameters_to_vertex(
|
2138
|
-
api_client:
|
2152
|
+
api_client: BaseApiClient,
|
2139
2153
|
from_object: Union[dict, object],
|
2140
|
-
parent_object: dict = None,
|
2154
|
+
parent_object: Optional[dict] = None,
|
2141
2155
|
) -> dict:
|
2142
|
-
to_object = {}
|
2156
|
+
to_object: dict[str, Any] = {}
|
2143
2157
|
if getv(from_object, ['model']) is not None:
|
2144
2158
|
setv(
|
2145
2159
|
to_object,
|
@@ -2148,12 +2162,12 @@ def _EditImageParameters_to_vertex(
|
|
2148
2162
|
)
|
2149
2163
|
|
2150
2164
|
if getv(from_object, ['prompt']) is not None:
|
2151
|
-
setv(to_object, ['instances', 'prompt'], getv(from_object, ['prompt']))
|
2165
|
+
setv(to_object, ['instances[0]', 'prompt'], getv(from_object, ['prompt']))
|
2152
2166
|
|
2153
2167
|
if getv(from_object, ['reference_images']) is not None:
|
2154
2168
|
setv(
|
2155
2169
|
to_object,
|
2156
|
-
['instances', 'referenceImages'],
|
2170
|
+
['instances[0]', 'referenceImages'],
|
2157
2171
|
[
|
2158
2172
|
_ReferenceImageAPI_to_vertex(api_client, item, to_object)
|
2159
2173
|
for item in getv(from_object, ['reference_images'])
|
@@ -2173,11 +2187,11 @@ def _EditImageParameters_to_vertex(
|
|
2173
2187
|
|
2174
2188
|
|
2175
2189
|
def _UpscaleImageAPIConfig_to_mldev(
|
2176
|
-
api_client:
|
2190
|
+
api_client: BaseApiClient,
|
2177
2191
|
from_object: Union[dict, object],
|
2178
|
-
parent_object: dict = None,
|
2192
|
+
parent_object: Optional[dict] = None,
|
2179
2193
|
) -> dict:
|
2180
|
-
to_object = {}
|
2194
|
+
to_object: dict[str, Any] = {}
|
2181
2195
|
|
2182
2196
|
if getv(from_object, ['include_rai_reason']) is not None:
|
2183
2197
|
setv(
|
@@ -2214,11 +2228,11 @@ def _UpscaleImageAPIConfig_to_mldev(
|
|
2214
2228
|
|
2215
2229
|
|
2216
2230
|
def _UpscaleImageAPIConfig_to_vertex(
|
2217
|
-
api_client:
|
2231
|
+
api_client: BaseApiClient,
|
2218
2232
|
from_object: Union[dict, object],
|
2219
|
-
parent_object: dict = None,
|
2233
|
+
parent_object: Optional[dict] = None,
|
2220
2234
|
) -> dict:
|
2221
|
-
to_object = {}
|
2235
|
+
to_object: dict[str, Any] = {}
|
2222
2236
|
|
2223
2237
|
if getv(from_object, ['include_rai_reason']) is not None:
|
2224
2238
|
setv(
|
@@ -2255,11 +2269,11 @@ def _UpscaleImageAPIConfig_to_vertex(
|
|
2255
2269
|
|
2256
2270
|
|
2257
2271
|
def _UpscaleImageAPIParameters_to_mldev(
|
2258
|
-
api_client:
|
2272
|
+
api_client: BaseApiClient,
|
2259
2273
|
from_object: Union[dict, object],
|
2260
|
-
parent_object: dict = None,
|
2274
|
+
parent_object: Optional[dict] = None,
|
2261
2275
|
) -> dict:
|
2262
|
-
to_object = {}
|
2276
|
+
to_object: dict[str, Any] = {}
|
2263
2277
|
if getv(from_object, ['model']) is not None:
|
2264
2278
|
setv(
|
2265
2279
|
to_object,
|
@@ -2270,7 +2284,7 @@ def _UpscaleImageAPIParameters_to_mldev(
|
|
2270
2284
|
if getv(from_object, ['image']) is not None:
|
2271
2285
|
setv(
|
2272
2286
|
to_object,
|
2273
|
-
['instances', 'image'],
|
2287
|
+
['instances[0]', 'image'],
|
2274
2288
|
_Image_to_mldev(api_client, getv(from_object, ['image']), to_object),
|
2275
2289
|
)
|
2276
2290
|
|
@@ -2294,11 +2308,11 @@ def _UpscaleImageAPIParameters_to_mldev(
|
|
2294
2308
|
|
2295
2309
|
|
2296
2310
|
def _UpscaleImageAPIParameters_to_vertex(
|
2297
|
-
api_client:
|
2311
|
+
api_client: BaseApiClient,
|
2298
2312
|
from_object: Union[dict, object],
|
2299
|
-
parent_object: dict = None,
|
2313
|
+
parent_object: Optional[dict] = None,
|
2300
2314
|
) -> dict:
|
2301
|
-
to_object = {}
|
2315
|
+
to_object: dict[str, Any] = {}
|
2302
2316
|
if getv(from_object, ['model']) is not None:
|
2303
2317
|
setv(
|
2304
2318
|
to_object,
|
@@ -2309,7 +2323,7 @@ def _UpscaleImageAPIParameters_to_vertex(
|
|
2309
2323
|
if getv(from_object, ['image']) is not None:
|
2310
2324
|
setv(
|
2311
2325
|
to_object,
|
2312
|
-
['instances', 'image'],
|
2326
|
+
['instances[0]', 'image'],
|
2313
2327
|
_Image_to_vertex(api_client, getv(from_object, ['image']), to_object),
|
2314
2328
|
)
|
2315
2329
|
|
@@ -2333,11 +2347,11 @@ def _UpscaleImageAPIParameters_to_vertex(
|
|
2333
2347
|
|
2334
2348
|
|
2335
2349
|
def _GetModelParameters_to_mldev(
|
2336
|
-
api_client:
|
2350
|
+
api_client: BaseApiClient,
|
2337
2351
|
from_object: Union[dict, object],
|
2338
|
-
parent_object: dict = None,
|
2352
|
+
parent_object: Optional[dict] = None,
|
2339
2353
|
) -> dict:
|
2340
|
-
to_object = {}
|
2354
|
+
to_object: dict[str, Any] = {}
|
2341
2355
|
if getv(from_object, ['model']) is not None:
|
2342
2356
|
setv(
|
2343
2357
|
to_object,
|
@@ -2352,11 +2366,11 @@ def _GetModelParameters_to_mldev(
|
|
2352
2366
|
|
2353
2367
|
|
2354
2368
|
def _GetModelParameters_to_vertex(
|
2355
|
-
api_client:
|
2369
|
+
api_client: BaseApiClient,
|
2356
2370
|
from_object: Union[dict, object],
|
2357
|
-
parent_object: dict = None,
|
2371
|
+
parent_object: Optional[dict] = None,
|
2358
2372
|
) -> dict:
|
2359
|
-
to_object = {}
|
2373
|
+
to_object: dict[str, Any] = {}
|
2360
2374
|
if getv(from_object, ['model']) is not None:
|
2361
2375
|
setv(
|
2362
2376
|
to_object,
|
@@ -2371,11 +2385,11 @@ def _GetModelParameters_to_vertex(
|
|
2371
2385
|
|
2372
2386
|
|
2373
2387
|
def _ListModelsConfig_to_mldev(
|
2374
|
-
api_client:
|
2388
|
+
api_client: BaseApiClient,
|
2375
2389
|
from_object: Union[dict, object],
|
2376
|
-
parent_object: dict = None,
|
2390
|
+
parent_object: Optional[dict] = None,
|
2377
2391
|
) -> dict:
|
2378
|
-
to_object = {}
|
2392
|
+
to_object: dict[str, Any] = {}
|
2379
2393
|
|
2380
2394
|
if getv(from_object, ['page_size']) is not None:
|
2381
2395
|
setv(
|
@@ -2403,11 +2417,11 @@ def _ListModelsConfig_to_mldev(
|
|
2403
2417
|
|
2404
2418
|
|
2405
2419
|
def _ListModelsConfig_to_vertex(
|
2406
|
-
api_client:
|
2420
|
+
api_client: BaseApiClient,
|
2407
2421
|
from_object: Union[dict, object],
|
2408
|
-
parent_object: dict = None,
|
2422
|
+
parent_object: Optional[dict] = None,
|
2409
2423
|
) -> dict:
|
2410
|
-
to_object = {}
|
2424
|
+
to_object: dict[str, Any] = {}
|
2411
2425
|
|
2412
2426
|
if getv(from_object, ['page_size']) is not None:
|
2413
2427
|
setv(
|
@@ -2435,11 +2449,11 @@ def _ListModelsConfig_to_vertex(
|
|
2435
2449
|
|
2436
2450
|
|
2437
2451
|
def _ListModelsParameters_to_mldev(
|
2438
|
-
api_client:
|
2452
|
+
api_client: BaseApiClient,
|
2439
2453
|
from_object: Union[dict, object],
|
2440
|
-
parent_object: dict = None,
|
2454
|
+
parent_object: Optional[dict] = None,
|
2441
2455
|
) -> dict:
|
2442
|
-
to_object = {}
|
2456
|
+
to_object: dict[str, Any] = {}
|
2443
2457
|
if getv(from_object, ['config']) is not None:
|
2444
2458
|
setv(
|
2445
2459
|
to_object,
|
@@ -2453,11 +2467,11 @@ def _ListModelsParameters_to_mldev(
|
|
2453
2467
|
|
2454
2468
|
|
2455
2469
|
def _ListModelsParameters_to_vertex(
|
2456
|
-
api_client:
|
2470
|
+
api_client: BaseApiClient,
|
2457
2471
|
from_object: Union[dict, object],
|
2458
|
-
parent_object: dict = None,
|
2472
|
+
parent_object: Optional[dict] = None,
|
2459
2473
|
) -> dict:
|
2460
|
-
to_object = {}
|
2474
|
+
to_object: dict[str, Any] = {}
|
2461
2475
|
if getv(from_object, ['config']) is not None:
|
2462
2476
|
setv(
|
2463
2477
|
to_object,
|
@@ -2471,11 +2485,11 @@ def _ListModelsParameters_to_vertex(
|
|
2471
2485
|
|
2472
2486
|
|
2473
2487
|
def _UpdateModelConfig_to_mldev(
|
2474
|
-
api_client:
|
2488
|
+
api_client: BaseApiClient,
|
2475
2489
|
from_object: Union[dict, object],
|
2476
|
-
parent_object: dict = None,
|
2490
|
+
parent_object: Optional[dict] = None,
|
2477
2491
|
) -> dict:
|
2478
|
-
to_object = {}
|
2492
|
+
to_object: dict[str, Any] = {}
|
2479
2493
|
|
2480
2494
|
if getv(from_object, ['display_name']) is not None:
|
2481
2495
|
setv(parent_object, ['displayName'], getv(from_object, ['display_name']))
|
@@ -2487,11 +2501,11 @@ def _UpdateModelConfig_to_mldev(
|
|
2487
2501
|
|
2488
2502
|
|
2489
2503
|
def _UpdateModelConfig_to_vertex(
|
2490
|
-
api_client:
|
2504
|
+
api_client: BaseApiClient,
|
2491
2505
|
from_object: Union[dict, object],
|
2492
|
-
parent_object: dict = None,
|
2506
|
+
parent_object: Optional[dict] = None,
|
2493
2507
|
) -> dict:
|
2494
|
-
to_object = {}
|
2508
|
+
to_object: dict[str, Any] = {}
|
2495
2509
|
|
2496
2510
|
if getv(from_object, ['display_name']) is not None:
|
2497
2511
|
setv(parent_object, ['displayName'], getv(from_object, ['display_name']))
|
@@ -2503,11 +2517,11 @@ def _UpdateModelConfig_to_vertex(
|
|
2503
2517
|
|
2504
2518
|
|
2505
2519
|
def _UpdateModelParameters_to_mldev(
|
2506
|
-
api_client:
|
2520
|
+
api_client: BaseApiClient,
|
2507
2521
|
from_object: Union[dict, object],
|
2508
|
-
parent_object: dict = None,
|
2522
|
+
parent_object: Optional[dict] = None,
|
2509
2523
|
) -> dict:
|
2510
|
-
to_object = {}
|
2524
|
+
to_object: dict[str, Any] = {}
|
2511
2525
|
if getv(from_object, ['model']) is not None:
|
2512
2526
|
setv(
|
2513
2527
|
to_object,
|
@@ -2528,11 +2542,11 @@ def _UpdateModelParameters_to_mldev(
|
|
2528
2542
|
|
2529
2543
|
|
2530
2544
|
def _UpdateModelParameters_to_vertex(
|
2531
|
-
api_client:
|
2545
|
+
api_client: BaseApiClient,
|
2532
2546
|
from_object: Union[dict, object],
|
2533
|
-
parent_object: dict = None,
|
2547
|
+
parent_object: Optional[dict] = None,
|
2534
2548
|
) -> dict:
|
2535
|
-
to_object = {}
|
2549
|
+
to_object: dict[str, Any] = {}
|
2536
2550
|
if getv(from_object, ['model']) is not None:
|
2537
2551
|
setv(
|
2538
2552
|
to_object,
|
@@ -2553,11 +2567,11 @@ def _UpdateModelParameters_to_vertex(
|
|
2553
2567
|
|
2554
2568
|
|
2555
2569
|
def _DeleteModelParameters_to_mldev(
|
2556
|
-
api_client:
|
2570
|
+
api_client: BaseApiClient,
|
2557
2571
|
from_object: Union[dict, object],
|
2558
|
-
parent_object: dict = None,
|
2572
|
+
parent_object: Optional[dict] = None,
|
2559
2573
|
) -> dict:
|
2560
|
-
to_object = {}
|
2574
|
+
to_object: dict[str, Any] = {}
|
2561
2575
|
if getv(from_object, ['model']) is not None:
|
2562
2576
|
setv(
|
2563
2577
|
to_object,
|
@@ -2572,11 +2586,11 @@ def _DeleteModelParameters_to_mldev(
|
|
2572
2586
|
|
2573
2587
|
|
2574
2588
|
def _DeleteModelParameters_to_vertex(
|
2575
|
-
api_client:
|
2589
|
+
api_client: BaseApiClient,
|
2576
2590
|
from_object: Union[dict, object],
|
2577
|
-
parent_object: dict = None,
|
2591
|
+
parent_object: Optional[dict] = None,
|
2578
2592
|
) -> dict:
|
2579
|
-
to_object = {}
|
2593
|
+
to_object: dict[str, Any] = {}
|
2580
2594
|
if getv(from_object, ['model']) is not None:
|
2581
2595
|
setv(
|
2582
2596
|
to_object,
|
@@ -2591,32 +2605,19 @@ def _DeleteModelParameters_to_vertex(
|
|
2591
2605
|
|
2592
2606
|
|
2593
2607
|
def _CountTokensConfig_to_mldev(
|
2594
|
-
api_client:
|
2608
|
+
api_client: BaseApiClient,
|
2595
2609
|
from_object: Union[dict, object],
|
2596
|
-
parent_object: dict = None,
|
2610
|
+
parent_object: Optional[dict] = None,
|
2597
2611
|
) -> dict:
|
2598
|
-
to_object = {}
|
2612
|
+
to_object: dict[str, Any] = {}
|
2599
2613
|
|
2600
2614
|
if getv(from_object, ['system_instruction']) is not None:
|
2601
|
-
|
2602
|
-
|
2603
|
-
['generateContentRequest', 'systemInstruction'],
|
2604
|
-
_Content_to_mldev(
|
2605
|
-
api_client,
|
2606
|
-
t.t_content(api_client, getv(from_object, ['system_instruction'])),
|
2607
|
-
to_object,
|
2608
|
-
),
|
2615
|
+
raise ValueError(
|
2616
|
+
'system_instruction parameter is not supported in Gemini API.'
|
2609
2617
|
)
|
2610
2618
|
|
2611
2619
|
if getv(from_object, ['tools']) is not None:
|
2612
|
-
|
2613
|
-
parent_object,
|
2614
|
-
['generateContentRequest', 'tools'],
|
2615
|
-
[
|
2616
|
-
_Tool_to_mldev(api_client, item, to_object)
|
2617
|
-
for item in getv(from_object, ['tools'])
|
2618
|
-
],
|
2619
|
-
)
|
2620
|
+
raise ValueError('tools parameter is not supported in Gemini API.')
|
2620
2621
|
|
2621
2622
|
if getv(from_object, ['generation_config']) is not None:
|
2622
2623
|
raise ValueError(
|
@@ -2627,11 +2628,11 @@ def _CountTokensConfig_to_mldev(
|
|
2627
2628
|
|
2628
2629
|
|
2629
2630
|
def _CountTokensConfig_to_vertex(
|
2630
|
-
api_client:
|
2631
|
+
api_client: BaseApiClient,
|
2631
2632
|
from_object: Union[dict, object],
|
2632
|
-
parent_object: dict = None,
|
2633
|
+
parent_object: Optional[dict] = None,
|
2633
2634
|
) -> dict:
|
2634
|
-
to_object = {}
|
2635
|
+
to_object: dict[str, Any] = {}
|
2635
2636
|
|
2636
2637
|
if getv(from_object, ['system_instruction']) is not None:
|
2637
2638
|
setv(
|
@@ -2665,11 +2666,11 @@ def _CountTokensConfig_to_vertex(
|
|
2665
2666
|
|
2666
2667
|
|
2667
2668
|
def _CountTokensParameters_to_mldev(
|
2668
|
-
api_client:
|
2669
|
+
api_client: BaseApiClient,
|
2669
2670
|
from_object: Union[dict, object],
|
2670
|
-
parent_object: dict = None,
|
2671
|
+
parent_object: Optional[dict] = None,
|
2671
2672
|
) -> dict:
|
2672
|
-
to_object = {}
|
2673
|
+
to_object: dict[str, Any] = {}
|
2673
2674
|
if getv(from_object, ['model']) is not None:
|
2674
2675
|
setv(
|
2675
2676
|
to_object,
|
@@ -2702,11 +2703,11 @@ def _CountTokensParameters_to_mldev(
|
|
2702
2703
|
|
2703
2704
|
|
2704
2705
|
def _CountTokensParameters_to_vertex(
|
2705
|
-
api_client:
|
2706
|
+
api_client: BaseApiClient,
|
2706
2707
|
from_object: Union[dict, object],
|
2707
|
-
parent_object: dict = None,
|
2708
|
+
parent_object: Optional[dict] = None,
|
2708
2709
|
) -> dict:
|
2709
|
-
to_object = {}
|
2710
|
+
to_object: dict[str, Any] = {}
|
2710
2711
|
if getv(from_object, ['model']) is not None:
|
2711
2712
|
setv(
|
2712
2713
|
to_object,
|
@@ -2739,11 +2740,11 @@ def _CountTokensParameters_to_vertex(
|
|
2739
2740
|
|
2740
2741
|
|
2741
2742
|
def _ComputeTokensParameters_to_mldev(
|
2742
|
-
api_client:
|
2743
|
+
api_client: BaseApiClient,
|
2743
2744
|
from_object: Union[dict, object],
|
2744
|
-
parent_object: dict = None,
|
2745
|
+
parent_object: Optional[dict] = None,
|
2745
2746
|
) -> dict:
|
2746
|
-
to_object = {}
|
2747
|
+
to_object: dict[str, Any] = {}
|
2747
2748
|
if getv(from_object, ['model']) is not None:
|
2748
2749
|
setv(
|
2749
2750
|
to_object,
|
@@ -2761,11 +2762,11 @@ def _ComputeTokensParameters_to_mldev(
|
|
2761
2762
|
|
2762
2763
|
|
2763
2764
|
def _ComputeTokensParameters_to_vertex(
|
2764
|
-
api_client:
|
2765
|
+
api_client: BaseApiClient,
|
2765
2766
|
from_object: Union[dict, object],
|
2766
|
-
parent_object: dict = None,
|
2767
|
+
parent_object: Optional[dict] = None,
|
2767
2768
|
) -> dict:
|
2768
|
-
to_object = {}
|
2769
|
+
to_object: dict[str, Any] = {}
|
2769
2770
|
if getv(from_object, ['model']) is not None:
|
2770
2771
|
setv(
|
2771
2772
|
to_object,
|
@@ -2792,11 +2793,11 @@ def _ComputeTokensParameters_to_vertex(
|
|
2792
2793
|
|
2793
2794
|
|
2794
2795
|
def _GenerateVideosConfig_to_mldev(
|
2795
|
-
api_client:
|
2796
|
+
api_client: BaseApiClient,
|
2796
2797
|
from_object: Union[dict, object],
|
2797
|
-
parent_object: dict = None,
|
2798
|
+
parent_object: Optional[dict] = None,
|
2798
2799
|
) -> dict:
|
2799
|
-
to_object = {}
|
2800
|
+
to_object: dict[str, Any] = {}
|
2800
2801
|
|
2801
2802
|
if getv(from_object, ['number_of_videos']) is not None:
|
2802
2803
|
setv(
|
@@ -2812,8 +2813,10 @@ def _GenerateVideosConfig_to_mldev(
|
|
2812
2813
|
raise ValueError('fps parameter is not supported in Gemini API.')
|
2813
2814
|
|
2814
2815
|
if getv(from_object, ['duration_seconds']) is not None:
|
2815
|
-
|
2816
|
-
|
2816
|
+
setv(
|
2817
|
+
parent_object,
|
2818
|
+
['parameters', 'durationSeconds'],
|
2819
|
+
getv(from_object, ['duration_seconds']),
|
2817
2820
|
)
|
2818
2821
|
|
2819
2822
|
if getv(from_object, ['seed']) is not None:
|
@@ -2853,11 +2856,11 @@ def _GenerateVideosConfig_to_mldev(
|
|
2853
2856
|
|
2854
2857
|
|
2855
2858
|
def _GenerateVideosConfig_to_vertex(
|
2856
|
-
api_client:
|
2859
|
+
api_client: BaseApiClient,
|
2857
2860
|
from_object: Union[dict, object],
|
2858
|
-
parent_object: dict = None,
|
2861
|
+
parent_object: Optional[dict] = None,
|
2859
2862
|
) -> dict:
|
2860
|
-
to_object = {}
|
2863
|
+
to_object: dict[str, Any] = {}
|
2861
2864
|
|
2862
2865
|
if getv(from_object, ['number_of_videos']) is not None:
|
2863
2866
|
setv(
|
@@ -2932,11 +2935,11 @@ def _GenerateVideosConfig_to_vertex(
|
|
2932
2935
|
|
2933
2936
|
|
2934
2937
|
def _GenerateVideosParameters_to_mldev(
|
2935
|
-
api_client:
|
2938
|
+
api_client: BaseApiClient,
|
2936
2939
|
from_object: Union[dict, object],
|
2937
|
-
parent_object: dict = None,
|
2940
|
+
parent_object: Optional[dict] = None,
|
2938
2941
|
) -> dict:
|
2939
|
-
to_object = {}
|
2942
|
+
to_object: dict[str, Any] = {}
|
2940
2943
|
if getv(from_object, ['model']) is not None:
|
2941
2944
|
setv(
|
2942
2945
|
to_object,
|
@@ -2947,6 +2950,13 @@ def _GenerateVideosParameters_to_mldev(
|
|
2947
2950
|
if getv(from_object, ['prompt']) is not None:
|
2948
2951
|
setv(to_object, ['instances[0]', 'prompt'], getv(from_object, ['prompt']))
|
2949
2952
|
|
2953
|
+
if getv(from_object, ['image']) is not None:
|
2954
|
+
setv(
|
2955
|
+
to_object,
|
2956
|
+
['instances[0]', 'image'],
|
2957
|
+
_Image_to_mldev(api_client, getv(from_object, ['image']), to_object),
|
2958
|
+
)
|
2959
|
+
|
2950
2960
|
if getv(from_object, ['config']) is not None:
|
2951
2961
|
setv(
|
2952
2962
|
to_object,
|
@@ -2960,11 +2970,11 @@ def _GenerateVideosParameters_to_mldev(
|
|
2960
2970
|
|
2961
2971
|
|
2962
2972
|
def _GenerateVideosParameters_to_vertex(
|
2963
|
-
api_client:
|
2973
|
+
api_client: BaseApiClient,
|
2964
2974
|
from_object: Union[dict, object],
|
2965
|
-
parent_object: dict = None,
|
2975
|
+
parent_object: Optional[dict] = None,
|
2966
2976
|
) -> dict:
|
2967
|
-
to_object = {}
|
2977
|
+
to_object: dict[str, Any] = {}
|
2968
2978
|
if getv(from_object, ['model']) is not None:
|
2969
2979
|
setv(
|
2970
2980
|
to_object,
|
@@ -2975,6 +2985,13 @@ def _GenerateVideosParameters_to_vertex(
|
|
2975
2985
|
if getv(from_object, ['prompt']) is not None:
|
2976
2986
|
setv(to_object, ['instances[0]', 'prompt'], getv(from_object, ['prompt']))
|
2977
2987
|
|
2988
|
+
if getv(from_object, ['image']) is not None:
|
2989
|
+
setv(
|
2990
|
+
to_object,
|
2991
|
+
['instances[0]', 'image'],
|
2992
|
+
_Image_to_vertex(api_client, getv(from_object, ['image']), to_object),
|
2993
|
+
)
|
2994
|
+
|
2978
2995
|
if getv(from_object, ['config']) is not None:
|
2979
2996
|
setv(
|
2980
2997
|
to_object,
|
@@ -3043,11 +3060,11 @@ def _EditMode_to_mldev_enum_validate(enum_value: Any):
|
|
3043
3060
|
|
3044
3061
|
|
3045
3062
|
def _Part_from_mldev(
|
3046
|
-
api_client:
|
3063
|
+
api_client: BaseApiClient,
|
3047
3064
|
from_object: Union[dict, object],
|
3048
|
-
parent_object: dict = None,
|
3065
|
+
parent_object: Optional[dict] = None,
|
3049
3066
|
) -> dict:
|
3050
|
-
to_object = {}
|
3067
|
+
to_object: dict[str, Any] = {}
|
3051
3068
|
|
3052
3069
|
if getv(from_object, ['thought']) is not None:
|
3053
3070
|
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
@@ -3085,11 +3102,11 @@ def _Part_from_mldev(
|
|
3085
3102
|
|
3086
3103
|
|
3087
3104
|
def _Part_from_vertex(
|
3088
|
-
api_client:
|
3105
|
+
api_client: BaseApiClient,
|
3089
3106
|
from_object: Union[dict, object],
|
3090
|
-
parent_object: dict = None,
|
3107
|
+
parent_object: Optional[dict] = None,
|
3091
3108
|
) -> dict:
|
3092
|
-
to_object = {}
|
3109
|
+
to_object: dict[str, Any] = {}
|
3093
3110
|
if getv(from_object, ['videoMetadata']) is not None:
|
3094
3111
|
setv(to_object, ['video_metadata'], getv(from_object, ['videoMetadata']))
|
3095
3112
|
|
@@ -3129,11 +3146,11 @@ def _Part_from_vertex(
|
|
3129
3146
|
|
3130
3147
|
|
3131
3148
|
def _Content_from_mldev(
|
3132
|
-
api_client:
|
3149
|
+
api_client: BaseApiClient,
|
3133
3150
|
from_object: Union[dict, object],
|
3134
|
-
parent_object: dict = None,
|
3151
|
+
parent_object: Optional[dict] = None,
|
3135
3152
|
) -> dict:
|
3136
|
-
to_object = {}
|
3153
|
+
to_object: dict[str, Any] = {}
|
3137
3154
|
if getv(from_object, ['parts']) is not None:
|
3138
3155
|
setv(
|
3139
3156
|
to_object,
|
@@ -3151,11 +3168,11 @@ def _Content_from_mldev(
|
|
3151
3168
|
|
3152
3169
|
|
3153
3170
|
def _Content_from_vertex(
|
3154
|
-
api_client:
|
3171
|
+
api_client: BaseApiClient,
|
3155
3172
|
from_object: Union[dict, object],
|
3156
|
-
parent_object: dict = None,
|
3173
|
+
parent_object: Optional[dict] = None,
|
3157
3174
|
) -> dict:
|
3158
|
-
to_object = {}
|
3175
|
+
to_object: dict[str, Any] = {}
|
3159
3176
|
if getv(from_object, ['parts']) is not None:
|
3160
3177
|
setv(
|
3161
3178
|
to_object,
|
@@ -3173,11 +3190,11 @@ def _Content_from_vertex(
|
|
3173
3190
|
|
3174
3191
|
|
3175
3192
|
def _CitationMetadata_from_mldev(
|
3176
|
-
api_client:
|
3193
|
+
api_client: BaseApiClient,
|
3177
3194
|
from_object: Union[dict, object],
|
3178
|
-
parent_object: dict = None,
|
3195
|
+
parent_object: Optional[dict] = None,
|
3179
3196
|
) -> dict:
|
3180
|
-
to_object = {}
|
3197
|
+
to_object: dict[str, Any] = {}
|
3181
3198
|
if getv(from_object, ['citationSources']) is not None:
|
3182
3199
|
setv(to_object, ['citations'], getv(from_object, ['citationSources']))
|
3183
3200
|
|
@@ -3185,11 +3202,11 @@ def _CitationMetadata_from_mldev(
|
|
3185
3202
|
|
3186
3203
|
|
3187
3204
|
def _CitationMetadata_from_vertex(
|
3188
|
-
api_client:
|
3205
|
+
api_client: BaseApiClient,
|
3189
3206
|
from_object: Union[dict, object],
|
3190
|
-
parent_object: dict = None,
|
3207
|
+
parent_object: Optional[dict] = None,
|
3191
3208
|
) -> dict:
|
3192
|
-
to_object = {}
|
3209
|
+
to_object: dict[str, Any] = {}
|
3193
3210
|
if getv(from_object, ['citations']) is not None:
|
3194
3211
|
setv(to_object, ['citations'], getv(from_object, ['citations']))
|
3195
3212
|
|
@@ -3197,11 +3214,11 @@ def _CitationMetadata_from_vertex(
|
|
3197
3214
|
|
3198
3215
|
|
3199
3216
|
def _Candidate_from_mldev(
|
3200
|
-
api_client:
|
3217
|
+
api_client: BaseApiClient,
|
3201
3218
|
from_object: Union[dict, object],
|
3202
|
-
parent_object: dict = None,
|
3219
|
+
parent_object: Optional[dict] = None,
|
3203
3220
|
) -> dict:
|
3204
|
-
to_object = {}
|
3221
|
+
to_object: dict[str, Any] = {}
|
3205
3222
|
if getv(from_object, ['content']) is not None:
|
3206
3223
|
setv(
|
3207
3224
|
to_object,
|
@@ -3249,11 +3266,11 @@ def _Candidate_from_mldev(
|
|
3249
3266
|
|
3250
3267
|
|
3251
3268
|
def _Candidate_from_vertex(
|
3252
|
-
api_client:
|
3269
|
+
api_client: BaseApiClient,
|
3253
3270
|
from_object: Union[dict, object],
|
3254
|
-
parent_object: dict = None,
|
3271
|
+
parent_object: Optional[dict] = None,
|
3255
3272
|
) -> dict:
|
3256
|
-
to_object = {}
|
3273
|
+
to_object: dict[str, Any] = {}
|
3257
3274
|
if getv(from_object, ['content']) is not None:
|
3258
3275
|
setv(
|
3259
3276
|
to_object,
|
@@ -3301,11 +3318,11 @@ def _Candidate_from_vertex(
|
|
3301
3318
|
|
3302
3319
|
|
3303
3320
|
def _GenerateContentResponse_from_mldev(
|
3304
|
-
api_client:
|
3321
|
+
api_client: BaseApiClient,
|
3305
3322
|
from_object: Union[dict, object],
|
3306
|
-
parent_object: dict = None,
|
3323
|
+
parent_object: Optional[dict] = None,
|
3307
3324
|
) -> dict:
|
3308
|
-
to_object = {}
|
3325
|
+
to_object: dict[str, Any] = {}
|
3309
3326
|
if getv(from_object, ['candidates']) is not None:
|
3310
3327
|
setv(
|
3311
3328
|
to_object,
|
@@ -3329,11 +3346,11 @@ def _GenerateContentResponse_from_mldev(
|
|
3329
3346
|
|
3330
3347
|
|
3331
3348
|
def _GenerateContentResponse_from_vertex(
|
3332
|
-
api_client:
|
3349
|
+
api_client: BaseApiClient,
|
3333
3350
|
from_object: Union[dict, object],
|
3334
|
-
parent_object: dict = None,
|
3351
|
+
parent_object: Optional[dict] = None,
|
3335
3352
|
) -> dict:
|
3336
|
-
to_object = {}
|
3353
|
+
to_object: dict[str, Any] = {}
|
3337
3354
|
if getv(from_object, ['candidates']) is not None:
|
3338
3355
|
setv(
|
3339
3356
|
to_object,
|
@@ -3344,6 +3361,12 @@ def _GenerateContentResponse_from_vertex(
|
|
3344
3361
|
],
|
3345
3362
|
)
|
3346
3363
|
|
3364
|
+
if getv(from_object, ['createTime']) is not None:
|
3365
|
+
setv(to_object, ['create_time'], getv(from_object, ['createTime']))
|
3366
|
+
|
3367
|
+
if getv(from_object, ['responseId']) is not None:
|
3368
|
+
setv(to_object, ['response_id'], getv(from_object, ['responseId']))
|
3369
|
+
|
3347
3370
|
if getv(from_object, ['modelVersion']) is not None:
|
3348
3371
|
setv(to_object, ['model_version'], getv(from_object, ['modelVersion']))
|
3349
3372
|
|
@@ -3357,21 +3380,21 @@ def _GenerateContentResponse_from_vertex(
|
|
3357
3380
|
|
3358
3381
|
|
3359
3382
|
def _ContentEmbeddingStatistics_from_mldev(
|
3360
|
-
api_client:
|
3383
|
+
api_client: BaseApiClient,
|
3361
3384
|
from_object: Union[dict, object],
|
3362
|
-
parent_object: dict = None,
|
3385
|
+
parent_object: Optional[dict] = None,
|
3363
3386
|
) -> dict:
|
3364
|
-
to_object = {}
|
3387
|
+
to_object: dict[str, Any] = {}
|
3365
3388
|
|
3366
3389
|
return to_object
|
3367
3390
|
|
3368
3391
|
|
3369
3392
|
def _ContentEmbeddingStatistics_from_vertex(
|
3370
|
-
api_client:
|
3393
|
+
api_client: BaseApiClient,
|
3371
3394
|
from_object: Union[dict, object],
|
3372
|
-
parent_object: dict = None,
|
3395
|
+
parent_object: Optional[dict] = None,
|
3373
3396
|
) -> dict:
|
3374
|
-
to_object = {}
|
3397
|
+
to_object: dict[str, Any] = {}
|
3375
3398
|
if getv(from_object, ['truncated']) is not None:
|
3376
3399
|
setv(to_object, ['truncated'], getv(from_object, ['truncated']))
|
3377
3400
|
|
@@ -3382,11 +3405,11 @@ def _ContentEmbeddingStatistics_from_vertex(
|
|
3382
3405
|
|
3383
3406
|
|
3384
3407
|
def _ContentEmbedding_from_mldev(
|
3385
|
-
api_client:
|
3408
|
+
api_client: BaseApiClient,
|
3386
3409
|
from_object: Union[dict, object],
|
3387
|
-
parent_object: dict = None,
|
3410
|
+
parent_object: Optional[dict] = None,
|
3388
3411
|
) -> dict:
|
3389
|
-
to_object = {}
|
3412
|
+
to_object: dict[str, Any] = {}
|
3390
3413
|
if getv(from_object, ['values']) is not None:
|
3391
3414
|
setv(to_object, ['values'], getv(from_object, ['values']))
|
3392
3415
|
|
@@ -3394,11 +3417,11 @@ def _ContentEmbedding_from_mldev(
|
|
3394
3417
|
|
3395
3418
|
|
3396
3419
|
def _ContentEmbedding_from_vertex(
|
3397
|
-
api_client:
|
3420
|
+
api_client: BaseApiClient,
|
3398
3421
|
from_object: Union[dict, object],
|
3399
|
-
parent_object: dict = None,
|
3422
|
+
parent_object: Optional[dict] = None,
|
3400
3423
|
) -> dict:
|
3401
|
-
to_object = {}
|
3424
|
+
to_object: dict[str, Any] = {}
|
3402
3425
|
if getv(from_object, ['values']) is not None:
|
3403
3426
|
setv(to_object, ['values'], getv(from_object, ['values']))
|
3404
3427
|
|
@@ -3415,21 +3438,21 @@ def _ContentEmbedding_from_vertex(
|
|
3415
3438
|
|
3416
3439
|
|
3417
3440
|
def _EmbedContentMetadata_from_mldev(
|
3418
|
-
api_client:
|
3441
|
+
api_client: BaseApiClient,
|
3419
3442
|
from_object: Union[dict, object],
|
3420
|
-
parent_object: dict = None,
|
3443
|
+
parent_object: Optional[dict] = None,
|
3421
3444
|
) -> dict:
|
3422
|
-
to_object = {}
|
3445
|
+
to_object: dict[str, Any] = {}
|
3423
3446
|
|
3424
3447
|
return to_object
|
3425
3448
|
|
3426
3449
|
|
3427
3450
|
def _EmbedContentMetadata_from_vertex(
|
3428
|
-
api_client:
|
3451
|
+
api_client: BaseApiClient,
|
3429
3452
|
from_object: Union[dict, object],
|
3430
|
-
parent_object: dict = None,
|
3453
|
+
parent_object: Optional[dict] = None,
|
3431
3454
|
) -> dict:
|
3432
|
-
to_object = {}
|
3455
|
+
to_object: dict[str, Any] = {}
|
3433
3456
|
if getv(from_object, ['billableCharacterCount']) is not None:
|
3434
3457
|
setv(
|
3435
3458
|
to_object,
|
@@ -3441,11 +3464,11 @@ def _EmbedContentMetadata_from_vertex(
|
|
3441
3464
|
|
3442
3465
|
|
3443
3466
|
def _EmbedContentResponse_from_mldev(
|
3444
|
-
api_client:
|
3467
|
+
api_client: BaseApiClient,
|
3445
3468
|
from_object: Union[dict, object],
|
3446
|
-
parent_object: dict = None,
|
3469
|
+
parent_object: Optional[dict] = None,
|
3447
3470
|
) -> dict:
|
3448
|
-
to_object = {}
|
3471
|
+
to_object: dict[str, Any] = {}
|
3449
3472
|
if getv(from_object, ['embeddings']) is not None:
|
3450
3473
|
setv(
|
3451
3474
|
to_object,
|
@@ -3469,11 +3492,11 @@ def _EmbedContentResponse_from_mldev(
|
|
3469
3492
|
|
3470
3493
|
|
3471
3494
|
def _EmbedContentResponse_from_vertex(
|
3472
|
-
api_client:
|
3495
|
+
api_client: BaseApiClient,
|
3473
3496
|
from_object: Union[dict, object],
|
3474
|
-
parent_object: dict = None,
|
3497
|
+
parent_object: Optional[dict] = None,
|
3475
3498
|
) -> dict:
|
3476
|
-
to_object = {}
|
3499
|
+
to_object: dict[str, Any] = {}
|
3477
3500
|
if getv(from_object, ['predictions[]', 'embeddings']) is not None:
|
3478
3501
|
setv(
|
3479
3502
|
to_object,
|
@@ -3497,11 +3520,11 @@ def _EmbedContentResponse_from_vertex(
|
|
3497
3520
|
|
3498
3521
|
|
3499
3522
|
def _Image_from_mldev(
|
3500
|
-
api_client:
|
3523
|
+
api_client: BaseApiClient,
|
3501
3524
|
from_object: Union[dict, object],
|
3502
|
-
parent_object: dict = None,
|
3525
|
+
parent_object: Optional[dict] = None,
|
3503
3526
|
) -> dict:
|
3504
|
-
to_object = {}
|
3527
|
+
to_object: dict[str, Any] = {}
|
3505
3528
|
|
3506
3529
|
if getv(from_object, ['bytesBase64Encoded']) is not None:
|
3507
3530
|
setv(
|
@@ -3517,11 +3540,11 @@ def _Image_from_mldev(
|
|
3517
3540
|
|
3518
3541
|
|
3519
3542
|
def _Image_from_vertex(
|
3520
|
-
api_client:
|
3543
|
+
api_client: BaseApiClient,
|
3521
3544
|
from_object: Union[dict, object],
|
3522
|
-
parent_object: dict = None,
|
3545
|
+
parent_object: Optional[dict] = None,
|
3523
3546
|
) -> dict:
|
3524
|
-
to_object = {}
|
3547
|
+
to_object: dict[str, Any] = {}
|
3525
3548
|
if getv(from_object, ['gcsUri']) is not None:
|
3526
3549
|
setv(to_object, ['gcs_uri'], getv(from_object, ['gcsUri']))
|
3527
3550
|
|
@@ -3539,11 +3562,11 @@ def _Image_from_vertex(
|
|
3539
3562
|
|
3540
3563
|
|
3541
3564
|
def _GeneratedImage_from_mldev(
|
3542
|
-
api_client:
|
3565
|
+
api_client: BaseApiClient,
|
3543
3566
|
from_object: Union[dict, object],
|
3544
|
-
parent_object: dict = None,
|
3567
|
+
parent_object: Optional[dict] = None,
|
3545
3568
|
) -> dict:
|
3546
|
-
to_object = {}
|
3569
|
+
to_object: dict[str, Any] = {}
|
3547
3570
|
if getv(from_object, ['_self']) is not None:
|
3548
3571
|
setv(
|
3549
3572
|
to_object,
|
@@ -3562,11 +3585,11 @@ def _GeneratedImage_from_mldev(
|
|
3562
3585
|
|
3563
3586
|
|
3564
3587
|
def _GeneratedImage_from_vertex(
|
3565
|
-
api_client:
|
3588
|
+
api_client: BaseApiClient,
|
3566
3589
|
from_object: Union[dict, object],
|
3567
|
-
parent_object: dict = None,
|
3590
|
+
parent_object: Optional[dict] = None,
|
3568
3591
|
) -> dict:
|
3569
|
-
to_object = {}
|
3592
|
+
to_object: dict[str, Any] = {}
|
3570
3593
|
if getv(from_object, ['_self']) is not None:
|
3571
3594
|
setv(
|
3572
3595
|
to_object,
|
@@ -3588,11 +3611,11 @@ def _GeneratedImage_from_vertex(
|
|
3588
3611
|
|
3589
3612
|
|
3590
3613
|
def _GenerateImagesResponse_from_mldev(
|
3591
|
-
api_client:
|
3614
|
+
api_client: BaseApiClient,
|
3592
3615
|
from_object: Union[dict, object],
|
3593
|
-
parent_object: dict = None,
|
3616
|
+
parent_object: Optional[dict] = None,
|
3594
3617
|
) -> dict:
|
3595
|
-
to_object = {}
|
3618
|
+
to_object: dict[str, Any] = {}
|
3596
3619
|
if getv(from_object, ['predictions']) is not None:
|
3597
3620
|
setv(
|
3598
3621
|
to_object,
|
@@ -3607,11 +3630,11 @@ def _GenerateImagesResponse_from_mldev(
|
|
3607
3630
|
|
3608
3631
|
|
3609
3632
|
def _GenerateImagesResponse_from_vertex(
|
3610
|
-
api_client:
|
3633
|
+
api_client: BaseApiClient,
|
3611
3634
|
from_object: Union[dict, object],
|
3612
|
-
parent_object: dict = None,
|
3635
|
+
parent_object: Optional[dict] = None,
|
3613
3636
|
) -> dict:
|
3614
|
-
to_object = {}
|
3637
|
+
to_object: dict[str, Any] = {}
|
3615
3638
|
if getv(from_object, ['predictions']) is not None:
|
3616
3639
|
setv(
|
3617
3640
|
to_object,
|
@@ -3626,11 +3649,11 @@ def _GenerateImagesResponse_from_vertex(
|
|
3626
3649
|
|
3627
3650
|
|
3628
3651
|
def _EditImageResponse_from_mldev(
|
3629
|
-
api_client:
|
3652
|
+
api_client: BaseApiClient,
|
3630
3653
|
from_object: Union[dict, object],
|
3631
|
-
parent_object: dict = None,
|
3654
|
+
parent_object: Optional[dict] = None,
|
3632
3655
|
) -> dict:
|
3633
|
-
to_object = {}
|
3656
|
+
to_object: dict[str, Any] = {}
|
3634
3657
|
if getv(from_object, ['predictions']) is not None:
|
3635
3658
|
setv(
|
3636
3659
|
to_object,
|
@@ -3645,11 +3668,11 @@ def _EditImageResponse_from_mldev(
|
|
3645
3668
|
|
3646
3669
|
|
3647
3670
|
def _EditImageResponse_from_vertex(
|
3648
|
-
api_client:
|
3671
|
+
api_client: BaseApiClient,
|
3649
3672
|
from_object: Union[dict, object],
|
3650
|
-
parent_object: dict = None,
|
3673
|
+
parent_object: Optional[dict] = None,
|
3651
3674
|
) -> dict:
|
3652
|
-
to_object = {}
|
3675
|
+
to_object: dict[str, Any] = {}
|
3653
3676
|
if getv(from_object, ['predictions']) is not None:
|
3654
3677
|
setv(
|
3655
3678
|
to_object,
|
@@ -3664,11 +3687,11 @@ def _EditImageResponse_from_vertex(
|
|
3664
3687
|
|
3665
3688
|
|
3666
3689
|
def _UpscaleImageResponse_from_mldev(
|
3667
|
-
api_client:
|
3690
|
+
api_client: BaseApiClient,
|
3668
3691
|
from_object: Union[dict, object],
|
3669
|
-
parent_object: dict = None,
|
3692
|
+
parent_object: Optional[dict] = None,
|
3670
3693
|
) -> dict:
|
3671
|
-
to_object = {}
|
3694
|
+
to_object: dict[str, Any] = {}
|
3672
3695
|
if getv(from_object, ['predictions']) is not None:
|
3673
3696
|
setv(
|
3674
3697
|
to_object,
|
@@ -3683,11 +3706,11 @@ def _UpscaleImageResponse_from_mldev(
|
|
3683
3706
|
|
3684
3707
|
|
3685
3708
|
def _UpscaleImageResponse_from_vertex(
|
3686
|
-
api_client:
|
3709
|
+
api_client: BaseApiClient,
|
3687
3710
|
from_object: Union[dict, object],
|
3688
|
-
parent_object: dict = None,
|
3711
|
+
parent_object: Optional[dict] = None,
|
3689
3712
|
) -> dict:
|
3690
|
-
to_object = {}
|
3713
|
+
to_object: dict[str, Any] = {}
|
3691
3714
|
if getv(from_object, ['predictions']) is not None:
|
3692
3715
|
setv(
|
3693
3716
|
to_object,
|
@@ -3702,21 +3725,21 @@ def _UpscaleImageResponse_from_vertex(
|
|
3702
3725
|
|
3703
3726
|
|
3704
3727
|
def _Endpoint_from_mldev(
|
3705
|
-
api_client:
|
3728
|
+
api_client: BaseApiClient,
|
3706
3729
|
from_object: Union[dict, object],
|
3707
|
-
parent_object: dict = None,
|
3730
|
+
parent_object: Optional[dict] = None,
|
3708
3731
|
) -> dict:
|
3709
|
-
to_object = {}
|
3732
|
+
to_object: dict[str, Any] = {}
|
3710
3733
|
|
3711
3734
|
return to_object
|
3712
3735
|
|
3713
3736
|
|
3714
3737
|
def _Endpoint_from_vertex(
|
3715
|
-
api_client:
|
3738
|
+
api_client: BaseApiClient,
|
3716
3739
|
from_object: Union[dict, object],
|
3717
|
-
parent_object: dict = None,
|
3740
|
+
parent_object: Optional[dict] = None,
|
3718
3741
|
) -> dict:
|
3719
|
-
to_object = {}
|
3742
|
+
to_object: dict[str, Any] = {}
|
3720
3743
|
if getv(from_object, ['endpoint']) is not None:
|
3721
3744
|
setv(to_object, ['name'], getv(from_object, ['endpoint']))
|
3722
3745
|
|
@@ -3729,11 +3752,11 @@ def _Endpoint_from_vertex(
|
|
3729
3752
|
|
3730
3753
|
|
3731
3754
|
def _TunedModelInfo_from_mldev(
|
3732
|
-
api_client:
|
3755
|
+
api_client: BaseApiClient,
|
3733
3756
|
from_object: Union[dict, object],
|
3734
|
-
parent_object: dict = None,
|
3757
|
+
parent_object: Optional[dict] = None,
|
3735
3758
|
) -> dict:
|
3736
|
-
to_object = {}
|
3759
|
+
to_object: dict[str, Any] = {}
|
3737
3760
|
if getv(from_object, ['baseModel']) is not None:
|
3738
3761
|
setv(to_object, ['base_model'], getv(from_object, ['baseModel']))
|
3739
3762
|
|
@@ -3747,11 +3770,11 @@ def _TunedModelInfo_from_mldev(
|
|
3747
3770
|
|
3748
3771
|
|
3749
3772
|
def _TunedModelInfo_from_vertex(
|
3750
|
-
api_client:
|
3773
|
+
api_client: BaseApiClient,
|
3751
3774
|
from_object: Union[dict, object],
|
3752
|
-
parent_object: dict = None,
|
3775
|
+
parent_object: Optional[dict] = None,
|
3753
3776
|
) -> dict:
|
3754
|
-
to_object = {}
|
3777
|
+
to_object: dict[str, Any] = {}
|
3755
3778
|
if (
|
3756
3779
|
getv(from_object, ['labels', 'google-vertex-llm-tuning-base-model-id'])
|
3757
3780
|
is not None
|
@@ -3772,11 +3795,11 @@ def _TunedModelInfo_from_vertex(
|
|
3772
3795
|
|
3773
3796
|
|
3774
3797
|
def _Model_from_mldev(
|
3775
|
-
api_client:
|
3798
|
+
api_client: BaseApiClient,
|
3776
3799
|
from_object: Union[dict, object],
|
3777
|
-
parent_object: dict = None,
|
3800
|
+
parent_object: Optional[dict] = None,
|
3778
3801
|
) -> dict:
|
3779
|
-
to_object = {}
|
3802
|
+
to_object: dict[str, Any] = {}
|
3780
3803
|
if getv(from_object, ['name']) is not None:
|
3781
3804
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
3782
3805
|
|
@@ -3821,11 +3844,11 @@ def _Model_from_mldev(
|
|
3821
3844
|
|
3822
3845
|
|
3823
3846
|
def _Model_from_vertex(
|
3824
|
-
api_client:
|
3847
|
+
api_client: BaseApiClient,
|
3825
3848
|
from_object: Union[dict, object],
|
3826
|
-
parent_object: dict = None,
|
3849
|
+
parent_object: Optional[dict] = None,
|
3827
3850
|
) -> dict:
|
3828
|
-
to_object = {}
|
3851
|
+
to_object: dict[str, Any] = {}
|
3829
3852
|
if getv(from_object, ['name']) is not None:
|
3830
3853
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
3831
3854
|
|
@@ -3864,11 +3887,11 @@ def _Model_from_vertex(
|
|
3864
3887
|
|
3865
3888
|
|
3866
3889
|
def _ListModelsResponse_from_mldev(
|
3867
|
-
api_client:
|
3890
|
+
api_client: BaseApiClient,
|
3868
3891
|
from_object: Union[dict, object],
|
3869
|
-
parent_object: dict = None,
|
3892
|
+
parent_object: Optional[dict] = None,
|
3870
3893
|
) -> dict:
|
3871
|
-
to_object = {}
|
3894
|
+
to_object: dict[str, Any] = {}
|
3872
3895
|
if getv(from_object, ['nextPageToken']) is not None:
|
3873
3896
|
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
3874
3897
|
|
@@ -3888,11 +3911,11 @@ def _ListModelsResponse_from_mldev(
|
|
3888
3911
|
|
3889
3912
|
|
3890
3913
|
def _ListModelsResponse_from_vertex(
|
3891
|
-
api_client:
|
3914
|
+
api_client: BaseApiClient,
|
3892
3915
|
from_object: Union[dict, object],
|
3893
|
-
parent_object: dict = None,
|
3916
|
+
parent_object: Optional[dict] = None,
|
3894
3917
|
) -> dict:
|
3895
|
-
to_object = {}
|
3918
|
+
to_object: dict[str, Any] = {}
|
3896
3919
|
if getv(from_object, ['nextPageToken']) is not None:
|
3897
3920
|
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
3898
3921
|
|
@@ -3912,31 +3935,31 @@ def _ListModelsResponse_from_vertex(
|
|
3912
3935
|
|
3913
3936
|
|
3914
3937
|
def _DeleteModelResponse_from_mldev(
|
3915
|
-
api_client:
|
3938
|
+
api_client: BaseApiClient,
|
3916
3939
|
from_object: Union[dict, object],
|
3917
|
-
parent_object: dict = None,
|
3940
|
+
parent_object: Optional[dict] = None,
|
3918
3941
|
) -> dict:
|
3919
|
-
to_object = {}
|
3942
|
+
to_object: dict[str, Any] = {}
|
3920
3943
|
|
3921
3944
|
return to_object
|
3922
3945
|
|
3923
3946
|
|
3924
3947
|
def _DeleteModelResponse_from_vertex(
|
3925
|
-
api_client:
|
3948
|
+
api_client: BaseApiClient,
|
3926
3949
|
from_object: Union[dict, object],
|
3927
|
-
parent_object: dict = None,
|
3950
|
+
parent_object: Optional[dict] = None,
|
3928
3951
|
) -> dict:
|
3929
|
-
to_object = {}
|
3952
|
+
to_object: dict[str, Any] = {}
|
3930
3953
|
|
3931
3954
|
return to_object
|
3932
3955
|
|
3933
3956
|
|
3934
3957
|
def _CountTokensResponse_from_mldev(
|
3935
|
-
api_client:
|
3958
|
+
api_client: BaseApiClient,
|
3936
3959
|
from_object: Union[dict, object],
|
3937
|
-
parent_object: dict = None,
|
3960
|
+
parent_object: Optional[dict] = None,
|
3938
3961
|
) -> dict:
|
3939
|
-
to_object = {}
|
3962
|
+
to_object: dict[str, Any] = {}
|
3940
3963
|
if getv(from_object, ['totalTokens']) is not None:
|
3941
3964
|
setv(to_object, ['total_tokens'], getv(from_object, ['totalTokens']))
|
3942
3965
|
|
@@ -3951,11 +3974,11 @@ def _CountTokensResponse_from_mldev(
|
|
3951
3974
|
|
3952
3975
|
|
3953
3976
|
def _CountTokensResponse_from_vertex(
|
3954
|
-
api_client:
|
3977
|
+
api_client: BaseApiClient,
|
3955
3978
|
from_object: Union[dict, object],
|
3956
|
-
parent_object: dict = None,
|
3979
|
+
parent_object: Optional[dict] = None,
|
3957
3980
|
) -> dict:
|
3958
|
-
to_object = {}
|
3981
|
+
to_object: dict[str, Any] = {}
|
3959
3982
|
if getv(from_object, ['totalTokens']) is not None:
|
3960
3983
|
setv(to_object, ['total_tokens'], getv(from_object, ['totalTokens']))
|
3961
3984
|
|
@@ -3963,11 +3986,11 @@ def _CountTokensResponse_from_vertex(
|
|
3963
3986
|
|
3964
3987
|
|
3965
3988
|
def _ComputeTokensResponse_from_mldev(
|
3966
|
-
api_client:
|
3989
|
+
api_client: BaseApiClient,
|
3967
3990
|
from_object: Union[dict, object],
|
3968
|
-
parent_object: dict = None,
|
3991
|
+
parent_object: Optional[dict] = None,
|
3969
3992
|
) -> dict:
|
3970
|
-
to_object = {}
|
3993
|
+
to_object: dict[str, Any] = {}
|
3971
3994
|
if getv(from_object, ['tokensInfo']) is not None:
|
3972
3995
|
setv(to_object, ['tokens_info'], getv(from_object, ['tokensInfo']))
|
3973
3996
|
|
@@ -3975,11 +3998,11 @@ def _ComputeTokensResponse_from_mldev(
|
|
3975
3998
|
|
3976
3999
|
|
3977
4000
|
def _ComputeTokensResponse_from_vertex(
|
3978
|
-
api_client:
|
4001
|
+
api_client: BaseApiClient,
|
3979
4002
|
from_object: Union[dict, object],
|
3980
|
-
parent_object: dict = None,
|
4003
|
+
parent_object: Optional[dict] = None,
|
3981
4004
|
) -> dict:
|
3982
|
-
to_object = {}
|
4005
|
+
to_object: dict[str, Any] = {}
|
3983
4006
|
if getv(from_object, ['tokensInfo']) is not None:
|
3984
4007
|
setv(to_object, ['tokens_info'], getv(from_object, ['tokensInfo']))
|
3985
4008
|
|
@@ -3987,19 +4010,19 @@ def _ComputeTokensResponse_from_vertex(
|
|
3987
4010
|
|
3988
4011
|
|
3989
4012
|
def _Video_from_mldev(
|
3990
|
-
api_client:
|
4013
|
+
api_client: BaseApiClient,
|
3991
4014
|
from_object: Union[dict, object],
|
3992
|
-
parent_object: dict = None,
|
4015
|
+
parent_object: Optional[dict] = None,
|
3993
4016
|
) -> dict:
|
3994
|
-
to_object = {}
|
3995
|
-
if getv(from_object, ['uri']) is not None:
|
3996
|
-
setv(to_object, ['uri'], getv(from_object, ['uri']))
|
4017
|
+
to_object: dict[str, Any] = {}
|
4018
|
+
if getv(from_object, ['video', 'uri']) is not None:
|
4019
|
+
setv(to_object, ['uri'], getv(from_object, ['video', 'uri']))
|
3997
4020
|
|
3998
|
-
if getv(from_object, ['encodedVideo']) is not None:
|
4021
|
+
if getv(from_object, ['video', 'encodedVideo']) is not None:
|
3999
4022
|
setv(
|
4000
4023
|
to_object,
|
4001
4024
|
['video_bytes'],
|
4002
|
-
t.t_bytes(api_client, getv(from_object, ['encodedVideo'])),
|
4025
|
+
t.t_bytes(api_client, getv(from_object, ['video', 'encodedVideo'])),
|
4003
4026
|
)
|
4004
4027
|
|
4005
4028
|
if getv(from_object, ['encoding']) is not None:
|
@@ -4009,11 +4032,11 @@ def _Video_from_mldev(
|
|
4009
4032
|
|
4010
4033
|
|
4011
4034
|
def _Video_from_vertex(
|
4012
|
-
api_client:
|
4035
|
+
api_client: BaseApiClient,
|
4013
4036
|
from_object: Union[dict, object],
|
4014
|
-
parent_object: dict = None,
|
4037
|
+
parent_object: Optional[dict] = None,
|
4015
4038
|
) -> dict:
|
4016
|
-
to_object = {}
|
4039
|
+
to_object: dict[str, Any] = {}
|
4017
4040
|
if getv(from_object, ['gcsUri']) is not None:
|
4018
4041
|
setv(to_object, ['uri'], getv(from_object, ['gcsUri']))
|
4019
4042
|
|
@@ -4031,11 +4054,11 @@ def _Video_from_vertex(
|
|
4031
4054
|
|
4032
4055
|
|
4033
4056
|
def _GeneratedVideo_from_mldev(
|
4034
|
-
api_client:
|
4057
|
+
api_client: BaseApiClient,
|
4035
4058
|
from_object: Union[dict, object],
|
4036
|
-
parent_object: dict = None,
|
4059
|
+
parent_object: Optional[dict] = None,
|
4037
4060
|
) -> dict:
|
4038
|
-
to_object = {}
|
4061
|
+
to_object: dict[str, Any] = {}
|
4039
4062
|
if getv(from_object, ['_self']) is not None:
|
4040
4063
|
setv(
|
4041
4064
|
to_object,
|
@@ -4047,11 +4070,11 @@ def _GeneratedVideo_from_mldev(
|
|
4047
4070
|
|
4048
4071
|
|
4049
4072
|
def _GeneratedVideo_from_vertex(
|
4050
|
-
api_client:
|
4073
|
+
api_client: BaseApiClient,
|
4051
4074
|
from_object: Union[dict, object],
|
4052
|
-
parent_object: dict = None,
|
4075
|
+
parent_object: Optional[dict] = None,
|
4053
4076
|
) -> dict:
|
4054
|
-
to_object = {}
|
4077
|
+
to_object: dict[str, Any] = {}
|
4055
4078
|
if getv(from_object, ['_self']) is not None:
|
4056
4079
|
setv(
|
4057
4080
|
to_object,
|
@@ -4063,18 +4086,18 @@ def _GeneratedVideo_from_vertex(
|
|
4063
4086
|
|
4064
4087
|
|
4065
4088
|
def _GenerateVideosResponse_from_mldev(
|
4066
|
-
api_client:
|
4089
|
+
api_client: BaseApiClient,
|
4067
4090
|
from_object: Union[dict, object],
|
4068
|
-
parent_object: dict = None,
|
4091
|
+
parent_object: Optional[dict] = None,
|
4069
4092
|
) -> dict:
|
4070
|
-
to_object = {}
|
4071
|
-
if getv(from_object, ['
|
4093
|
+
to_object: dict[str, Any] = {}
|
4094
|
+
if getv(from_object, ['generatedSamples']) is not None:
|
4072
4095
|
setv(
|
4073
4096
|
to_object,
|
4074
4097
|
['generated_videos'],
|
4075
4098
|
[
|
4076
4099
|
_GeneratedVideo_from_mldev(api_client, item, to_object)
|
4077
|
-
for item in getv(from_object, ['
|
4100
|
+
for item in getv(from_object, ['generatedSamples'])
|
4078
4101
|
],
|
4079
4102
|
)
|
4080
4103
|
|
@@ -4096,11 +4119,11 @@ def _GenerateVideosResponse_from_mldev(
|
|
4096
4119
|
|
4097
4120
|
|
4098
4121
|
def _GenerateVideosResponse_from_vertex(
|
4099
|
-
api_client:
|
4122
|
+
api_client: BaseApiClient,
|
4100
4123
|
from_object: Union[dict, object],
|
4101
|
-
parent_object: dict = None,
|
4124
|
+
parent_object: Optional[dict] = None,
|
4102
4125
|
) -> dict:
|
4103
|
-
to_object = {}
|
4126
|
+
to_object: dict[str, Any] = {}
|
4104
4127
|
if getv(from_object, ['videos']) is not None:
|
4105
4128
|
setv(
|
4106
4129
|
to_object,
|
@@ -4129,11 +4152,11 @@ def _GenerateVideosResponse_from_vertex(
|
|
4129
4152
|
|
4130
4153
|
|
4131
4154
|
def _GenerateVideosOperation_from_mldev(
|
4132
|
-
api_client:
|
4155
|
+
api_client: BaseApiClient,
|
4133
4156
|
from_object: Union[dict, object],
|
4134
|
-
parent_object: dict = None,
|
4157
|
+
parent_object: Optional[dict] = None,
|
4135
4158
|
) -> dict:
|
4136
|
-
to_object = {}
|
4159
|
+
to_object: dict[str, Any] = {}
|
4137
4160
|
if getv(from_object, ['name']) is not None:
|
4138
4161
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
4139
4162
|
|
@@ -4164,11 +4187,11 @@ def _GenerateVideosOperation_from_mldev(
|
|
4164
4187
|
|
4165
4188
|
|
4166
4189
|
def _GenerateVideosOperation_from_vertex(
|
4167
|
-
api_client:
|
4190
|
+
api_client: BaseApiClient,
|
4168
4191
|
from_object: Union[dict, object],
|
4169
|
-
parent_object: dict = None,
|
4192
|
+
parent_object: Optional[dict] = None,
|
4170
4193
|
) -> dict:
|
4171
|
-
to_object = {}
|
4194
|
+
to_object: dict[str, Any] = {}
|
4172
4195
|
if getv(from_object, ['name']) is not None:
|
4173
4196
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
4174
4197
|
|
@@ -4211,26 +4234,36 @@ class Models(_api_module.BaseModule):
|
|
4211
4234
|
config=config,
|
4212
4235
|
)
|
4213
4236
|
|
4237
|
+
request_url_dict: Optional[dict[str, str]]
|
4238
|
+
|
4214
4239
|
if self._api_client.vertexai:
|
4215
4240
|
request_dict = _GenerateContentParameters_to_vertex(
|
4216
4241
|
self._api_client, parameter_model
|
4217
4242
|
)
|
4218
|
-
|
4243
|
+
request_url_dict = request_dict.get('_url')
|
4244
|
+
if request_url_dict:
|
4245
|
+
path = '{model}:generateContent'.format_map(request_url_dict)
|
4246
|
+
else:
|
4247
|
+
path = '{model}:generateContent'
|
4219
4248
|
else:
|
4220
4249
|
request_dict = _GenerateContentParameters_to_mldev(
|
4221
4250
|
self._api_client, parameter_model
|
4222
4251
|
)
|
4223
|
-
|
4252
|
+
request_url_dict = request_dict.get('_url')
|
4253
|
+
if request_url_dict:
|
4254
|
+
path = '{model}:generateContent'.format_map(request_url_dict)
|
4255
|
+
else:
|
4256
|
+
path = '{model}:generateContent'
|
4224
4257
|
query_params = request_dict.get('_query')
|
4225
4258
|
if query_params:
|
4226
4259
|
path = f'{path}?{urlencode(query_params)}'
|
4227
4260
|
# TODO: remove the hack that pops config.
|
4228
4261
|
request_dict.pop('config', None)
|
4229
4262
|
|
4230
|
-
http_options = None
|
4263
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4231
4264
|
if isinstance(config, dict):
|
4232
4265
|
http_options = config.get('http_options', None)
|
4233
|
-
elif hasattr(config, 'http_options'):
|
4266
|
+
elif hasattr(config, 'http_options') and config is not None:
|
4234
4267
|
http_options = config.http_options
|
4235
4268
|
|
4236
4269
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -4250,7 +4283,7 @@ class Models(_api_module.BaseModule):
|
|
4250
4283
|
)
|
4251
4284
|
|
4252
4285
|
return_value = types.GenerateContentResponse._from_response(
|
4253
|
-
response=response_dict, kwargs=parameter_model
|
4286
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4254
4287
|
)
|
4255
4288
|
self._api_client._verify_response(return_value)
|
4256
4289
|
return return_value
|
@@ -4268,30 +4301,40 @@ class Models(_api_module.BaseModule):
|
|
4268
4301
|
config=config,
|
4269
4302
|
)
|
4270
4303
|
|
4304
|
+
request_url_dict: Optional[dict[str, str]]
|
4305
|
+
|
4271
4306
|
if self._api_client.vertexai:
|
4272
4307
|
request_dict = _GenerateContentParameters_to_vertex(
|
4273
4308
|
self._api_client, parameter_model
|
4274
4309
|
)
|
4275
|
-
|
4276
|
-
|
4277
|
-
|
4310
|
+
request_url_dict = request_dict.get('_url')
|
4311
|
+
if request_url_dict:
|
4312
|
+
path = '{model}:streamGenerateContent?alt=sse'.format_map(
|
4313
|
+
request_url_dict
|
4314
|
+
)
|
4315
|
+
else:
|
4316
|
+
path = '{model}:streamGenerateContent?alt=sse'
|
4278
4317
|
else:
|
4279
4318
|
request_dict = _GenerateContentParameters_to_mldev(
|
4280
4319
|
self._api_client, parameter_model
|
4281
4320
|
)
|
4282
|
-
|
4283
|
-
|
4284
|
-
|
4321
|
+
request_url_dict = request_dict.get('_url')
|
4322
|
+
if request_url_dict:
|
4323
|
+
path = '{model}:streamGenerateContent?alt=sse'.format_map(
|
4324
|
+
request_url_dict
|
4325
|
+
)
|
4326
|
+
else:
|
4327
|
+
path = '{model}:streamGenerateContent?alt=sse'
|
4285
4328
|
query_params = request_dict.get('_query')
|
4286
4329
|
if query_params:
|
4287
4330
|
path = f'{path}?{urlencode(query_params)}'
|
4288
4331
|
# TODO: remove the hack that pops config.
|
4289
4332
|
request_dict.pop('config', None)
|
4290
4333
|
|
4291
|
-
http_options = None
|
4334
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4292
4335
|
if isinstance(config, dict):
|
4293
4336
|
http_options = config.get('http_options', None)
|
4294
|
-
elif hasattr(config, 'http_options'):
|
4337
|
+
elif hasattr(config, 'http_options') and config is not None:
|
4295
4338
|
http_options = config.http_options
|
4296
4339
|
|
4297
4340
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -4311,7 +4354,7 @@ class Models(_api_module.BaseModule):
|
|
4311
4354
|
)
|
4312
4355
|
|
4313
4356
|
return_value = types.GenerateContentResponse._from_response(
|
4314
|
-
response=response_dict, kwargs=parameter_model
|
4357
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4315
4358
|
)
|
4316
4359
|
self._api_client._verify_response(return_value)
|
4317
4360
|
yield return_value
|
@@ -4352,26 +4395,36 @@ class Models(_api_module.BaseModule):
|
|
4352
4395
|
config=config,
|
4353
4396
|
)
|
4354
4397
|
|
4398
|
+
request_url_dict: Optional[dict[str, str]]
|
4399
|
+
|
4355
4400
|
if self._api_client.vertexai:
|
4356
4401
|
request_dict = _EmbedContentParameters_to_vertex(
|
4357
4402
|
self._api_client, parameter_model
|
4358
4403
|
)
|
4359
|
-
|
4404
|
+
request_url_dict = request_dict.get('_url')
|
4405
|
+
if request_url_dict:
|
4406
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
4407
|
+
else:
|
4408
|
+
path = '{model}:predict'
|
4360
4409
|
else:
|
4361
4410
|
request_dict = _EmbedContentParameters_to_mldev(
|
4362
4411
|
self._api_client, parameter_model
|
4363
4412
|
)
|
4364
|
-
|
4413
|
+
request_url_dict = request_dict.get('_url')
|
4414
|
+
if request_url_dict:
|
4415
|
+
path = '{model}:batchEmbedContents'.format_map(request_url_dict)
|
4416
|
+
else:
|
4417
|
+
path = '{model}:batchEmbedContents'
|
4365
4418
|
query_params = request_dict.get('_query')
|
4366
4419
|
if query_params:
|
4367
4420
|
path = f'{path}?{urlencode(query_params)}'
|
4368
4421
|
# TODO: remove the hack that pops config.
|
4369
4422
|
request_dict.pop('config', None)
|
4370
4423
|
|
4371
|
-
http_options = None
|
4424
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4372
4425
|
if isinstance(config, dict):
|
4373
4426
|
http_options = config.get('http_options', None)
|
4374
|
-
elif hasattr(config, 'http_options'):
|
4427
|
+
elif hasattr(config, 'http_options') and config is not None:
|
4375
4428
|
http_options = config.http_options
|
4376
4429
|
|
4377
4430
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -4391,7 +4444,7 @@ class Models(_api_module.BaseModule):
|
|
4391
4444
|
)
|
4392
4445
|
|
4393
4446
|
return_value = types.EmbedContentResponse._from_response(
|
4394
|
-
response=response_dict, kwargs=parameter_model
|
4447
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4395
4448
|
)
|
4396
4449
|
self._api_client._verify_response(return_value)
|
4397
4450
|
return return_value
|
@@ -4432,26 +4485,36 @@ class Models(_api_module.BaseModule):
|
|
4432
4485
|
config=config,
|
4433
4486
|
)
|
4434
4487
|
|
4488
|
+
request_url_dict: Optional[dict[str, str]]
|
4489
|
+
|
4435
4490
|
if self._api_client.vertexai:
|
4436
4491
|
request_dict = _GenerateImagesParameters_to_vertex(
|
4437
4492
|
self._api_client, parameter_model
|
4438
4493
|
)
|
4439
|
-
|
4494
|
+
request_url_dict = request_dict.get('_url')
|
4495
|
+
if request_url_dict:
|
4496
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
4497
|
+
else:
|
4498
|
+
path = '{model}:predict'
|
4440
4499
|
else:
|
4441
4500
|
request_dict = _GenerateImagesParameters_to_mldev(
|
4442
4501
|
self._api_client, parameter_model
|
4443
4502
|
)
|
4444
|
-
|
4503
|
+
request_url_dict = request_dict.get('_url')
|
4504
|
+
if request_url_dict:
|
4505
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
4506
|
+
else:
|
4507
|
+
path = '{model}:predict'
|
4445
4508
|
query_params = request_dict.get('_query')
|
4446
4509
|
if query_params:
|
4447
4510
|
path = f'{path}?{urlencode(query_params)}'
|
4448
4511
|
# TODO: remove the hack that pops config.
|
4449
4512
|
request_dict.pop('config', None)
|
4450
4513
|
|
4451
|
-
http_options = None
|
4514
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4452
4515
|
if isinstance(config, dict):
|
4453
4516
|
http_options = config.get('http_options', None)
|
4454
|
-
elif hasattr(config, 'http_options'):
|
4517
|
+
elif hasattr(config, 'http_options') and config is not None:
|
4455
4518
|
http_options = config.http_options
|
4456
4519
|
|
4457
4520
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -4471,7 +4534,7 @@ class Models(_api_module.BaseModule):
|
|
4471
4534
|
)
|
4472
4535
|
|
4473
4536
|
return_value = types.GenerateImagesResponse._from_response(
|
4474
|
-
response=response_dict, kwargs=parameter_model
|
4537
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4475
4538
|
)
|
4476
4539
|
self._api_client._verify_response(return_value)
|
4477
4540
|
return return_value
|
@@ -4513,7 +4576,7 @@ class Models(_api_module.BaseModule):
|
|
4513
4576
|
),
|
4514
4577
|
)
|
4515
4578
|
response = client.models.edit_image(
|
4516
|
-
model='imagen-3.0-capability-
|
4579
|
+
model='imagen-3.0-capability-001',
|
4517
4580
|
prompt='man with dog',
|
4518
4581
|
reference_images=[raw_ref_image, mask_ref_image],
|
4519
4582
|
config=types.EditImageConfig(
|
@@ -4533,13 +4596,18 @@ class Models(_api_module.BaseModule):
|
|
4533
4596
|
config=config,
|
4534
4597
|
)
|
4535
4598
|
|
4599
|
+
request_url_dict: Optional[dict[str, str]]
|
4536
4600
|
if not self._api_client.vertexai:
|
4537
4601
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
4538
4602
|
else:
|
4539
4603
|
request_dict = _EditImageParameters_to_vertex(
|
4540
4604
|
self._api_client, parameter_model
|
4541
4605
|
)
|
4542
|
-
|
4606
|
+
request_url_dict = request_dict.get('_url')
|
4607
|
+
if request_url_dict:
|
4608
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
4609
|
+
else:
|
4610
|
+
path = '{model}:predict'
|
4543
4611
|
|
4544
4612
|
query_params = request_dict.get('_query')
|
4545
4613
|
if query_params:
|
@@ -4547,10 +4615,10 @@ class Models(_api_module.BaseModule):
|
|
4547
4615
|
# TODO: remove the hack that pops config.
|
4548
4616
|
request_dict.pop('config', None)
|
4549
4617
|
|
4550
|
-
http_options = None
|
4618
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4551
4619
|
if isinstance(config, dict):
|
4552
4620
|
http_options = config.get('http_options', None)
|
4553
|
-
elif hasattr(config, 'http_options'):
|
4621
|
+
elif hasattr(config, 'http_options') and config is not None:
|
4554
4622
|
http_options = config.http_options
|
4555
4623
|
|
4556
4624
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -4570,7 +4638,7 @@ class Models(_api_module.BaseModule):
|
|
4570
4638
|
)
|
4571
4639
|
|
4572
4640
|
return_value = types.EditImageResponse._from_response(
|
4573
|
-
response=response_dict, kwargs=parameter_model
|
4641
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4574
4642
|
)
|
4575
4643
|
self._api_client._verify_response(return_value)
|
4576
4644
|
return return_value
|
@@ -4599,13 +4667,18 @@ class Models(_api_module.BaseModule):
|
|
4599
4667
|
config=config,
|
4600
4668
|
)
|
4601
4669
|
|
4670
|
+
request_url_dict: Optional[dict[str, str]]
|
4602
4671
|
if not self._api_client.vertexai:
|
4603
4672
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
4604
4673
|
else:
|
4605
4674
|
request_dict = _UpscaleImageAPIParameters_to_vertex(
|
4606
4675
|
self._api_client, parameter_model
|
4607
4676
|
)
|
4608
|
-
|
4677
|
+
request_url_dict = request_dict.get('_url')
|
4678
|
+
if request_url_dict:
|
4679
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
4680
|
+
else:
|
4681
|
+
path = '{model}:predict'
|
4609
4682
|
|
4610
4683
|
query_params = request_dict.get('_query')
|
4611
4684
|
if query_params:
|
@@ -4613,10 +4686,10 @@ class Models(_api_module.BaseModule):
|
|
4613
4686
|
# TODO: remove the hack that pops config.
|
4614
4687
|
request_dict.pop('config', None)
|
4615
4688
|
|
4616
|
-
http_options = None
|
4689
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4617
4690
|
if isinstance(config, dict):
|
4618
4691
|
http_options = config.get('http_options', None)
|
4619
|
-
elif hasattr(config, 'http_options'):
|
4692
|
+
elif hasattr(config, 'http_options') and config is not None:
|
4620
4693
|
http_options = config.http_options
|
4621
4694
|
|
4622
4695
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -4636,7 +4709,7 @@ class Models(_api_module.BaseModule):
|
|
4636
4709
|
)
|
4637
4710
|
|
4638
4711
|
return_value = types.UpscaleImageResponse._from_response(
|
4639
|
-
response=response_dict, kwargs=parameter_model
|
4712
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4640
4713
|
)
|
4641
4714
|
self._api_client._verify_response(return_value)
|
4642
4715
|
return return_value
|
@@ -4649,26 +4722,36 @@ class Models(_api_module.BaseModule):
|
|
4649
4722
|
config=config,
|
4650
4723
|
)
|
4651
4724
|
|
4725
|
+
request_url_dict: Optional[dict[str, str]]
|
4726
|
+
|
4652
4727
|
if self._api_client.vertexai:
|
4653
4728
|
request_dict = _GetModelParameters_to_vertex(
|
4654
4729
|
self._api_client, parameter_model
|
4655
4730
|
)
|
4656
|
-
|
4731
|
+
request_url_dict = request_dict.get('_url')
|
4732
|
+
if request_url_dict:
|
4733
|
+
path = '{name}'.format_map(request_url_dict)
|
4734
|
+
else:
|
4735
|
+
path = '{name}'
|
4657
4736
|
else:
|
4658
4737
|
request_dict = _GetModelParameters_to_mldev(
|
4659
4738
|
self._api_client, parameter_model
|
4660
4739
|
)
|
4661
|
-
|
4740
|
+
request_url_dict = request_dict.get('_url')
|
4741
|
+
if request_url_dict:
|
4742
|
+
path = '{name}'.format_map(request_url_dict)
|
4743
|
+
else:
|
4744
|
+
path = '{name}'
|
4662
4745
|
query_params = request_dict.get('_query')
|
4663
4746
|
if query_params:
|
4664
4747
|
path = f'{path}?{urlencode(query_params)}'
|
4665
4748
|
# TODO: remove the hack that pops config.
|
4666
4749
|
request_dict.pop('config', None)
|
4667
4750
|
|
4668
|
-
http_options = None
|
4751
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4669
4752
|
if isinstance(config, dict):
|
4670
4753
|
http_options = config.get('http_options', None)
|
4671
|
-
elif hasattr(config, 'http_options'):
|
4754
|
+
elif hasattr(config, 'http_options') and config is not None:
|
4672
4755
|
http_options = config.http_options
|
4673
4756
|
|
4674
4757
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -4684,7 +4767,7 @@ class Models(_api_module.BaseModule):
|
|
4684
4767
|
response_dict = _Model_from_mldev(self._api_client, response_dict)
|
4685
4768
|
|
4686
4769
|
return_value = types.Model._from_response(
|
4687
|
-
response=response_dict, kwargs=parameter_model
|
4770
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4688
4771
|
)
|
4689
4772
|
self._api_client._verify_response(return_value)
|
4690
4773
|
return return_value
|
@@ -4696,26 +4779,36 @@ class Models(_api_module.BaseModule):
|
|
4696
4779
|
config=config,
|
4697
4780
|
)
|
4698
4781
|
|
4782
|
+
request_url_dict: Optional[dict[str, str]]
|
4783
|
+
|
4699
4784
|
if self._api_client.vertexai:
|
4700
4785
|
request_dict = _ListModelsParameters_to_vertex(
|
4701
4786
|
self._api_client, parameter_model
|
4702
4787
|
)
|
4703
|
-
|
4788
|
+
request_url_dict = request_dict.get('_url')
|
4789
|
+
if request_url_dict:
|
4790
|
+
path = '{models_url}'.format_map(request_url_dict)
|
4791
|
+
else:
|
4792
|
+
path = '{models_url}'
|
4704
4793
|
else:
|
4705
4794
|
request_dict = _ListModelsParameters_to_mldev(
|
4706
4795
|
self._api_client, parameter_model
|
4707
4796
|
)
|
4708
|
-
|
4797
|
+
request_url_dict = request_dict.get('_url')
|
4798
|
+
if request_url_dict:
|
4799
|
+
path = '{models_url}'.format_map(request_url_dict)
|
4800
|
+
else:
|
4801
|
+
path = '{models_url}'
|
4709
4802
|
query_params = request_dict.get('_query')
|
4710
4803
|
if query_params:
|
4711
4804
|
path = f'{path}?{urlencode(query_params)}'
|
4712
4805
|
# TODO: remove the hack that pops config.
|
4713
4806
|
request_dict.pop('config', None)
|
4714
4807
|
|
4715
|
-
http_options = None
|
4808
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4716
4809
|
if isinstance(config, dict):
|
4717
4810
|
http_options = config.get('http_options', None)
|
4718
|
-
elif hasattr(config, 'http_options'):
|
4811
|
+
elif hasattr(config, 'http_options') and config is not None:
|
4719
4812
|
http_options = config.http_options
|
4720
4813
|
|
4721
4814
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -4735,7 +4828,7 @@ class Models(_api_module.BaseModule):
|
|
4735
4828
|
)
|
4736
4829
|
|
4737
4830
|
return_value = types.ListModelsResponse._from_response(
|
4738
|
-
response=response_dict, kwargs=parameter_model
|
4831
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4739
4832
|
)
|
4740
4833
|
self._api_client._verify_response(return_value)
|
4741
4834
|
return return_value
|
@@ -4751,26 +4844,36 @@ class Models(_api_module.BaseModule):
|
|
4751
4844
|
config=config,
|
4752
4845
|
)
|
4753
4846
|
|
4847
|
+
request_url_dict: Optional[dict[str, str]]
|
4848
|
+
|
4754
4849
|
if self._api_client.vertexai:
|
4755
4850
|
request_dict = _UpdateModelParameters_to_vertex(
|
4756
4851
|
self._api_client, parameter_model
|
4757
4852
|
)
|
4758
|
-
|
4853
|
+
request_url_dict = request_dict.get('_url')
|
4854
|
+
if request_url_dict:
|
4855
|
+
path = '{model}'.format_map(request_url_dict)
|
4856
|
+
else:
|
4857
|
+
path = '{model}'
|
4759
4858
|
else:
|
4760
4859
|
request_dict = _UpdateModelParameters_to_mldev(
|
4761
4860
|
self._api_client, parameter_model
|
4762
4861
|
)
|
4763
|
-
|
4862
|
+
request_url_dict = request_dict.get('_url')
|
4863
|
+
if request_url_dict:
|
4864
|
+
path = '{name}'.format_map(request_url_dict)
|
4865
|
+
else:
|
4866
|
+
path = '{name}'
|
4764
4867
|
query_params = request_dict.get('_query')
|
4765
4868
|
if query_params:
|
4766
4869
|
path = f'{path}?{urlencode(query_params)}'
|
4767
4870
|
# TODO: remove the hack that pops config.
|
4768
4871
|
request_dict.pop('config', None)
|
4769
4872
|
|
4770
|
-
http_options = None
|
4873
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4771
4874
|
if isinstance(config, dict):
|
4772
4875
|
http_options = config.get('http_options', None)
|
4773
|
-
elif hasattr(config, 'http_options'):
|
4876
|
+
elif hasattr(config, 'http_options') and config is not None:
|
4774
4877
|
http_options = config.http_options
|
4775
4878
|
|
4776
4879
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -4786,7 +4889,7 @@ class Models(_api_module.BaseModule):
|
|
4786
4889
|
response_dict = _Model_from_mldev(self._api_client, response_dict)
|
4787
4890
|
|
4788
4891
|
return_value = types.Model._from_response(
|
4789
|
-
response=response_dict, kwargs=parameter_model
|
4892
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4790
4893
|
)
|
4791
4894
|
self._api_client._verify_response(return_value)
|
4792
4895
|
return return_value
|
@@ -4802,26 +4905,36 @@ class Models(_api_module.BaseModule):
|
|
4802
4905
|
config=config,
|
4803
4906
|
)
|
4804
4907
|
|
4908
|
+
request_url_dict: Optional[dict[str, str]]
|
4909
|
+
|
4805
4910
|
if self._api_client.vertexai:
|
4806
4911
|
request_dict = _DeleteModelParameters_to_vertex(
|
4807
4912
|
self._api_client, parameter_model
|
4808
4913
|
)
|
4809
|
-
|
4914
|
+
request_url_dict = request_dict.get('_url')
|
4915
|
+
if request_url_dict:
|
4916
|
+
path = '{name}'.format_map(request_url_dict)
|
4917
|
+
else:
|
4918
|
+
path = '{name}'
|
4810
4919
|
else:
|
4811
4920
|
request_dict = _DeleteModelParameters_to_mldev(
|
4812
4921
|
self._api_client, parameter_model
|
4813
4922
|
)
|
4814
|
-
|
4923
|
+
request_url_dict = request_dict.get('_url')
|
4924
|
+
if request_url_dict:
|
4925
|
+
path = '{name}'.format_map(request_url_dict)
|
4926
|
+
else:
|
4927
|
+
path = '{name}'
|
4815
4928
|
query_params = request_dict.get('_query')
|
4816
4929
|
if query_params:
|
4817
4930
|
path = f'{path}?{urlencode(query_params)}'
|
4818
4931
|
# TODO: remove the hack that pops config.
|
4819
4932
|
request_dict.pop('config', None)
|
4820
4933
|
|
4821
|
-
http_options = None
|
4934
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4822
4935
|
if isinstance(config, dict):
|
4823
4936
|
http_options = config.get('http_options', None)
|
4824
|
-
elif hasattr(config, 'http_options'):
|
4937
|
+
elif hasattr(config, 'http_options') and config is not None:
|
4825
4938
|
http_options = config.http_options
|
4826
4939
|
|
4827
4940
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -4841,7 +4954,7 @@ class Models(_api_module.BaseModule):
|
|
4841
4954
|
)
|
4842
4955
|
|
4843
4956
|
return_value = types.DeleteModelResponse._from_response(
|
4844
|
-
response=response_dict, kwargs=parameter_model
|
4957
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4845
4958
|
)
|
4846
4959
|
self._api_client._verify_response(return_value)
|
4847
4960
|
return return_value
|
@@ -4880,26 +4993,36 @@ class Models(_api_module.BaseModule):
|
|
4880
4993
|
config=config,
|
4881
4994
|
)
|
4882
4995
|
|
4996
|
+
request_url_dict: Optional[dict[str, str]]
|
4997
|
+
|
4883
4998
|
if self._api_client.vertexai:
|
4884
4999
|
request_dict = _CountTokensParameters_to_vertex(
|
4885
5000
|
self._api_client, parameter_model
|
4886
5001
|
)
|
4887
|
-
|
5002
|
+
request_url_dict = request_dict.get('_url')
|
5003
|
+
if request_url_dict:
|
5004
|
+
path = '{model}:countTokens'.format_map(request_url_dict)
|
5005
|
+
else:
|
5006
|
+
path = '{model}:countTokens'
|
4888
5007
|
else:
|
4889
5008
|
request_dict = _CountTokensParameters_to_mldev(
|
4890
5009
|
self._api_client, parameter_model
|
4891
5010
|
)
|
4892
|
-
|
5011
|
+
request_url_dict = request_dict.get('_url')
|
5012
|
+
if request_url_dict:
|
5013
|
+
path = '{model}:countTokens'.format_map(request_url_dict)
|
5014
|
+
else:
|
5015
|
+
path = '{model}:countTokens'
|
4893
5016
|
query_params = request_dict.get('_query')
|
4894
5017
|
if query_params:
|
4895
5018
|
path = f'{path}?{urlencode(query_params)}'
|
4896
5019
|
# TODO: remove the hack that pops config.
|
4897
5020
|
request_dict.pop('config', None)
|
4898
5021
|
|
4899
|
-
http_options = None
|
5022
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4900
5023
|
if isinstance(config, dict):
|
4901
5024
|
http_options = config.get('http_options', None)
|
4902
|
-
elif hasattr(config, 'http_options'):
|
5025
|
+
elif hasattr(config, 'http_options') and config is not None:
|
4903
5026
|
http_options = config.http_options
|
4904
5027
|
|
4905
5028
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -4919,7 +5042,7 @@ class Models(_api_module.BaseModule):
|
|
4919
5042
|
)
|
4920
5043
|
|
4921
5044
|
return_value = types.CountTokensResponse._from_response(
|
4922
|
-
response=response_dict, kwargs=parameter_model
|
5045
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4923
5046
|
)
|
4924
5047
|
self._api_client._verify_response(return_value)
|
4925
5048
|
return return_value
|
@@ -4960,13 +5083,18 @@ class Models(_api_module.BaseModule):
|
|
4960
5083
|
config=config,
|
4961
5084
|
)
|
4962
5085
|
|
5086
|
+
request_url_dict: Optional[dict[str, str]]
|
4963
5087
|
if not self._api_client.vertexai:
|
4964
5088
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
4965
5089
|
else:
|
4966
5090
|
request_dict = _ComputeTokensParameters_to_vertex(
|
4967
5091
|
self._api_client, parameter_model
|
4968
5092
|
)
|
4969
|
-
|
5093
|
+
request_url_dict = request_dict.get('_url')
|
5094
|
+
if request_url_dict:
|
5095
|
+
path = '{model}:computeTokens'.format_map(request_url_dict)
|
5096
|
+
else:
|
5097
|
+
path = '{model}:computeTokens'
|
4970
5098
|
|
4971
5099
|
query_params = request_dict.get('_query')
|
4972
5100
|
if query_params:
|
@@ -4974,10 +5102,10 @@ class Models(_api_module.BaseModule):
|
|
4974
5102
|
# TODO: remove the hack that pops config.
|
4975
5103
|
request_dict.pop('config', None)
|
4976
5104
|
|
4977
|
-
http_options = None
|
5105
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4978
5106
|
if isinstance(config, dict):
|
4979
5107
|
http_options = config.get('http_options', None)
|
4980
|
-
elif hasattr(config, 'http_options'):
|
5108
|
+
elif hasattr(config, 'http_options') and config is not None:
|
4981
5109
|
http_options = config.http_options
|
4982
5110
|
|
4983
5111
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -4997,7 +5125,7 @@ class Models(_api_module.BaseModule):
|
|
4997
5125
|
)
|
4998
5126
|
|
4999
5127
|
return_value = types.ComputeTokensResponse._from_response(
|
5000
|
-
response=response_dict, kwargs=parameter_model
|
5128
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5001
5129
|
)
|
5002
5130
|
self._api_client._verify_response(return_value)
|
5003
5131
|
return return_value
|
@@ -5010,6 +5138,7 @@ class Models(_api_module.BaseModule):
|
|
5010
5138
|
*,
|
5011
5139
|
model: str,
|
5012
5140
|
prompt: Optional[str] = None,
|
5141
|
+
image: Optional[types.ImageOrDict] = None,
|
5013
5142
|
config: Optional[types.GenerateVideosConfigOrDict] = None,
|
5014
5143
|
) -> types.GenerateVideosOperation:
|
5015
5144
|
"""Generates videos based on a text description and configuration.
|
@@ -5037,29 +5166,40 @@ class Models(_api_module.BaseModule):
|
|
5037
5166
|
parameter_model = types._GenerateVideosParameters(
|
5038
5167
|
model=model,
|
5039
5168
|
prompt=prompt,
|
5169
|
+
image=image,
|
5040
5170
|
config=config,
|
5041
5171
|
)
|
5042
5172
|
|
5173
|
+
request_url_dict: Optional[dict[str, str]]
|
5174
|
+
|
5043
5175
|
if self._api_client.vertexai:
|
5044
5176
|
request_dict = _GenerateVideosParameters_to_vertex(
|
5045
5177
|
self._api_client, parameter_model
|
5046
5178
|
)
|
5047
|
-
|
5179
|
+
request_url_dict = request_dict.get('_url')
|
5180
|
+
if request_url_dict:
|
5181
|
+
path = '{model}:predictLongRunning'.format_map(request_url_dict)
|
5182
|
+
else:
|
5183
|
+
path = '{model}:predictLongRunning'
|
5048
5184
|
else:
|
5049
5185
|
request_dict = _GenerateVideosParameters_to_mldev(
|
5050
5186
|
self._api_client, parameter_model
|
5051
5187
|
)
|
5052
|
-
|
5188
|
+
request_url_dict = request_dict.get('_url')
|
5189
|
+
if request_url_dict:
|
5190
|
+
path = '{model}:predictLongRunning'.format_map(request_url_dict)
|
5191
|
+
else:
|
5192
|
+
path = '{model}:predictLongRunning'
|
5053
5193
|
query_params = request_dict.get('_query')
|
5054
5194
|
if query_params:
|
5055
5195
|
path = f'{path}?{urlencode(query_params)}'
|
5056
5196
|
# TODO: remove the hack that pops config.
|
5057
5197
|
request_dict.pop('config', None)
|
5058
5198
|
|
5059
|
-
http_options = None
|
5199
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5060
5200
|
if isinstance(config, dict):
|
5061
5201
|
http_options = config.get('http_options', None)
|
5062
|
-
elif hasattr(config, 'http_options'):
|
5202
|
+
elif hasattr(config, 'http_options') and config is not None:
|
5063
5203
|
http_options = config.http_options
|
5064
5204
|
|
5065
5205
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -5079,7 +5219,7 @@ class Models(_api_module.BaseModule):
|
|
5079
5219
|
)
|
5080
5220
|
|
5081
5221
|
return_value = types.GenerateVideosOperation._from_response(
|
5082
|
-
response=response_dict, kwargs=parameter_model
|
5222
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5083
5223
|
)
|
5084
5224
|
self._api_client._verify_response(return_value)
|
5085
5225
|
return return_value
|
@@ -5156,8 +5296,8 @@ class Models(_api_module.BaseModule):
|
|
5156
5296
|
logger.info(
|
5157
5297
|
f'AFC is enabled with max remote calls: {remaining_remote_calls_afc}.'
|
5158
5298
|
)
|
5159
|
-
automatic_function_calling_history = []
|
5160
|
-
response =
|
5299
|
+
automatic_function_calling_history: list[types.Content] = []
|
5300
|
+
response = types.GenerateContentResponse()
|
5161
5301
|
i = 0
|
5162
5302
|
while remaining_remote_calls_afc > 0:
|
5163
5303
|
i += 1
|
@@ -5193,11 +5333,12 @@ class Models(_api_module.BaseModule):
|
|
5193
5333
|
contents = t.t_contents(self._api_client, contents)
|
5194
5334
|
if not automatic_function_calling_history:
|
5195
5335
|
automatic_function_calling_history.extend(contents)
|
5196
|
-
contents
|
5197
|
-
|
5336
|
+
if isinstance(contents, list):
|
5337
|
+
contents.append(func_call_content)
|
5338
|
+
contents.append(func_response_content)
|
5198
5339
|
automatic_function_calling_history.append(func_call_content)
|
5199
5340
|
automatic_function_calling_history.append(func_response_content)
|
5200
|
-
if _extra_utils.should_append_afc_history(config):
|
5341
|
+
if _extra_utils.should_append_afc_history(config) and response is not None:
|
5201
5342
|
response.automatic_function_calling_history = (
|
5202
5343
|
automatic_function_calling_history
|
5203
5344
|
)
|
@@ -5277,7 +5418,7 @@ class Models(_api_module.BaseModule):
|
|
5277
5418
|
logger.info(
|
5278
5419
|
f'AFC is enabled with max remote calls: {remaining_remote_calls_afc}.'
|
5279
5420
|
)
|
5280
|
-
automatic_function_calling_history = []
|
5421
|
+
automatic_function_calling_history: list[types.Content] = []
|
5281
5422
|
chunk = None
|
5282
5423
|
func_response_parts = None
|
5283
5424
|
i = 0
|
@@ -5345,8 +5486,9 @@ class Models(_api_module.BaseModule):
|
|
5345
5486
|
contents = t.t_contents(self._api_client, contents)
|
5346
5487
|
if not automatic_function_calling_history:
|
5347
5488
|
automatic_function_calling_history.extend(contents)
|
5348
|
-
contents
|
5349
|
-
|
5489
|
+
if isinstance(contents, list):
|
5490
|
+
contents.append(func_call_content)
|
5491
|
+
contents.append(func_response_content)
|
5350
5492
|
automatic_function_calling_history.append(func_call_content)
|
5351
5493
|
automatic_function_calling_history.append(func_response_content)
|
5352
5494
|
|
@@ -5472,26 +5614,36 @@ class AsyncModels(_api_module.BaseModule):
|
|
5472
5614
|
config=config,
|
5473
5615
|
)
|
5474
5616
|
|
5617
|
+
request_url_dict: Optional[dict[str, str]]
|
5618
|
+
|
5475
5619
|
if self._api_client.vertexai:
|
5476
5620
|
request_dict = _GenerateContentParameters_to_vertex(
|
5477
5621
|
self._api_client, parameter_model
|
5478
5622
|
)
|
5479
|
-
|
5623
|
+
request_url_dict = request_dict.get('_url')
|
5624
|
+
if request_url_dict:
|
5625
|
+
path = '{model}:generateContent'.format_map(request_url_dict)
|
5626
|
+
else:
|
5627
|
+
path = '{model}:generateContent'
|
5480
5628
|
else:
|
5481
5629
|
request_dict = _GenerateContentParameters_to_mldev(
|
5482
5630
|
self._api_client, parameter_model
|
5483
5631
|
)
|
5484
|
-
|
5632
|
+
request_url_dict = request_dict.get('_url')
|
5633
|
+
if request_url_dict:
|
5634
|
+
path = '{model}:generateContent'.format_map(request_url_dict)
|
5635
|
+
else:
|
5636
|
+
path = '{model}:generateContent'
|
5485
5637
|
query_params = request_dict.get('_query')
|
5486
5638
|
if query_params:
|
5487
5639
|
path = f'{path}?{urlencode(query_params)}'
|
5488
5640
|
# TODO: remove the hack that pops config.
|
5489
5641
|
request_dict.pop('config', None)
|
5490
5642
|
|
5491
|
-
http_options = None
|
5643
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5492
5644
|
if isinstance(config, dict):
|
5493
5645
|
http_options = config.get('http_options', None)
|
5494
|
-
elif hasattr(config, 'http_options'):
|
5646
|
+
elif hasattr(config, 'http_options') and config is not None:
|
5495
5647
|
http_options = config.http_options
|
5496
5648
|
|
5497
5649
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -5511,7 +5663,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5511
5663
|
)
|
5512
5664
|
|
5513
5665
|
return_value = types.GenerateContentResponse._from_response(
|
5514
|
-
response=response_dict, kwargs=parameter_model
|
5666
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5515
5667
|
)
|
5516
5668
|
self._api_client._verify_response(return_value)
|
5517
5669
|
return return_value
|
@@ -5529,30 +5681,40 @@ class AsyncModels(_api_module.BaseModule):
|
|
5529
5681
|
config=config,
|
5530
5682
|
)
|
5531
5683
|
|
5684
|
+
request_url_dict: Optional[dict[str, str]]
|
5685
|
+
|
5532
5686
|
if self._api_client.vertexai:
|
5533
5687
|
request_dict = _GenerateContentParameters_to_vertex(
|
5534
5688
|
self._api_client, parameter_model
|
5535
5689
|
)
|
5536
|
-
|
5537
|
-
|
5538
|
-
|
5690
|
+
request_url_dict = request_dict.get('_url')
|
5691
|
+
if request_url_dict:
|
5692
|
+
path = '{model}:streamGenerateContent?alt=sse'.format_map(
|
5693
|
+
request_url_dict
|
5694
|
+
)
|
5695
|
+
else:
|
5696
|
+
path = '{model}:streamGenerateContent?alt=sse'
|
5539
5697
|
else:
|
5540
5698
|
request_dict = _GenerateContentParameters_to_mldev(
|
5541
5699
|
self._api_client, parameter_model
|
5542
5700
|
)
|
5543
|
-
|
5544
|
-
|
5545
|
-
|
5701
|
+
request_url_dict = request_dict.get('_url')
|
5702
|
+
if request_url_dict:
|
5703
|
+
path = '{model}:streamGenerateContent?alt=sse'.format_map(
|
5704
|
+
request_url_dict
|
5705
|
+
)
|
5706
|
+
else:
|
5707
|
+
path = '{model}:streamGenerateContent?alt=sse'
|
5546
5708
|
query_params = request_dict.get('_query')
|
5547
5709
|
if query_params:
|
5548
5710
|
path = f'{path}?{urlencode(query_params)}'
|
5549
5711
|
# TODO: remove the hack that pops config.
|
5550
5712
|
request_dict.pop('config', None)
|
5551
5713
|
|
5552
|
-
http_options = None
|
5714
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5553
5715
|
if isinstance(config, dict):
|
5554
5716
|
http_options = config.get('http_options', None)
|
5555
|
-
elif hasattr(config, 'http_options'):
|
5717
|
+
elif hasattr(config, 'http_options') and config is not None:
|
5556
5718
|
http_options = config.http_options
|
5557
5719
|
|
5558
5720
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -5575,7 +5737,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5575
5737
|
)
|
5576
5738
|
|
5577
5739
|
return_value = types.GenerateContentResponse._from_response(
|
5578
|
-
response=response_dict, kwargs=parameter_model
|
5740
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5579
5741
|
)
|
5580
5742
|
self._api_client._verify_response(return_value)
|
5581
5743
|
yield return_value
|
@@ -5618,26 +5780,36 @@ class AsyncModels(_api_module.BaseModule):
|
|
5618
5780
|
config=config,
|
5619
5781
|
)
|
5620
5782
|
|
5783
|
+
request_url_dict: Optional[dict[str, str]]
|
5784
|
+
|
5621
5785
|
if self._api_client.vertexai:
|
5622
5786
|
request_dict = _EmbedContentParameters_to_vertex(
|
5623
5787
|
self._api_client, parameter_model
|
5624
5788
|
)
|
5625
|
-
|
5789
|
+
request_url_dict = request_dict.get('_url')
|
5790
|
+
if request_url_dict:
|
5791
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
5792
|
+
else:
|
5793
|
+
path = '{model}:predict'
|
5626
5794
|
else:
|
5627
5795
|
request_dict = _EmbedContentParameters_to_mldev(
|
5628
5796
|
self._api_client, parameter_model
|
5629
5797
|
)
|
5630
|
-
|
5798
|
+
request_url_dict = request_dict.get('_url')
|
5799
|
+
if request_url_dict:
|
5800
|
+
path = '{model}:batchEmbedContents'.format_map(request_url_dict)
|
5801
|
+
else:
|
5802
|
+
path = '{model}:batchEmbedContents'
|
5631
5803
|
query_params = request_dict.get('_query')
|
5632
5804
|
if query_params:
|
5633
5805
|
path = f'{path}?{urlencode(query_params)}'
|
5634
5806
|
# TODO: remove the hack that pops config.
|
5635
5807
|
request_dict.pop('config', None)
|
5636
5808
|
|
5637
|
-
http_options = None
|
5809
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5638
5810
|
if isinstance(config, dict):
|
5639
5811
|
http_options = config.get('http_options', None)
|
5640
|
-
elif hasattr(config, 'http_options'):
|
5812
|
+
elif hasattr(config, 'http_options') and config is not None:
|
5641
5813
|
http_options = config.http_options
|
5642
5814
|
|
5643
5815
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -5657,7 +5829,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5657
5829
|
)
|
5658
5830
|
|
5659
5831
|
return_value = types.EmbedContentResponse._from_response(
|
5660
|
-
response=response_dict, kwargs=parameter_model
|
5832
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5661
5833
|
)
|
5662
5834
|
self._api_client._verify_response(return_value)
|
5663
5835
|
return return_value
|
@@ -5698,26 +5870,36 @@ class AsyncModels(_api_module.BaseModule):
|
|
5698
5870
|
config=config,
|
5699
5871
|
)
|
5700
5872
|
|
5873
|
+
request_url_dict: Optional[dict[str, str]]
|
5874
|
+
|
5701
5875
|
if self._api_client.vertexai:
|
5702
5876
|
request_dict = _GenerateImagesParameters_to_vertex(
|
5703
5877
|
self._api_client, parameter_model
|
5704
5878
|
)
|
5705
|
-
|
5879
|
+
request_url_dict = request_dict.get('_url')
|
5880
|
+
if request_url_dict:
|
5881
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
5882
|
+
else:
|
5883
|
+
path = '{model}:predict'
|
5706
5884
|
else:
|
5707
5885
|
request_dict = _GenerateImagesParameters_to_mldev(
|
5708
5886
|
self._api_client, parameter_model
|
5709
5887
|
)
|
5710
|
-
|
5888
|
+
request_url_dict = request_dict.get('_url')
|
5889
|
+
if request_url_dict:
|
5890
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
5891
|
+
else:
|
5892
|
+
path = '{model}:predict'
|
5711
5893
|
query_params = request_dict.get('_query')
|
5712
5894
|
if query_params:
|
5713
5895
|
path = f'{path}?{urlencode(query_params)}'
|
5714
5896
|
# TODO: remove the hack that pops config.
|
5715
5897
|
request_dict.pop('config', None)
|
5716
5898
|
|
5717
|
-
http_options = None
|
5899
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5718
5900
|
if isinstance(config, dict):
|
5719
5901
|
http_options = config.get('http_options', None)
|
5720
|
-
elif hasattr(config, 'http_options'):
|
5902
|
+
elif hasattr(config, 'http_options') and config is not None:
|
5721
5903
|
http_options = config.http_options
|
5722
5904
|
|
5723
5905
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -5737,7 +5919,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5737
5919
|
)
|
5738
5920
|
|
5739
5921
|
return_value = types.GenerateImagesResponse._from_response(
|
5740
|
-
response=response_dict, kwargs=parameter_model
|
5922
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5741
5923
|
)
|
5742
5924
|
self._api_client._verify_response(return_value)
|
5743
5925
|
return return_value
|
@@ -5779,7 +5961,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5779
5961
|
),
|
5780
5962
|
)
|
5781
5963
|
response = await client.aio.models.edit_image(
|
5782
|
-
model='imagen-3.0-capability-
|
5964
|
+
model='imagen-3.0-capability-001',
|
5783
5965
|
prompt='man with dog',
|
5784
5966
|
reference_images=[raw_ref_image, mask_ref_image],
|
5785
5967
|
config=types.EditImageConfig(
|
@@ -5799,13 +5981,18 @@ class AsyncModels(_api_module.BaseModule):
|
|
5799
5981
|
config=config,
|
5800
5982
|
)
|
5801
5983
|
|
5984
|
+
request_url_dict: Optional[dict[str, str]]
|
5802
5985
|
if not self._api_client.vertexai:
|
5803
5986
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
5804
5987
|
else:
|
5805
5988
|
request_dict = _EditImageParameters_to_vertex(
|
5806
5989
|
self._api_client, parameter_model
|
5807
5990
|
)
|
5808
|
-
|
5991
|
+
request_url_dict = request_dict.get('_url')
|
5992
|
+
if request_url_dict:
|
5993
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
5994
|
+
else:
|
5995
|
+
path = '{model}:predict'
|
5809
5996
|
|
5810
5997
|
query_params = request_dict.get('_query')
|
5811
5998
|
if query_params:
|
@@ -5813,10 +6000,10 @@ class AsyncModels(_api_module.BaseModule):
|
|
5813
6000
|
# TODO: remove the hack that pops config.
|
5814
6001
|
request_dict.pop('config', None)
|
5815
6002
|
|
5816
|
-
http_options = None
|
6003
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5817
6004
|
if isinstance(config, dict):
|
5818
6005
|
http_options = config.get('http_options', None)
|
5819
|
-
elif hasattr(config, 'http_options'):
|
6006
|
+
elif hasattr(config, 'http_options') and config is not None:
|
5820
6007
|
http_options = config.http_options
|
5821
6008
|
|
5822
6009
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -5836,7 +6023,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5836
6023
|
)
|
5837
6024
|
|
5838
6025
|
return_value = types.EditImageResponse._from_response(
|
5839
|
-
response=response_dict, kwargs=parameter_model
|
6026
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5840
6027
|
)
|
5841
6028
|
self._api_client._verify_response(return_value)
|
5842
6029
|
return return_value
|
@@ -5865,13 +6052,18 @@ class AsyncModels(_api_module.BaseModule):
|
|
5865
6052
|
config=config,
|
5866
6053
|
)
|
5867
6054
|
|
6055
|
+
request_url_dict: Optional[dict[str, str]]
|
5868
6056
|
if not self._api_client.vertexai:
|
5869
6057
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
5870
6058
|
else:
|
5871
6059
|
request_dict = _UpscaleImageAPIParameters_to_vertex(
|
5872
6060
|
self._api_client, parameter_model
|
5873
6061
|
)
|
5874
|
-
|
6062
|
+
request_url_dict = request_dict.get('_url')
|
6063
|
+
if request_url_dict:
|
6064
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
6065
|
+
else:
|
6066
|
+
path = '{model}:predict'
|
5875
6067
|
|
5876
6068
|
query_params = request_dict.get('_query')
|
5877
6069
|
if query_params:
|
@@ -5879,10 +6071,10 @@ class AsyncModels(_api_module.BaseModule):
|
|
5879
6071
|
# TODO: remove the hack that pops config.
|
5880
6072
|
request_dict.pop('config', None)
|
5881
6073
|
|
5882
|
-
http_options = None
|
6074
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5883
6075
|
if isinstance(config, dict):
|
5884
6076
|
http_options = config.get('http_options', None)
|
5885
|
-
elif hasattr(config, 'http_options'):
|
6077
|
+
elif hasattr(config, 'http_options') and config is not None:
|
5886
6078
|
http_options = config.http_options
|
5887
6079
|
|
5888
6080
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -5902,7 +6094,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5902
6094
|
)
|
5903
6095
|
|
5904
6096
|
return_value = types.UpscaleImageResponse._from_response(
|
5905
|
-
response=response_dict, kwargs=parameter_model
|
6097
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5906
6098
|
)
|
5907
6099
|
self._api_client._verify_response(return_value)
|
5908
6100
|
return return_value
|
@@ -5915,26 +6107,36 @@ class AsyncModels(_api_module.BaseModule):
|
|
5915
6107
|
config=config,
|
5916
6108
|
)
|
5917
6109
|
|
6110
|
+
request_url_dict: Optional[dict[str, str]]
|
6111
|
+
|
5918
6112
|
if self._api_client.vertexai:
|
5919
6113
|
request_dict = _GetModelParameters_to_vertex(
|
5920
6114
|
self._api_client, parameter_model
|
5921
6115
|
)
|
5922
|
-
|
6116
|
+
request_url_dict = request_dict.get('_url')
|
6117
|
+
if request_url_dict:
|
6118
|
+
path = '{name}'.format_map(request_url_dict)
|
6119
|
+
else:
|
6120
|
+
path = '{name}'
|
5923
6121
|
else:
|
5924
6122
|
request_dict = _GetModelParameters_to_mldev(
|
5925
6123
|
self._api_client, parameter_model
|
5926
6124
|
)
|
5927
|
-
|
6125
|
+
request_url_dict = request_dict.get('_url')
|
6126
|
+
if request_url_dict:
|
6127
|
+
path = '{name}'.format_map(request_url_dict)
|
6128
|
+
else:
|
6129
|
+
path = '{name}'
|
5928
6130
|
query_params = request_dict.get('_query')
|
5929
6131
|
if query_params:
|
5930
6132
|
path = f'{path}?{urlencode(query_params)}'
|
5931
6133
|
# TODO: remove the hack that pops config.
|
5932
6134
|
request_dict.pop('config', None)
|
5933
6135
|
|
5934
|
-
http_options = None
|
6136
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5935
6137
|
if isinstance(config, dict):
|
5936
6138
|
http_options = config.get('http_options', None)
|
5937
|
-
elif hasattr(config, 'http_options'):
|
6139
|
+
elif hasattr(config, 'http_options') and config is not None:
|
5938
6140
|
http_options = config.http_options
|
5939
6141
|
|
5940
6142
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -5950,7 +6152,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5950
6152
|
response_dict = _Model_from_mldev(self._api_client, response_dict)
|
5951
6153
|
|
5952
6154
|
return_value = types.Model._from_response(
|
5953
|
-
response=response_dict, kwargs=parameter_model
|
6155
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5954
6156
|
)
|
5955
6157
|
self._api_client._verify_response(return_value)
|
5956
6158
|
return return_value
|
@@ -5962,26 +6164,36 @@ class AsyncModels(_api_module.BaseModule):
|
|
5962
6164
|
config=config,
|
5963
6165
|
)
|
5964
6166
|
|
6167
|
+
request_url_dict: Optional[dict[str, str]]
|
6168
|
+
|
5965
6169
|
if self._api_client.vertexai:
|
5966
6170
|
request_dict = _ListModelsParameters_to_vertex(
|
5967
6171
|
self._api_client, parameter_model
|
5968
6172
|
)
|
5969
|
-
|
6173
|
+
request_url_dict = request_dict.get('_url')
|
6174
|
+
if request_url_dict:
|
6175
|
+
path = '{models_url}'.format_map(request_url_dict)
|
6176
|
+
else:
|
6177
|
+
path = '{models_url}'
|
5970
6178
|
else:
|
5971
6179
|
request_dict = _ListModelsParameters_to_mldev(
|
5972
6180
|
self._api_client, parameter_model
|
5973
6181
|
)
|
5974
|
-
|
6182
|
+
request_url_dict = request_dict.get('_url')
|
6183
|
+
if request_url_dict:
|
6184
|
+
path = '{models_url}'.format_map(request_url_dict)
|
6185
|
+
else:
|
6186
|
+
path = '{models_url}'
|
5975
6187
|
query_params = request_dict.get('_query')
|
5976
6188
|
if query_params:
|
5977
6189
|
path = f'{path}?{urlencode(query_params)}'
|
5978
6190
|
# TODO: remove the hack that pops config.
|
5979
6191
|
request_dict.pop('config', None)
|
5980
6192
|
|
5981
|
-
http_options = None
|
6193
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5982
6194
|
if isinstance(config, dict):
|
5983
6195
|
http_options = config.get('http_options', None)
|
5984
|
-
elif hasattr(config, 'http_options'):
|
6196
|
+
elif hasattr(config, 'http_options') and config is not None:
|
5985
6197
|
http_options = config.http_options
|
5986
6198
|
|
5987
6199
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -6001,7 +6213,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6001
6213
|
)
|
6002
6214
|
|
6003
6215
|
return_value = types.ListModelsResponse._from_response(
|
6004
|
-
response=response_dict, kwargs=parameter_model
|
6216
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
6005
6217
|
)
|
6006
6218
|
self._api_client._verify_response(return_value)
|
6007
6219
|
return return_value
|
@@ -6017,26 +6229,36 @@ class AsyncModels(_api_module.BaseModule):
|
|
6017
6229
|
config=config,
|
6018
6230
|
)
|
6019
6231
|
|
6232
|
+
request_url_dict: Optional[dict[str, str]]
|
6233
|
+
|
6020
6234
|
if self._api_client.vertexai:
|
6021
6235
|
request_dict = _UpdateModelParameters_to_vertex(
|
6022
6236
|
self._api_client, parameter_model
|
6023
6237
|
)
|
6024
|
-
|
6238
|
+
request_url_dict = request_dict.get('_url')
|
6239
|
+
if request_url_dict:
|
6240
|
+
path = '{model}'.format_map(request_url_dict)
|
6241
|
+
else:
|
6242
|
+
path = '{model}'
|
6025
6243
|
else:
|
6026
6244
|
request_dict = _UpdateModelParameters_to_mldev(
|
6027
6245
|
self._api_client, parameter_model
|
6028
6246
|
)
|
6029
|
-
|
6247
|
+
request_url_dict = request_dict.get('_url')
|
6248
|
+
if request_url_dict:
|
6249
|
+
path = '{name}'.format_map(request_url_dict)
|
6250
|
+
else:
|
6251
|
+
path = '{name}'
|
6030
6252
|
query_params = request_dict.get('_query')
|
6031
6253
|
if query_params:
|
6032
6254
|
path = f'{path}?{urlencode(query_params)}'
|
6033
6255
|
# TODO: remove the hack that pops config.
|
6034
6256
|
request_dict.pop('config', None)
|
6035
6257
|
|
6036
|
-
http_options = None
|
6258
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
6037
6259
|
if isinstance(config, dict):
|
6038
6260
|
http_options = config.get('http_options', None)
|
6039
|
-
elif hasattr(config, 'http_options'):
|
6261
|
+
elif hasattr(config, 'http_options') and config is not None:
|
6040
6262
|
http_options = config.http_options
|
6041
6263
|
|
6042
6264
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -6052,7 +6274,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6052
6274
|
response_dict = _Model_from_mldev(self._api_client, response_dict)
|
6053
6275
|
|
6054
6276
|
return_value = types.Model._from_response(
|
6055
|
-
response=response_dict, kwargs=parameter_model
|
6277
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
6056
6278
|
)
|
6057
6279
|
self._api_client._verify_response(return_value)
|
6058
6280
|
return return_value
|
@@ -6068,26 +6290,36 @@ class AsyncModels(_api_module.BaseModule):
|
|
6068
6290
|
config=config,
|
6069
6291
|
)
|
6070
6292
|
|
6293
|
+
request_url_dict: Optional[dict[str, str]]
|
6294
|
+
|
6071
6295
|
if self._api_client.vertexai:
|
6072
6296
|
request_dict = _DeleteModelParameters_to_vertex(
|
6073
6297
|
self._api_client, parameter_model
|
6074
6298
|
)
|
6075
|
-
|
6299
|
+
request_url_dict = request_dict.get('_url')
|
6300
|
+
if request_url_dict:
|
6301
|
+
path = '{name}'.format_map(request_url_dict)
|
6302
|
+
else:
|
6303
|
+
path = '{name}'
|
6076
6304
|
else:
|
6077
6305
|
request_dict = _DeleteModelParameters_to_mldev(
|
6078
6306
|
self._api_client, parameter_model
|
6079
6307
|
)
|
6080
|
-
|
6308
|
+
request_url_dict = request_dict.get('_url')
|
6309
|
+
if request_url_dict:
|
6310
|
+
path = '{name}'.format_map(request_url_dict)
|
6311
|
+
else:
|
6312
|
+
path = '{name}'
|
6081
6313
|
query_params = request_dict.get('_query')
|
6082
6314
|
if query_params:
|
6083
6315
|
path = f'{path}?{urlencode(query_params)}'
|
6084
6316
|
# TODO: remove the hack that pops config.
|
6085
6317
|
request_dict.pop('config', None)
|
6086
6318
|
|
6087
|
-
http_options = None
|
6319
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
6088
6320
|
if isinstance(config, dict):
|
6089
6321
|
http_options = config.get('http_options', None)
|
6090
|
-
elif hasattr(config, 'http_options'):
|
6322
|
+
elif hasattr(config, 'http_options') and config is not None:
|
6091
6323
|
http_options = config.http_options
|
6092
6324
|
|
6093
6325
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -6107,7 +6339,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6107
6339
|
)
|
6108
6340
|
|
6109
6341
|
return_value = types.DeleteModelResponse._from_response(
|
6110
|
-
response=response_dict, kwargs=parameter_model
|
6342
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
6111
6343
|
)
|
6112
6344
|
self._api_client._verify_response(return_value)
|
6113
6345
|
return return_value
|
@@ -6146,26 +6378,36 @@ class AsyncModels(_api_module.BaseModule):
|
|
6146
6378
|
config=config,
|
6147
6379
|
)
|
6148
6380
|
|
6381
|
+
request_url_dict: Optional[dict[str, str]]
|
6382
|
+
|
6149
6383
|
if self._api_client.vertexai:
|
6150
6384
|
request_dict = _CountTokensParameters_to_vertex(
|
6151
6385
|
self._api_client, parameter_model
|
6152
6386
|
)
|
6153
|
-
|
6387
|
+
request_url_dict = request_dict.get('_url')
|
6388
|
+
if request_url_dict:
|
6389
|
+
path = '{model}:countTokens'.format_map(request_url_dict)
|
6390
|
+
else:
|
6391
|
+
path = '{model}:countTokens'
|
6154
6392
|
else:
|
6155
6393
|
request_dict = _CountTokensParameters_to_mldev(
|
6156
6394
|
self._api_client, parameter_model
|
6157
6395
|
)
|
6158
|
-
|
6396
|
+
request_url_dict = request_dict.get('_url')
|
6397
|
+
if request_url_dict:
|
6398
|
+
path = '{model}:countTokens'.format_map(request_url_dict)
|
6399
|
+
else:
|
6400
|
+
path = '{model}:countTokens'
|
6159
6401
|
query_params = request_dict.get('_query')
|
6160
6402
|
if query_params:
|
6161
6403
|
path = f'{path}?{urlencode(query_params)}'
|
6162
6404
|
# TODO: remove the hack that pops config.
|
6163
6405
|
request_dict.pop('config', None)
|
6164
6406
|
|
6165
|
-
http_options = None
|
6407
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
6166
6408
|
if isinstance(config, dict):
|
6167
6409
|
http_options = config.get('http_options', None)
|
6168
|
-
elif hasattr(config, 'http_options'):
|
6410
|
+
elif hasattr(config, 'http_options') and config is not None:
|
6169
6411
|
http_options = config.http_options
|
6170
6412
|
|
6171
6413
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -6185,7 +6427,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6185
6427
|
)
|
6186
6428
|
|
6187
6429
|
return_value = types.CountTokensResponse._from_response(
|
6188
|
-
response=response_dict, kwargs=parameter_model
|
6430
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
6189
6431
|
)
|
6190
6432
|
self._api_client._verify_response(return_value)
|
6191
6433
|
return return_value
|
@@ -6226,13 +6468,18 @@ class AsyncModels(_api_module.BaseModule):
|
|
6226
6468
|
config=config,
|
6227
6469
|
)
|
6228
6470
|
|
6471
|
+
request_url_dict: Optional[dict[str, str]]
|
6229
6472
|
if not self._api_client.vertexai:
|
6230
6473
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
6231
6474
|
else:
|
6232
6475
|
request_dict = _ComputeTokensParameters_to_vertex(
|
6233
6476
|
self._api_client, parameter_model
|
6234
6477
|
)
|
6235
|
-
|
6478
|
+
request_url_dict = request_dict.get('_url')
|
6479
|
+
if request_url_dict:
|
6480
|
+
path = '{model}:computeTokens'.format_map(request_url_dict)
|
6481
|
+
else:
|
6482
|
+
path = '{model}:computeTokens'
|
6236
6483
|
|
6237
6484
|
query_params = request_dict.get('_query')
|
6238
6485
|
if query_params:
|
@@ -6240,10 +6487,10 @@ class AsyncModels(_api_module.BaseModule):
|
|
6240
6487
|
# TODO: remove the hack that pops config.
|
6241
6488
|
request_dict.pop('config', None)
|
6242
6489
|
|
6243
|
-
http_options = None
|
6490
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
6244
6491
|
if isinstance(config, dict):
|
6245
6492
|
http_options = config.get('http_options', None)
|
6246
|
-
elif hasattr(config, 'http_options'):
|
6493
|
+
elif hasattr(config, 'http_options') and config is not None:
|
6247
6494
|
http_options = config.http_options
|
6248
6495
|
|
6249
6496
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -6263,7 +6510,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6263
6510
|
)
|
6264
6511
|
|
6265
6512
|
return_value = types.ComputeTokensResponse._from_response(
|
6266
|
-
response=response_dict, kwargs=parameter_model
|
6513
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
6267
6514
|
)
|
6268
6515
|
self._api_client._verify_response(return_value)
|
6269
6516
|
return return_value
|
@@ -6276,6 +6523,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6276
6523
|
*,
|
6277
6524
|
model: str,
|
6278
6525
|
prompt: Optional[str] = None,
|
6526
|
+
image: Optional[types.ImageOrDict] = None,
|
6279
6527
|
config: Optional[types.GenerateVideosConfigOrDict] = None,
|
6280
6528
|
) -> types.GenerateVideosOperation:
|
6281
6529
|
"""Generates videos based on a text description and configuration.
|
@@ -6303,29 +6551,40 @@ class AsyncModels(_api_module.BaseModule):
|
|
6303
6551
|
parameter_model = types._GenerateVideosParameters(
|
6304
6552
|
model=model,
|
6305
6553
|
prompt=prompt,
|
6554
|
+
image=image,
|
6306
6555
|
config=config,
|
6307
6556
|
)
|
6308
6557
|
|
6558
|
+
request_url_dict: Optional[dict[str, str]]
|
6559
|
+
|
6309
6560
|
if self._api_client.vertexai:
|
6310
6561
|
request_dict = _GenerateVideosParameters_to_vertex(
|
6311
6562
|
self._api_client, parameter_model
|
6312
6563
|
)
|
6313
|
-
|
6564
|
+
request_url_dict = request_dict.get('_url')
|
6565
|
+
if request_url_dict:
|
6566
|
+
path = '{model}:predictLongRunning'.format_map(request_url_dict)
|
6567
|
+
else:
|
6568
|
+
path = '{model}:predictLongRunning'
|
6314
6569
|
else:
|
6315
6570
|
request_dict = _GenerateVideosParameters_to_mldev(
|
6316
6571
|
self._api_client, parameter_model
|
6317
6572
|
)
|
6318
|
-
|
6573
|
+
request_url_dict = request_dict.get('_url')
|
6574
|
+
if request_url_dict:
|
6575
|
+
path = '{model}:predictLongRunning'.format_map(request_url_dict)
|
6576
|
+
else:
|
6577
|
+
path = '{model}:predictLongRunning'
|
6319
6578
|
query_params = request_dict.get('_query')
|
6320
6579
|
if query_params:
|
6321
6580
|
path = f'{path}?{urlencode(query_params)}'
|
6322
6581
|
# TODO: remove the hack that pops config.
|
6323
6582
|
request_dict.pop('config', None)
|
6324
6583
|
|
6325
|
-
http_options = None
|
6584
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
6326
6585
|
if isinstance(config, dict):
|
6327
6586
|
http_options = config.get('http_options', None)
|
6328
|
-
elif hasattr(config, 'http_options'):
|
6587
|
+
elif hasattr(config, 'http_options') and config is not None:
|
6329
6588
|
http_options = config.http_options
|
6330
6589
|
|
6331
6590
|
request_dict = _common.convert_to_dict(request_dict)
|
@@ -6345,7 +6604,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6345
6604
|
)
|
6346
6605
|
|
6347
6606
|
return_value = types.GenerateVideosOperation._from_response(
|
6348
|
-
response=response_dict, kwargs=parameter_model
|
6607
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
6349
6608
|
)
|
6350
6609
|
self._api_client._verify_response(return_value)
|
6351
6610
|
return return_value
|
@@ -6394,8 +6653,8 @@ class AsyncModels(_api_module.BaseModule):
|
|
6394
6653
|
logger.info(
|
6395
6654
|
f'AFC is enabled with max remote calls: {remaining_remote_calls_afc}.'
|
6396
6655
|
)
|
6397
|
-
automatic_function_calling_history = []
|
6398
|
-
response =
|
6656
|
+
automatic_function_calling_history: list[types.Content] = []
|
6657
|
+
response = types.GenerateContentResponse()
|
6399
6658
|
while remaining_remote_calls_afc > 0:
|
6400
6659
|
response = await self._generate_content(
|
6401
6660
|
model=model, contents=contents, config=config
|
@@ -6428,12 +6687,13 @@ class AsyncModels(_api_module.BaseModule):
|
|
6428
6687
|
contents = t.t_contents(self._api_client, contents)
|
6429
6688
|
if not automatic_function_calling_history:
|
6430
6689
|
automatic_function_calling_history.extend(contents)
|
6431
|
-
contents
|
6432
|
-
|
6690
|
+
if isinstance(contents, list):
|
6691
|
+
contents.append(func_call_content)
|
6692
|
+
contents.append(func_response_content)
|
6433
6693
|
automatic_function_calling_history.append(func_call_content)
|
6434
6694
|
automatic_function_calling_history.append(func_response_content)
|
6435
6695
|
|
6436
|
-
if _extra_utils.should_append_afc_history(config):
|
6696
|
+
if _extra_utils.should_append_afc_history(config) and response is not None:
|
6437
6697
|
response.automatic_function_calling_history = (
|
6438
6698
|
automatic_function_calling_history
|
6439
6699
|
)
|
@@ -6519,7 +6779,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6519
6779
|
logger.info(
|
6520
6780
|
f'AFC is enabled with max remote calls: {remaining_remote_calls_afc}.'
|
6521
6781
|
)
|
6522
|
-
automatic_function_calling_history = []
|
6782
|
+
automatic_function_calling_history: list[types.Content] = []
|
6523
6783
|
func_response_parts = None
|
6524
6784
|
chunk = None
|
6525
6785
|
i = 0
|
@@ -6590,8 +6850,9 @@ class AsyncModels(_api_module.BaseModule):
|
|
6590
6850
|
contents = t.t_contents(self._api_client, contents)
|
6591
6851
|
if not automatic_function_calling_history:
|
6592
6852
|
automatic_function_calling_history.extend(contents)
|
6593
|
-
contents
|
6594
|
-
|
6853
|
+
if isinstance(contents, list):
|
6854
|
+
contents.append(func_call_content)
|
6855
|
+
contents.append(func_response_content)
|
6595
6856
|
automatic_function_calling_history.append(func_call_content)
|
6596
6857
|
automatic_function_calling_history.append(func_response_content)
|
6597
6858
|
|