google-genai 1.3.0__py3-none-any.whl → 1.4.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 +30 -26
- google/genai/_api_module.py +1 -1
- google/genai/_automatic_function_calling_util.py +12 -12
- google/genai/_common.py +2 -2
- google/genai/_extra_utils.py +7 -6
- google/genai/_replay_api_client.py +3 -2
- google/genai/_test_api_client.py +8 -8
- google/genai/_transformers.py +158 -47
- google/genai/batches.py +170 -124
- google/genai/caches.py +306 -206
- google/genai/chats.py +179 -35
- google/genai/client.py +3 -3
- google/genai/errors.py +1 -2
- google/genai/files.py +153 -110
- google/genai/live.py +73 -64
- google/genai/models.py +828 -591
- google/genai/operations.py +86 -56
- google/genai/pagers.py +5 -5
- google/genai/tunings.py +163 -103
- google/genai/types.py +174 -157
- google/genai/version.py +1 -1
- {google_genai-1.3.0.dist-info → google_genai-1.4.0.dist-info}/METADATA +7 -1
- google_genai-1.4.0.dist-info/RECORD +27 -0
- {google_genai-1.3.0.dist-info → google_genai-1.4.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.4.0.dist-info}/LICENSE +0 -0
- {google_genai-1.3.0.dist-info → google_genai-1.4.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(
|
@@ -2853,11 +2854,11 @@ def _GenerateVideosConfig_to_mldev(
|
|
2853
2854
|
|
2854
2855
|
|
2855
2856
|
def _GenerateVideosConfig_to_vertex(
|
2856
|
-
api_client:
|
2857
|
+
api_client: BaseApiClient,
|
2857
2858
|
from_object: Union[dict, object],
|
2858
|
-
parent_object: dict = None,
|
2859
|
+
parent_object: Optional[dict] = None,
|
2859
2860
|
) -> dict:
|
2860
|
-
to_object = {}
|
2861
|
+
to_object: dict[str, Any] = {}
|
2861
2862
|
|
2862
2863
|
if getv(from_object, ['number_of_videos']) is not None:
|
2863
2864
|
setv(
|
@@ -2932,11 +2933,11 @@ def _GenerateVideosConfig_to_vertex(
|
|
2932
2933
|
|
2933
2934
|
|
2934
2935
|
def _GenerateVideosParameters_to_mldev(
|
2935
|
-
api_client:
|
2936
|
+
api_client: BaseApiClient,
|
2936
2937
|
from_object: Union[dict, object],
|
2937
|
-
parent_object: dict = None,
|
2938
|
+
parent_object: Optional[dict] = None,
|
2938
2939
|
) -> dict:
|
2939
|
-
to_object = {}
|
2940
|
+
to_object: dict[str, Any] = {}
|
2940
2941
|
if getv(from_object, ['model']) is not None:
|
2941
2942
|
setv(
|
2942
2943
|
to_object,
|
@@ -2960,11 +2961,11 @@ def _GenerateVideosParameters_to_mldev(
|
|
2960
2961
|
|
2961
2962
|
|
2962
2963
|
def _GenerateVideosParameters_to_vertex(
|
2963
|
-
api_client:
|
2964
|
+
api_client: BaseApiClient,
|
2964
2965
|
from_object: Union[dict, object],
|
2965
|
-
parent_object: dict = None,
|
2966
|
+
parent_object: Optional[dict] = None,
|
2966
2967
|
) -> dict:
|
2967
|
-
to_object = {}
|
2968
|
+
to_object: dict[str, Any] = {}
|
2968
2969
|
if getv(from_object, ['model']) is not None:
|
2969
2970
|
setv(
|
2970
2971
|
to_object,
|
@@ -3043,11 +3044,11 @@ def _EditMode_to_mldev_enum_validate(enum_value: Any):
|
|
3043
3044
|
|
3044
3045
|
|
3045
3046
|
def _Part_from_mldev(
|
3046
|
-
api_client:
|
3047
|
+
api_client: BaseApiClient,
|
3047
3048
|
from_object: Union[dict, object],
|
3048
|
-
parent_object: dict = None,
|
3049
|
+
parent_object: Optional[dict] = None,
|
3049
3050
|
) -> dict:
|
3050
|
-
to_object = {}
|
3051
|
+
to_object: dict[str, Any] = {}
|
3051
3052
|
|
3052
3053
|
if getv(from_object, ['thought']) is not None:
|
3053
3054
|
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
@@ -3085,11 +3086,11 @@ def _Part_from_mldev(
|
|
3085
3086
|
|
3086
3087
|
|
3087
3088
|
def _Part_from_vertex(
|
3088
|
-
api_client:
|
3089
|
+
api_client: BaseApiClient,
|
3089
3090
|
from_object: Union[dict, object],
|
3090
|
-
parent_object: dict = None,
|
3091
|
+
parent_object: Optional[dict] = None,
|
3091
3092
|
) -> dict:
|
3092
|
-
to_object = {}
|
3093
|
+
to_object: dict[str, Any] = {}
|
3093
3094
|
if getv(from_object, ['videoMetadata']) is not None:
|
3094
3095
|
setv(to_object, ['video_metadata'], getv(from_object, ['videoMetadata']))
|
3095
3096
|
|
@@ -3129,11 +3130,11 @@ def _Part_from_vertex(
|
|
3129
3130
|
|
3130
3131
|
|
3131
3132
|
def _Content_from_mldev(
|
3132
|
-
api_client:
|
3133
|
+
api_client: BaseApiClient,
|
3133
3134
|
from_object: Union[dict, object],
|
3134
|
-
parent_object: dict = None,
|
3135
|
+
parent_object: Optional[dict] = None,
|
3135
3136
|
) -> dict:
|
3136
|
-
to_object = {}
|
3137
|
+
to_object: dict[str, Any] = {}
|
3137
3138
|
if getv(from_object, ['parts']) is not None:
|
3138
3139
|
setv(
|
3139
3140
|
to_object,
|
@@ -3151,11 +3152,11 @@ def _Content_from_mldev(
|
|
3151
3152
|
|
3152
3153
|
|
3153
3154
|
def _Content_from_vertex(
|
3154
|
-
api_client:
|
3155
|
+
api_client: BaseApiClient,
|
3155
3156
|
from_object: Union[dict, object],
|
3156
|
-
parent_object: dict = None,
|
3157
|
+
parent_object: Optional[dict] = None,
|
3157
3158
|
) -> dict:
|
3158
|
-
to_object = {}
|
3159
|
+
to_object: dict[str, Any] = {}
|
3159
3160
|
if getv(from_object, ['parts']) is not None:
|
3160
3161
|
setv(
|
3161
3162
|
to_object,
|
@@ -3173,11 +3174,11 @@ def _Content_from_vertex(
|
|
3173
3174
|
|
3174
3175
|
|
3175
3176
|
def _CitationMetadata_from_mldev(
|
3176
|
-
api_client:
|
3177
|
+
api_client: BaseApiClient,
|
3177
3178
|
from_object: Union[dict, object],
|
3178
|
-
parent_object: dict = None,
|
3179
|
+
parent_object: Optional[dict] = None,
|
3179
3180
|
) -> dict:
|
3180
|
-
to_object = {}
|
3181
|
+
to_object: dict[str, Any] = {}
|
3181
3182
|
if getv(from_object, ['citationSources']) is not None:
|
3182
3183
|
setv(to_object, ['citations'], getv(from_object, ['citationSources']))
|
3183
3184
|
|
@@ -3185,11 +3186,11 @@ def _CitationMetadata_from_mldev(
|
|
3185
3186
|
|
3186
3187
|
|
3187
3188
|
def _CitationMetadata_from_vertex(
|
3188
|
-
api_client:
|
3189
|
+
api_client: BaseApiClient,
|
3189
3190
|
from_object: Union[dict, object],
|
3190
|
-
parent_object: dict = None,
|
3191
|
+
parent_object: Optional[dict] = None,
|
3191
3192
|
) -> dict:
|
3192
|
-
to_object = {}
|
3193
|
+
to_object: dict[str, Any] = {}
|
3193
3194
|
if getv(from_object, ['citations']) is not None:
|
3194
3195
|
setv(to_object, ['citations'], getv(from_object, ['citations']))
|
3195
3196
|
|
@@ -3197,11 +3198,11 @@ def _CitationMetadata_from_vertex(
|
|
3197
3198
|
|
3198
3199
|
|
3199
3200
|
def _Candidate_from_mldev(
|
3200
|
-
api_client:
|
3201
|
+
api_client: BaseApiClient,
|
3201
3202
|
from_object: Union[dict, object],
|
3202
|
-
parent_object: dict = None,
|
3203
|
+
parent_object: Optional[dict] = None,
|
3203
3204
|
) -> dict:
|
3204
|
-
to_object = {}
|
3205
|
+
to_object: dict[str, Any] = {}
|
3205
3206
|
if getv(from_object, ['content']) is not None:
|
3206
3207
|
setv(
|
3207
3208
|
to_object,
|
@@ -3249,11 +3250,11 @@ def _Candidate_from_mldev(
|
|
3249
3250
|
|
3250
3251
|
|
3251
3252
|
def _Candidate_from_vertex(
|
3252
|
-
api_client:
|
3253
|
+
api_client: BaseApiClient,
|
3253
3254
|
from_object: Union[dict, object],
|
3254
|
-
parent_object: dict = None,
|
3255
|
+
parent_object: Optional[dict] = None,
|
3255
3256
|
) -> dict:
|
3256
|
-
to_object = {}
|
3257
|
+
to_object: dict[str, Any] = {}
|
3257
3258
|
if getv(from_object, ['content']) is not None:
|
3258
3259
|
setv(
|
3259
3260
|
to_object,
|
@@ -3301,11 +3302,11 @@ def _Candidate_from_vertex(
|
|
3301
3302
|
|
3302
3303
|
|
3303
3304
|
def _GenerateContentResponse_from_mldev(
|
3304
|
-
api_client:
|
3305
|
+
api_client: BaseApiClient,
|
3305
3306
|
from_object: Union[dict, object],
|
3306
|
-
parent_object: dict = None,
|
3307
|
+
parent_object: Optional[dict] = None,
|
3307
3308
|
) -> dict:
|
3308
|
-
to_object = {}
|
3309
|
+
to_object: dict[str, Any] = {}
|
3309
3310
|
if getv(from_object, ['candidates']) is not None:
|
3310
3311
|
setv(
|
3311
3312
|
to_object,
|
@@ -3329,11 +3330,11 @@ def _GenerateContentResponse_from_mldev(
|
|
3329
3330
|
|
3330
3331
|
|
3331
3332
|
def _GenerateContentResponse_from_vertex(
|
3332
|
-
api_client:
|
3333
|
+
api_client: BaseApiClient,
|
3333
3334
|
from_object: Union[dict, object],
|
3334
|
-
parent_object: dict = None,
|
3335
|
+
parent_object: Optional[dict] = None,
|
3335
3336
|
) -> dict:
|
3336
|
-
to_object = {}
|
3337
|
+
to_object: dict[str, Any] = {}
|
3337
3338
|
if getv(from_object, ['candidates']) is not None:
|
3338
3339
|
setv(
|
3339
3340
|
to_object,
|
@@ -3344,6 +3345,12 @@ def _GenerateContentResponse_from_vertex(
|
|
3344
3345
|
],
|
3345
3346
|
)
|
3346
3347
|
|
3348
|
+
if getv(from_object, ['createTime']) is not None:
|
3349
|
+
setv(to_object, ['create_time'], getv(from_object, ['createTime']))
|
3350
|
+
|
3351
|
+
if getv(from_object, ['responseId']) is not None:
|
3352
|
+
setv(to_object, ['response_id'], getv(from_object, ['responseId']))
|
3353
|
+
|
3347
3354
|
if getv(from_object, ['modelVersion']) is not None:
|
3348
3355
|
setv(to_object, ['model_version'], getv(from_object, ['modelVersion']))
|
3349
3356
|
|
@@ -3357,21 +3364,21 @@ def _GenerateContentResponse_from_vertex(
|
|
3357
3364
|
|
3358
3365
|
|
3359
3366
|
def _ContentEmbeddingStatistics_from_mldev(
|
3360
|
-
api_client:
|
3367
|
+
api_client: BaseApiClient,
|
3361
3368
|
from_object: Union[dict, object],
|
3362
|
-
parent_object: dict = None,
|
3369
|
+
parent_object: Optional[dict] = None,
|
3363
3370
|
) -> dict:
|
3364
|
-
to_object = {}
|
3371
|
+
to_object: dict[str, Any] = {}
|
3365
3372
|
|
3366
3373
|
return to_object
|
3367
3374
|
|
3368
3375
|
|
3369
3376
|
def _ContentEmbeddingStatistics_from_vertex(
|
3370
|
-
api_client:
|
3377
|
+
api_client: BaseApiClient,
|
3371
3378
|
from_object: Union[dict, object],
|
3372
|
-
parent_object: dict = None,
|
3379
|
+
parent_object: Optional[dict] = None,
|
3373
3380
|
) -> dict:
|
3374
|
-
to_object = {}
|
3381
|
+
to_object: dict[str, Any] = {}
|
3375
3382
|
if getv(from_object, ['truncated']) is not None:
|
3376
3383
|
setv(to_object, ['truncated'], getv(from_object, ['truncated']))
|
3377
3384
|
|
@@ -3382,11 +3389,11 @@ def _ContentEmbeddingStatistics_from_vertex(
|
|
3382
3389
|
|
3383
3390
|
|
3384
3391
|
def _ContentEmbedding_from_mldev(
|
3385
|
-
api_client:
|
3392
|
+
api_client: BaseApiClient,
|
3386
3393
|
from_object: Union[dict, object],
|
3387
|
-
parent_object: dict = None,
|
3394
|
+
parent_object: Optional[dict] = None,
|
3388
3395
|
) -> dict:
|
3389
|
-
to_object = {}
|
3396
|
+
to_object: dict[str, Any] = {}
|
3390
3397
|
if getv(from_object, ['values']) is not None:
|
3391
3398
|
setv(to_object, ['values'], getv(from_object, ['values']))
|
3392
3399
|
|
@@ -3394,11 +3401,11 @@ def _ContentEmbedding_from_mldev(
|
|
3394
3401
|
|
3395
3402
|
|
3396
3403
|
def _ContentEmbedding_from_vertex(
|
3397
|
-
api_client:
|
3404
|
+
api_client: BaseApiClient,
|
3398
3405
|
from_object: Union[dict, object],
|
3399
|
-
parent_object: dict = None,
|
3406
|
+
parent_object: Optional[dict] = None,
|
3400
3407
|
) -> dict:
|
3401
|
-
to_object = {}
|
3408
|
+
to_object: dict[str, Any] = {}
|
3402
3409
|
if getv(from_object, ['values']) is not None:
|
3403
3410
|
setv(to_object, ['values'], getv(from_object, ['values']))
|
3404
3411
|
|
@@ -3415,21 +3422,21 @@ def _ContentEmbedding_from_vertex(
|
|
3415
3422
|
|
3416
3423
|
|
3417
3424
|
def _EmbedContentMetadata_from_mldev(
|
3418
|
-
api_client:
|
3425
|
+
api_client: BaseApiClient,
|
3419
3426
|
from_object: Union[dict, object],
|
3420
|
-
parent_object: dict = None,
|
3427
|
+
parent_object: Optional[dict] = None,
|
3421
3428
|
) -> dict:
|
3422
|
-
to_object = {}
|
3429
|
+
to_object: dict[str, Any] = {}
|
3423
3430
|
|
3424
3431
|
return to_object
|
3425
3432
|
|
3426
3433
|
|
3427
3434
|
def _EmbedContentMetadata_from_vertex(
|
3428
|
-
api_client:
|
3435
|
+
api_client: BaseApiClient,
|
3429
3436
|
from_object: Union[dict, object],
|
3430
|
-
parent_object: dict = None,
|
3437
|
+
parent_object: Optional[dict] = None,
|
3431
3438
|
) -> dict:
|
3432
|
-
to_object = {}
|
3439
|
+
to_object: dict[str, Any] = {}
|
3433
3440
|
if getv(from_object, ['billableCharacterCount']) is not None:
|
3434
3441
|
setv(
|
3435
3442
|
to_object,
|
@@ -3441,11 +3448,11 @@ def _EmbedContentMetadata_from_vertex(
|
|
3441
3448
|
|
3442
3449
|
|
3443
3450
|
def _EmbedContentResponse_from_mldev(
|
3444
|
-
api_client:
|
3451
|
+
api_client: BaseApiClient,
|
3445
3452
|
from_object: Union[dict, object],
|
3446
|
-
parent_object: dict = None,
|
3453
|
+
parent_object: Optional[dict] = None,
|
3447
3454
|
) -> dict:
|
3448
|
-
to_object = {}
|
3455
|
+
to_object: dict[str, Any] = {}
|
3449
3456
|
if getv(from_object, ['embeddings']) is not None:
|
3450
3457
|
setv(
|
3451
3458
|
to_object,
|
@@ -3469,11 +3476,11 @@ def _EmbedContentResponse_from_mldev(
|
|
3469
3476
|
|
3470
3477
|
|
3471
3478
|
def _EmbedContentResponse_from_vertex(
|
3472
|
-
api_client:
|
3479
|
+
api_client: BaseApiClient,
|
3473
3480
|
from_object: Union[dict, object],
|
3474
|
-
parent_object: dict = None,
|
3481
|
+
parent_object: Optional[dict] = None,
|
3475
3482
|
) -> dict:
|
3476
|
-
to_object = {}
|
3483
|
+
to_object: dict[str, Any] = {}
|
3477
3484
|
if getv(from_object, ['predictions[]', 'embeddings']) is not None:
|
3478
3485
|
setv(
|
3479
3486
|
to_object,
|
@@ -3497,11 +3504,11 @@ def _EmbedContentResponse_from_vertex(
|
|
3497
3504
|
|
3498
3505
|
|
3499
3506
|
def _Image_from_mldev(
|
3500
|
-
api_client:
|
3507
|
+
api_client: BaseApiClient,
|
3501
3508
|
from_object: Union[dict, object],
|
3502
|
-
parent_object: dict = None,
|
3509
|
+
parent_object: Optional[dict] = None,
|
3503
3510
|
) -> dict:
|
3504
|
-
to_object = {}
|
3511
|
+
to_object: dict[str, Any] = {}
|
3505
3512
|
|
3506
3513
|
if getv(from_object, ['bytesBase64Encoded']) is not None:
|
3507
3514
|
setv(
|
@@ -3517,11 +3524,11 @@ def _Image_from_mldev(
|
|
3517
3524
|
|
3518
3525
|
|
3519
3526
|
def _Image_from_vertex(
|
3520
|
-
api_client:
|
3527
|
+
api_client: BaseApiClient,
|
3521
3528
|
from_object: Union[dict, object],
|
3522
|
-
parent_object: dict = None,
|
3529
|
+
parent_object: Optional[dict] = None,
|
3523
3530
|
) -> dict:
|
3524
|
-
to_object = {}
|
3531
|
+
to_object: dict[str, Any] = {}
|
3525
3532
|
if getv(from_object, ['gcsUri']) is not None:
|
3526
3533
|
setv(to_object, ['gcs_uri'], getv(from_object, ['gcsUri']))
|
3527
3534
|
|
@@ -3539,11 +3546,11 @@ def _Image_from_vertex(
|
|
3539
3546
|
|
3540
3547
|
|
3541
3548
|
def _GeneratedImage_from_mldev(
|
3542
|
-
api_client:
|
3549
|
+
api_client: BaseApiClient,
|
3543
3550
|
from_object: Union[dict, object],
|
3544
|
-
parent_object: dict = None,
|
3551
|
+
parent_object: Optional[dict] = None,
|
3545
3552
|
) -> dict:
|
3546
|
-
to_object = {}
|
3553
|
+
to_object: dict[str, Any] = {}
|
3547
3554
|
if getv(from_object, ['_self']) is not None:
|
3548
3555
|
setv(
|
3549
3556
|
to_object,
|
@@ -3562,11 +3569,11 @@ def _GeneratedImage_from_mldev(
|
|
3562
3569
|
|
3563
3570
|
|
3564
3571
|
def _GeneratedImage_from_vertex(
|
3565
|
-
api_client:
|
3572
|
+
api_client: BaseApiClient,
|
3566
3573
|
from_object: Union[dict, object],
|
3567
|
-
parent_object: dict = None,
|
3574
|
+
parent_object: Optional[dict] = None,
|
3568
3575
|
) -> dict:
|
3569
|
-
to_object = {}
|
3576
|
+
to_object: dict[str, Any] = {}
|
3570
3577
|
if getv(from_object, ['_self']) is not None:
|
3571
3578
|
setv(
|
3572
3579
|
to_object,
|
@@ -3588,11 +3595,11 @@ def _GeneratedImage_from_vertex(
|
|
3588
3595
|
|
3589
3596
|
|
3590
3597
|
def _GenerateImagesResponse_from_mldev(
|
3591
|
-
api_client:
|
3598
|
+
api_client: BaseApiClient,
|
3592
3599
|
from_object: Union[dict, object],
|
3593
|
-
parent_object: dict = None,
|
3600
|
+
parent_object: Optional[dict] = None,
|
3594
3601
|
) -> dict:
|
3595
|
-
to_object = {}
|
3602
|
+
to_object: dict[str, Any] = {}
|
3596
3603
|
if getv(from_object, ['predictions']) is not None:
|
3597
3604
|
setv(
|
3598
3605
|
to_object,
|
@@ -3607,11 +3614,11 @@ def _GenerateImagesResponse_from_mldev(
|
|
3607
3614
|
|
3608
3615
|
|
3609
3616
|
def _GenerateImagesResponse_from_vertex(
|
3610
|
-
api_client:
|
3617
|
+
api_client: BaseApiClient,
|
3611
3618
|
from_object: Union[dict, object],
|
3612
|
-
parent_object: dict = None,
|
3619
|
+
parent_object: Optional[dict] = None,
|
3613
3620
|
) -> dict:
|
3614
|
-
to_object = {}
|
3621
|
+
to_object: dict[str, Any] = {}
|
3615
3622
|
if getv(from_object, ['predictions']) is not None:
|
3616
3623
|
setv(
|
3617
3624
|
to_object,
|
@@ -3626,11 +3633,11 @@ def _GenerateImagesResponse_from_vertex(
|
|
3626
3633
|
|
3627
3634
|
|
3628
3635
|
def _EditImageResponse_from_mldev(
|
3629
|
-
api_client:
|
3636
|
+
api_client: BaseApiClient,
|
3630
3637
|
from_object: Union[dict, object],
|
3631
|
-
parent_object: dict = None,
|
3638
|
+
parent_object: Optional[dict] = None,
|
3632
3639
|
) -> dict:
|
3633
|
-
to_object = {}
|
3640
|
+
to_object: dict[str, Any] = {}
|
3634
3641
|
if getv(from_object, ['predictions']) is not None:
|
3635
3642
|
setv(
|
3636
3643
|
to_object,
|
@@ -3645,11 +3652,11 @@ def _EditImageResponse_from_mldev(
|
|
3645
3652
|
|
3646
3653
|
|
3647
3654
|
def _EditImageResponse_from_vertex(
|
3648
|
-
api_client:
|
3655
|
+
api_client: BaseApiClient,
|
3649
3656
|
from_object: Union[dict, object],
|
3650
|
-
parent_object: dict = None,
|
3657
|
+
parent_object: Optional[dict] = None,
|
3651
3658
|
) -> dict:
|
3652
|
-
to_object = {}
|
3659
|
+
to_object: dict[str, Any] = {}
|
3653
3660
|
if getv(from_object, ['predictions']) is not None:
|
3654
3661
|
setv(
|
3655
3662
|
to_object,
|
@@ -3664,11 +3671,11 @@ def _EditImageResponse_from_vertex(
|
|
3664
3671
|
|
3665
3672
|
|
3666
3673
|
def _UpscaleImageResponse_from_mldev(
|
3667
|
-
api_client:
|
3674
|
+
api_client: BaseApiClient,
|
3668
3675
|
from_object: Union[dict, object],
|
3669
|
-
parent_object: dict = None,
|
3676
|
+
parent_object: Optional[dict] = None,
|
3670
3677
|
) -> dict:
|
3671
|
-
to_object = {}
|
3678
|
+
to_object: dict[str, Any] = {}
|
3672
3679
|
if getv(from_object, ['predictions']) is not None:
|
3673
3680
|
setv(
|
3674
3681
|
to_object,
|
@@ -3683,11 +3690,11 @@ def _UpscaleImageResponse_from_mldev(
|
|
3683
3690
|
|
3684
3691
|
|
3685
3692
|
def _UpscaleImageResponse_from_vertex(
|
3686
|
-
api_client:
|
3693
|
+
api_client: BaseApiClient,
|
3687
3694
|
from_object: Union[dict, object],
|
3688
|
-
parent_object: dict = None,
|
3695
|
+
parent_object: Optional[dict] = None,
|
3689
3696
|
) -> dict:
|
3690
|
-
to_object = {}
|
3697
|
+
to_object: dict[str, Any] = {}
|
3691
3698
|
if getv(from_object, ['predictions']) is not None:
|
3692
3699
|
setv(
|
3693
3700
|
to_object,
|
@@ -3702,21 +3709,21 @@ def _UpscaleImageResponse_from_vertex(
|
|
3702
3709
|
|
3703
3710
|
|
3704
3711
|
def _Endpoint_from_mldev(
|
3705
|
-
api_client:
|
3712
|
+
api_client: BaseApiClient,
|
3706
3713
|
from_object: Union[dict, object],
|
3707
|
-
parent_object: dict = None,
|
3714
|
+
parent_object: Optional[dict] = None,
|
3708
3715
|
) -> dict:
|
3709
|
-
to_object = {}
|
3716
|
+
to_object: dict[str, Any] = {}
|
3710
3717
|
|
3711
3718
|
return to_object
|
3712
3719
|
|
3713
3720
|
|
3714
3721
|
def _Endpoint_from_vertex(
|
3715
|
-
api_client:
|
3722
|
+
api_client: BaseApiClient,
|
3716
3723
|
from_object: Union[dict, object],
|
3717
|
-
parent_object: dict = None,
|
3724
|
+
parent_object: Optional[dict] = None,
|
3718
3725
|
) -> dict:
|
3719
|
-
to_object = {}
|
3726
|
+
to_object: dict[str, Any] = {}
|
3720
3727
|
if getv(from_object, ['endpoint']) is not None:
|
3721
3728
|
setv(to_object, ['name'], getv(from_object, ['endpoint']))
|
3722
3729
|
|
@@ -3729,11 +3736,11 @@ def _Endpoint_from_vertex(
|
|
3729
3736
|
|
3730
3737
|
|
3731
3738
|
def _TunedModelInfo_from_mldev(
|
3732
|
-
api_client:
|
3739
|
+
api_client: BaseApiClient,
|
3733
3740
|
from_object: Union[dict, object],
|
3734
|
-
parent_object: dict = None,
|
3741
|
+
parent_object: Optional[dict] = None,
|
3735
3742
|
) -> dict:
|
3736
|
-
to_object = {}
|
3743
|
+
to_object: dict[str, Any] = {}
|
3737
3744
|
if getv(from_object, ['baseModel']) is not None:
|
3738
3745
|
setv(to_object, ['base_model'], getv(from_object, ['baseModel']))
|
3739
3746
|
|
@@ -3747,11 +3754,11 @@ def _TunedModelInfo_from_mldev(
|
|
3747
3754
|
|
3748
3755
|
|
3749
3756
|
def _TunedModelInfo_from_vertex(
|
3750
|
-
api_client:
|
3757
|
+
api_client: BaseApiClient,
|
3751
3758
|
from_object: Union[dict, object],
|
3752
|
-
parent_object: dict = None,
|
3759
|
+
parent_object: Optional[dict] = None,
|
3753
3760
|
) -> dict:
|
3754
|
-
to_object = {}
|
3761
|
+
to_object: dict[str, Any] = {}
|
3755
3762
|
if (
|
3756
3763
|
getv(from_object, ['labels', 'google-vertex-llm-tuning-base-model-id'])
|
3757
3764
|
is not None
|
@@ -3772,11 +3779,11 @@ def _TunedModelInfo_from_vertex(
|
|
3772
3779
|
|
3773
3780
|
|
3774
3781
|
def _Model_from_mldev(
|
3775
|
-
api_client:
|
3782
|
+
api_client: BaseApiClient,
|
3776
3783
|
from_object: Union[dict, object],
|
3777
|
-
parent_object: dict = None,
|
3784
|
+
parent_object: Optional[dict] = None,
|
3778
3785
|
) -> dict:
|
3779
|
-
to_object = {}
|
3786
|
+
to_object: dict[str, Any] = {}
|
3780
3787
|
if getv(from_object, ['name']) is not None:
|
3781
3788
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
3782
3789
|
|
@@ -3821,11 +3828,11 @@ def _Model_from_mldev(
|
|
3821
3828
|
|
3822
3829
|
|
3823
3830
|
def _Model_from_vertex(
|
3824
|
-
api_client:
|
3831
|
+
api_client: BaseApiClient,
|
3825
3832
|
from_object: Union[dict, object],
|
3826
|
-
parent_object: dict = None,
|
3833
|
+
parent_object: Optional[dict] = None,
|
3827
3834
|
) -> dict:
|
3828
|
-
to_object = {}
|
3835
|
+
to_object: dict[str, Any] = {}
|
3829
3836
|
if getv(from_object, ['name']) is not None:
|
3830
3837
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
3831
3838
|
|
@@ -3864,11 +3871,11 @@ def _Model_from_vertex(
|
|
3864
3871
|
|
3865
3872
|
|
3866
3873
|
def _ListModelsResponse_from_mldev(
|
3867
|
-
api_client:
|
3874
|
+
api_client: BaseApiClient,
|
3868
3875
|
from_object: Union[dict, object],
|
3869
|
-
parent_object: dict = None,
|
3876
|
+
parent_object: Optional[dict] = None,
|
3870
3877
|
) -> dict:
|
3871
|
-
to_object = {}
|
3878
|
+
to_object: dict[str, Any] = {}
|
3872
3879
|
if getv(from_object, ['nextPageToken']) is not None:
|
3873
3880
|
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
3874
3881
|
|
@@ -3888,11 +3895,11 @@ def _ListModelsResponse_from_mldev(
|
|
3888
3895
|
|
3889
3896
|
|
3890
3897
|
def _ListModelsResponse_from_vertex(
|
3891
|
-
api_client:
|
3898
|
+
api_client: BaseApiClient,
|
3892
3899
|
from_object: Union[dict, object],
|
3893
|
-
parent_object: dict = None,
|
3900
|
+
parent_object: Optional[dict] = None,
|
3894
3901
|
) -> dict:
|
3895
|
-
to_object = {}
|
3902
|
+
to_object: dict[str, Any] = {}
|
3896
3903
|
if getv(from_object, ['nextPageToken']) is not None:
|
3897
3904
|
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
3898
3905
|
|
@@ -3912,31 +3919,31 @@ def _ListModelsResponse_from_vertex(
|
|
3912
3919
|
|
3913
3920
|
|
3914
3921
|
def _DeleteModelResponse_from_mldev(
|
3915
|
-
api_client:
|
3922
|
+
api_client: BaseApiClient,
|
3916
3923
|
from_object: Union[dict, object],
|
3917
|
-
parent_object: dict = None,
|
3924
|
+
parent_object: Optional[dict] = None,
|
3918
3925
|
) -> dict:
|
3919
|
-
to_object = {}
|
3926
|
+
to_object: dict[str, Any] = {}
|
3920
3927
|
|
3921
3928
|
return to_object
|
3922
3929
|
|
3923
3930
|
|
3924
3931
|
def _DeleteModelResponse_from_vertex(
|
3925
|
-
api_client:
|
3932
|
+
api_client: BaseApiClient,
|
3926
3933
|
from_object: Union[dict, object],
|
3927
|
-
parent_object: dict = None,
|
3934
|
+
parent_object: Optional[dict] = None,
|
3928
3935
|
) -> dict:
|
3929
|
-
to_object = {}
|
3936
|
+
to_object: dict[str, Any] = {}
|
3930
3937
|
|
3931
3938
|
return to_object
|
3932
3939
|
|
3933
3940
|
|
3934
3941
|
def _CountTokensResponse_from_mldev(
|
3935
|
-
api_client:
|
3942
|
+
api_client: BaseApiClient,
|
3936
3943
|
from_object: Union[dict, object],
|
3937
|
-
parent_object: dict = None,
|
3944
|
+
parent_object: Optional[dict] = None,
|
3938
3945
|
) -> dict:
|
3939
|
-
to_object = {}
|
3946
|
+
to_object: dict[str, Any] = {}
|
3940
3947
|
if getv(from_object, ['totalTokens']) is not None:
|
3941
3948
|
setv(to_object, ['total_tokens'], getv(from_object, ['totalTokens']))
|
3942
3949
|
|
@@ -3951,11 +3958,11 @@ def _CountTokensResponse_from_mldev(
|
|
3951
3958
|
|
3952
3959
|
|
3953
3960
|
def _CountTokensResponse_from_vertex(
|
3954
|
-
api_client:
|
3961
|
+
api_client: BaseApiClient,
|
3955
3962
|
from_object: Union[dict, object],
|
3956
|
-
parent_object: dict = None,
|
3963
|
+
parent_object: Optional[dict] = None,
|
3957
3964
|
) -> dict:
|
3958
|
-
to_object = {}
|
3965
|
+
to_object: dict[str, Any] = {}
|
3959
3966
|
if getv(from_object, ['totalTokens']) is not None:
|
3960
3967
|
setv(to_object, ['total_tokens'], getv(from_object, ['totalTokens']))
|
3961
3968
|
|
@@ -3963,11 +3970,11 @@ def _CountTokensResponse_from_vertex(
|
|
3963
3970
|
|
3964
3971
|
|
3965
3972
|
def _ComputeTokensResponse_from_mldev(
|
3966
|
-
api_client:
|
3973
|
+
api_client: BaseApiClient,
|
3967
3974
|
from_object: Union[dict, object],
|
3968
|
-
parent_object: dict = None,
|
3975
|
+
parent_object: Optional[dict] = None,
|
3969
3976
|
) -> dict:
|
3970
|
-
to_object = {}
|
3977
|
+
to_object: dict[str, Any] = {}
|
3971
3978
|
if getv(from_object, ['tokensInfo']) is not None:
|
3972
3979
|
setv(to_object, ['tokens_info'], getv(from_object, ['tokensInfo']))
|
3973
3980
|
|
@@ -3975,11 +3982,11 @@ def _ComputeTokensResponse_from_mldev(
|
|
3975
3982
|
|
3976
3983
|
|
3977
3984
|
def _ComputeTokensResponse_from_vertex(
|
3978
|
-
api_client:
|
3985
|
+
api_client: BaseApiClient,
|
3979
3986
|
from_object: Union[dict, object],
|
3980
|
-
parent_object: dict = None,
|
3987
|
+
parent_object: Optional[dict] = None,
|
3981
3988
|
) -> dict:
|
3982
|
-
to_object = {}
|
3989
|
+
to_object: dict[str, Any] = {}
|
3983
3990
|
if getv(from_object, ['tokensInfo']) is not None:
|
3984
3991
|
setv(to_object, ['tokens_info'], getv(from_object, ['tokensInfo']))
|
3985
3992
|
|
@@ -3987,11 +3994,11 @@ def _ComputeTokensResponse_from_vertex(
|
|
3987
3994
|
|
3988
3995
|
|
3989
3996
|
def _Video_from_mldev(
|
3990
|
-
api_client:
|
3997
|
+
api_client: BaseApiClient,
|
3991
3998
|
from_object: Union[dict, object],
|
3992
|
-
parent_object: dict = None,
|
3999
|
+
parent_object: Optional[dict] = None,
|
3993
4000
|
) -> dict:
|
3994
|
-
to_object = {}
|
4001
|
+
to_object: dict[str, Any] = {}
|
3995
4002
|
if getv(from_object, ['uri']) is not None:
|
3996
4003
|
setv(to_object, ['uri'], getv(from_object, ['uri']))
|
3997
4004
|
|
@@ -4009,11 +4016,11 @@ def _Video_from_mldev(
|
|
4009
4016
|
|
4010
4017
|
|
4011
4018
|
def _Video_from_vertex(
|
4012
|
-
api_client:
|
4019
|
+
api_client: BaseApiClient,
|
4013
4020
|
from_object: Union[dict, object],
|
4014
|
-
parent_object: dict = None,
|
4021
|
+
parent_object: Optional[dict] = None,
|
4015
4022
|
) -> dict:
|
4016
|
-
to_object = {}
|
4023
|
+
to_object: dict[str, Any] = {}
|
4017
4024
|
if getv(from_object, ['gcsUri']) is not None:
|
4018
4025
|
setv(to_object, ['uri'], getv(from_object, ['gcsUri']))
|
4019
4026
|
|
@@ -4031,11 +4038,11 @@ def _Video_from_vertex(
|
|
4031
4038
|
|
4032
4039
|
|
4033
4040
|
def _GeneratedVideo_from_mldev(
|
4034
|
-
api_client:
|
4041
|
+
api_client: BaseApiClient,
|
4035
4042
|
from_object: Union[dict, object],
|
4036
|
-
parent_object: dict = None,
|
4043
|
+
parent_object: Optional[dict] = None,
|
4037
4044
|
) -> dict:
|
4038
|
-
to_object = {}
|
4045
|
+
to_object: dict[str, Any] = {}
|
4039
4046
|
if getv(from_object, ['_self']) is not None:
|
4040
4047
|
setv(
|
4041
4048
|
to_object,
|
@@ -4047,11 +4054,11 @@ def _GeneratedVideo_from_mldev(
|
|
4047
4054
|
|
4048
4055
|
|
4049
4056
|
def _GeneratedVideo_from_vertex(
|
4050
|
-
api_client:
|
4057
|
+
api_client: BaseApiClient,
|
4051
4058
|
from_object: Union[dict, object],
|
4052
|
-
parent_object: dict = None,
|
4059
|
+
parent_object: Optional[dict] = None,
|
4053
4060
|
) -> dict:
|
4054
|
-
to_object = {}
|
4061
|
+
to_object: dict[str, Any] = {}
|
4055
4062
|
if getv(from_object, ['_self']) is not None:
|
4056
4063
|
setv(
|
4057
4064
|
to_object,
|
@@ -4063,11 +4070,11 @@ def _GeneratedVideo_from_vertex(
|
|
4063
4070
|
|
4064
4071
|
|
4065
4072
|
def _GenerateVideosResponse_from_mldev(
|
4066
|
-
api_client:
|
4073
|
+
api_client: BaseApiClient,
|
4067
4074
|
from_object: Union[dict, object],
|
4068
|
-
parent_object: dict = None,
|
4075
|
+
parent_object: Optional[dict] = None,
|
4069
4076
|
) -> dict:
|
4070
|
-
to_object = {}
|
4077
|
+
to_object: dict[str, Any] = {}
|
4071
4078
|
if getv(from_object, ['videos']) is not None:
|
4072
4079
|
setv(
|
4073
4080
|
to_object,
|
@@ -4096,11 +4103,11 @@ def _GenerateVideosResponse_from_mldev(
|
|
4096
4103
|
|
4097
4104
|
|
4098
4105
|
def _GenerateVideosResponse_from_vertex(
|
4099
|
-
api_client:
|
4106
|
+
api_client: BaseApiClient,
|
4100
4107
|
from_object: Union[dict, object],
|
4101
|
-
parent_object: dict = None,
|
4108
|
+
parent_object: Optional[dict] = None,
|
4102
4109
|
) -> dict:
|
4103
|
-
to_object = {}
|
4110
|
+
to_object: dict[str, Any] = {}
|
4104
4111
|
if getv(from_object, ['videos']) is not None:
|
4105
4112
|
setv(
|
4106
4113
|
to_object,
|
@@ -4129,11 +4136,11 @@ def _GenerateVideosResponse_from_vertex(
|
|
4129
4136
|
|
4130
4137
|
|
4131
4138
|
def _GenerateVideosOperation_from_mldev(
|
4132
|
-
api_client:
|
4139
|
+
api_client: BaseApiClient,
|
4133
4140
|
from_object: Union[dict, object],
|
4134
|
-
parent_object: dict = None,
|
4141
|
+
parent_object: Optional[dict] = None,
|
4135
4142
|
) -> dict:
|
4136
|
-
to_object = {}
|
4143
|
+
to_object: dict[str, Any] = {}
|
4137
4144
|
if getv(from_object, ['name']) is not None:
|
4138
4145
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
4139
4146
|
|
@@ -4164,11 +4171,11 @@ def _GenerateVideosOperation_from_mldev(
|
|
4164
4171
|
|
4165
4172
|
|
4166
4173
|
def _GenerateVideosOperation_from_vertex(
|
4167
|
-
api_client:
|
4174
|
+
api_client: BaseApiClient,
|
4168
4175
|
from_object: Union[dict, object],
|
4169
|
-
parent_object: dict = None,
|
4176
|
+
parent_object: Optional[dict] = None,
|
4170
4177
|
) -> dict:
|
4171
|
-
to_object = {}
|
4178
|
+
to_object: dict[str, Any] = {}
|
4172
4179
|
if getv(from_object, ['name']) is not None:
|
4173
4180
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
4174
4181
|
|
@@ -4211,23 +4218,33 @@ class Models(_api_module.BaseModule):
|
|
4211
4218
|
config=config,
|
4212
4219
|
)
|
4213
4220
|
|
4221
|
+
request_url_dict: Optional[dict[str, str]]
|
4222
|
+
|
4214
4223
|
if self._api_client.vertexai:
|
4215
4224
|
request_dict = _GenerateContentParameters_to_vertex(
|
4216
4225
|
self._api_client, parameter_model
|
4217
4226
|
)
|
4218
|
-
|
4227
|
+
request_url_dict = request_dict.get('_url')
|
4228
|
+
if request_url_dict:
|
4229
|
+
path = '{model}:generateContent'.format_map(request_url_dict)
|
4230
|
+
else:
|
4231
|
+
path = '{model}:generateContent'
|
4219
4232
|
else:
|
4220
4233
|
request_dict = _GenerateContentParameters_to_mldev(
|
4221
4234
|
self._api_client, parameter_model
|
4222
4235
|
)
|
4223
|
-
|
4236
|
+
request_url_dict = request_dict.get('_url')
|
4237
|
+
if request_url_dict:
|
4238
|
+
path = '{model}:generateContent'.format_map(request_url_dict)
|
4239
|
+
else:
|
4240
|
+
path = '{model}:generateContent'
|
4224
4241
|
query_params = request_dict.get('_query')
|
4225
4242
|
if query_params:
|
4226
4243
|
path = f'{path}?{urlencode(query_params)}'
|
4227
4244
|
# TODO: remove the hack that pops config.
|
4228
4245
|
request_dict.pop('config', None)
|
4229
4246
|
|
4230
|
-
http_options = None
|
4247
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4231
4248
|
if isinstance(config, dict):
|
4232
4249
|
http_options = config.get('http_options', None)
|
4233
4250
|
elif hasattr(config, 'http_options'):
|
@@ -4250,7 +4267,7 @@ class Models(_api_module.BaseModule):
|
|
4250
4267
|
)
|
4251
4268
|
|
4252
4269
|
return_value = types.GenerateContentResponse._from_response(
|
4253
|
-
response=response_dict, kwargs=parameter_model
|
4270
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4254
4271
|
)
|
4255
4272
|
self._api_client._verify_response(return_value)
|
4256
4273
|
return return_value
|
@@ -4268,27 +4285,37 @@ class Models(_api_module.BaseModule):
|
|
4268
4285
|
config=config,
|
4269
4286
|
)
|
4270
4287
|
|
4288
|
+
request_url_dict: Optional[dict[str, str]]
|
4289
|
+
|
4271
4290
|
if self._api_client.vertexai:
|
4272
4291
|
request_dict = _GenerateContentParameters_to_vertex(
|
4273
4292
|
self._api_client, parameter_model
|
4274
4293
|
)
|
4275
|
-
|
4276
|
-
|
4277
|
-
|
4294
|
+
request_url_dict = request_dict.get('_url')
|
4295
|
+
if request_url_dict:
|
4296
|
+
path = '{model}:streamGenerateContent?alt=sse'.format_map(
|
4297
|
+
request_url_dict
|
4298
|
+
)
|
4299
|
+
else:
|
4300
|
+
path = '{model}:streamGenerateContent?alt=sse'
|
4278
4301
|
else:
|
4279
4302
|
request_dict = _GenerateContentParameters_to_mldev(
|
4280
4303
|
self._api_client, parameter_model
|
4281
4304
|
)
|
4282
|
-
|
4283
|
-
|
4284
|
-
|
4305
|
+
request_url_dict = request_dict.get('_url')
|
4306
|
+
if request_url_dict:
|
4307
|
+
path = '{model}:streamGenerateContent?alt=sse'.format_map(
|
4308
|
+
request_url_dict
|
4309
|
+
)
|
4310
|
+
else:
|
4311
|
+
path = '{model}:streamGenerateContent?alt=sse'
|
4285
4312
|
query_params = request_dict.get('_query')
|
4286
4313
|
if query_params:
|
4287
4314
|
path = f'{path}?{urlencode(query_params)}'
|
4288
4315
|
# TODO: remove the hack that pops config.
|
4289
4316
|
request_dict.pop('config', None)
|
4290
4317
|
|
4291
|
-
http_options = None
|
4318
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4292
4319
|
if isinstance(config, dict):
|
4293
4320
|
http_options = config.get('http_options', None)
|
4294
4321
|
elif hasattr(config, 'http_options'):
|
@@ -4311,7 +4338,7 @@ class Models(_api_module.BaseModule):
|
|
4311
4338
|
)
|
4312
4339
|
|
4313
4340
|
return_value = types.GenerateContentResponse._from_response(
|
4314
|
-
response=response_dict, kwargs=parameter_model
|
4341
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4315
4342
|
)
|
4316
4343
|
self._api_client._verify_response(return_value)
|
4317
4344
|
yield return_value
|
@@ -4352,23 +4379,33 @@ class Models(_api_module.BaseModule):
|
|
4352
4379
|
config=config,
|
4353
4380
|
)
|
4354
4381
|
|
4382
|
+
request_url_dict: Optional[dict[str, str]]
|
4383
|
+
|
4355
4384
|
if self._api_client.vertexai:
|
4356
4385
|
request_dict = _EmbedContentParameters_to_vertex(
|
4357
4386
|
self._api_client, parameter_model
|
4358
4387
|
)
|
4359
|
-
|
4388
|
+
request_url_dict = request_dict.get('_url')
|
4389
|
+
if request_url_dict:
|
4390
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
4391
|
+
else:
|
4392
|
+
path = '{model}:predict'
|
4360
4393
|
else:
|
4361
4394
|
request_dict = _EmbedContentParameters_to_mldev(
|
4362
4395
|
self._api_client, parameter_model
|
4363
4396
|
)
|
4364
|
-
|
4397
|
+
request_url_dict = request_dict.get('_url')
|
4398
|
+
if request_url_dict:
|
4399
|
+
path = '{model}:batchEmbedContents'.format_map(request_url_dict)
|
4400
|
+
else:
|
4401
|
+
path = '{model}:batchEmbedContents'
|
4365
4402
|
query_params = request_dict.get('_query')
|
4366
4403
|
if query_params:
|
4367
4404
|
path = f'{path}?{urlencode(query_params)}'
|
4368
4405
|
# TODO: remove the hack that pops config.
|
4369
4406
|
request_dict.pop('config', None)
|
4370
4407
|
|
4371
|
-
http_options = None
|
4408
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4372
4409
|
if isinstance(config, dict):
|
4373
4410
|
http_options = config.get('http_options', None)
|
4374
4411
|
elif hasattr(config, 'http_options'):
|
@@ -4391,7 +4428,7 @@ class Models(_api_module.BaseModule):
|
|
4391
4428
|
)
|
4392
4429
|
|
4393
4430
|
return_value = types.EmbedContentResponse._from_response(
|
4394
|
-
response=response_dict, kwargs=parameter_model
|
4431
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4395
4432
|
)
|
4396
4433
|
self._api_client._verify_response(return_value)
|
4397
4434
|
return return_value
|
@@ -4432,23 +4469,33 @@ class Models(_api_module.BaseModule):
|
|
4432
4469
|
config=config,
|
4433
4470
|
)
|
4434
4471
|
|
4472
|
+
request_url_dict: Optional[dict[str, str]]
|
4473
|
+
|
4435
4474
|
if self._api_client.vertexai:
|
4436
4475
|
request_dict = _GenerateImagesParameters_to_vertex(
|
4437
4476
|
self._api_client, parameter_model
|
4438
4477
|
)
|
4439
|
-
|
4478
|
+
request_url_dict = request_dict.get('_url')
|
4479
|
+
if request_url_dict:
|
4480
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
4481
|
+
else:
|
4482
|
+
path = '{model}:predict'
|
4440
4483
|
else:
|
4441
4484
|
request_dict = _GenerateImagesParameters_to_mldev(
|
4442
4485
|
self._api_client, parameter_model
|
4443
4486
|
)
|
4444
|
-
|
4487
|
+
request_url_dict = request_dict.get('_url')
|
4488
|
+
if request_url_dict:
|
4489
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
4490
|
+
else:
|
4491
|
+
path = '{model}:predict'
|
4445
4492
|
query_params = request_dict.get('_query')
|
4446
4493
|
if query_params:
|
4447
4494
|
path = f'{path}?{urlencode(query_params)}'
|
4448
4495
|
# TODO: remove the hack that pops config.
|
4449
4496
|
request_dict.pop('config', None)
|
4450
4497
|
|
4451
|
-
http_options = None
|
4498
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4452
4499
|
if isinstance(config, dict):
|
4453
4500
|
http_options = config.get('http_options', None)
|
4454
4501
|
elif hasattr(config, 'http_options'):
|
@@ -4471,7 +4518,7 @@ class Models(_api_module.BaseModule):
|
|
4471
4518
|
)
|
4472
4519
|
|
4473
4520
|
return_value = types.GenerateImagesResponse._from_response(
|
4474
|
-
response=response_dict, kwargs=parameter_model
|
4521
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4475
4522
|
)
|
4476
4523
|
self._api_client._verify_response(return_value)
|
4477
4524
|
return return_value
|
@@ -4513,7 +4560,7 @@ class Models(_api_module.BaseModule):
|
|
4513
4560
|
),
|
4514
4561
|
)
|
4515
4562
|
response = client.models.edit_image(
|
4516
|
-
model='imagen-3.0-capability-
|
4563
|
+
model='imagen-3.0-capability-001',
|
4517
4564
|
prompt='man with dog',
|
4518
4565
|
reference_images=[raw_ref_image, mask_ref_image],
|
4519
4566
|
config=types.EditImageConfig(
|
@@ -4533,13 +4580,18 @@ class Models(_api_module.BaseModule):
|
|
4533
4580
|
config=config,
|
4534
4581
|
)
|
4535
4582
|
|
4583
|
+
request_url_dict: Optional[dict[str, str]]
|
4536
4584
|
if not self._api_client.vertexai:
|
4537
4585
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
4538
4586
|
else:
|
4539
4587
|
request_dict = _EditImageParameters_to_vertex(
|
4540
4588
|
self._api_client, parameter_model
|
4541
4589
|
)
|
4542
|
-
|
4590
|
+
request_url_dict = request_dict.get('_url')
|
4591
|
+
if request_url_dict:
|
4592
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
4593
|
+
else:
|
4594
|
+
path = '{model}:predict'
|
4543
4595
|
|
4544
4596
|
query_params = request_dict.get('_query')
|
4545
4597
|
if query_params:
|
@@ -4547,7 +4599,7 @@ class Models(_api_module.BaseModule):
|
|
4547
4599
|
# TODO: remove the hack that pops config.
|
4548
4600
|
request_dict.pop('config', None)
|
4549
4601
|
|
4550
|
-
http_options = None
|
4602
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4551
4603
|
if isinstance(config, dict):
|
4552
4604
|
http_options = config.get('http_options', None)
|
4553
4605
|
elif hasattr(config, 'http_options'):
|
@@ -4570,7 +4622,7 @@ class Models(_api_module.BaseModule):
|
|
4570
4622
|
)
|
4571
4623
|
|
4572
4624
|
return_value = types.EditImageResponse._from_response(
|
4573
|
-
response=response_dict, kwargs=parameter_model
|
4625
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4574
4626
|
)
|
4575
4627
|
self._api_client._verify_response(return_value)
|
4576
4628
|
return return_value
|
@@ -4599,13 +4651,18 @@ class Models(_api_module.BaseModule):
|
|
4599
4651
|
config=config,
|
4600
4652
|
)
|
4601
4653
|
|
4654
|
+
request_url_dict: Optional[dict[str, str]]
|
4602
4655
|
if not self._api_client.vertexai:
|
4603
4656
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
4604
4657
|
else:
|
4605
4658
|
request_dict = _UpscaleImageAPIParameters_to_vertex(
|
4606
4659
|
self._api_client, parameter_model
|
4607
4660
|
)
|
4608
|
-
|
4661
|
+
request_url_dict = request_dict.get('_url')
|
4662
|
+
if request_url_dict:
|
4663
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
4664
|
+
else:
|
4665
|
+
path = '{model}:predict'
|
4609
4666
|
|
4610
4667
|
query_params = request_dict.get('_query')
|
4611
4668
|
if query_params:
|
@@ -4613,7 +4670,7 @@ class Models(_api_module.BaseModule):
|
|
4613
4670
|
# TODO: remove the hack that pops config.
|
4614
4671
|
request_dict.pop('config', None)
|
4615
4672
|
|
4616
|
-
http_options = None
|
4673
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4617
4674
|
if isinstance(config, dict):
|
4618
4675
|
http_options = config.get('http_options', None)
|
4619
4676
|
elif hasattr(config, 'http_options'):
|
@@ -4636,7 +4693,7 @@ class Models(_api_module.BaseModule):
|
|
4636
4693
|
)
|
4637
4694
|
|
4638
4695
|
return_value = types.UpscaleImageResponse._from_response(
|
4639
|
-
response=response_dict, kwargs=parameter_model
|
4696
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4640
4697
|
)
|
4641
4698
|
self._api_client._verify_response(return_value)
|
4642
4699
|
return return_value
|
@@ -4649,23 +4706,33 @@ class Models(_api_module.BaseModule):
|
|
4649
4706
|
config=config,
|
4650
4707
|
)
|
4651
4708
|
|
4709
|
+
request_url_dict: Optional[dict[str, str]]
|
4710
|
+
|
4652
4711
|
if self._api_client.vertexai:
|
4653
4712
|
request_dict = _GetModelParameters_to_vertex(
|
4654
4713
|
self._api_client, parameter_model
|
4655
4714
|
)
|
4656
|
-
|
4715
|
+
request_url_dict = request_dict.get('_url')
|
4716
|
+
if request_url_dict:
|
4717
|
+
path = '{name}'.format_map(request_url_dict)
|
4718
|
+
else:
|
4719
|
+
path = '{name}'
|
4657
4720
|
else:
|
4658
4721
|
request_dict = _GetModelParameters_to_mldev(
|
4659
4722
|
self._api_client, parameter_model
|
4660
4723
|
)
|
4661
|
-
|
4724
|
+
request_url_dict = request_dict.get('_url')
|
4725
|
+
if request_url_dict:
|
4726
|
+
path = '{name}'.format_map(request_url_dict)
|
4727
|
+
else:
|
4728
|
+
path = '{name}'
|
4662
4729
|
query_params = request_dict.get('_query')
|
4663
4730
|
if query_params:
|
4664
4731
|
path = f'{path}?{urlencode(query_params)}'
|
4665
4732
|
# TODO: remove the hack that pops config.
|
4666
4733
|
request_dict.pop('config', None)
|
4667
4734
|
|
4668
|
-
http_options = None
|
4735
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4669
4736
|
if isinstance(config, dict):
|
4670
4737
|
http_options = config.get('http_options', None)
|
4671
4738
|
elif hasattr(config, 'http_options'):
|
@@ -4684,7 +4751,7 @@ class Models(_api_module.BaseModule):
|
|
4684
4751
|
response_dict = _Model_from_mldev(self._api_client, response_dict)
|
4685
4752
|
|
4686
4753
|
return_value = types.Model._from_response(
|
4687
|
-
response=response_dict, kwargs=parameter_model
|
4754
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4688
4755
|
)
|
4689
4756
|
self._api_client._verify_response(return_value)
|
4690
4757
|
return return_value
|
@@ -4696,23 +4763,33 @@ class Models(_api_module.BaseModule):
|
|
4696
4763
|
config=config,
|
4697
4764
|
)
|
4698
4765
|
|
4766
|
+
request_url_dict: Optional[dict[str, str]]
|
4767
|
+
|
4699
4768
|
if self._api_client.vertexai:
|
4700
4769
|
request_dict = _ListModelsParameters_to_vertex(
|
4701
4770
|
self._api_client, parameter_model
|
4702
4771
|
)
|
4703
|
-
|
4772
|
+
request_url_dict = request_dict.get('_url')
|
4773
|
+
if request_url_dict:
|
4774
|
+
path = '{models_url}'.format_map(request_url_dict)
|
4775
|
+
else:
|
4776
|
+
path = '{models_url}'
|
4704
4777
|
else:
|
4705
4778
|
request_dict = _ListModelsParameters_to_mldev(
|
4706
4779
|
self._api_client, parameter_model
|
4707
4780
|
)
|
4708
|
-
|
4781
|
+
request_url_dict = request_dict.get('_url')
|
4782
|
+
if request_url_dict:
|
4783
|
+
path = '{models_url}'.format_map(request_url_dict)
|
4784
|
+
else:
|
4785
|
+
path = '{models_url}'
|
4709
4786
|
query_params = request_dict.get('_query')
|
4710
4787
|
if query_params:
|
4711
4788
|
path = f'{path}?{urlencode(query_params)}'
|
4712
4789
|
# TODO: remove the hack that pops config.
|
4713
4790
|
request_dict.pop('config', None)
|
4714
4791
|
|
4715
|
-
http_options = None
|
4792
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4716
4793
|
if isinstance(config, dict):
|
4717
4794
|
http_options = config.get('http_options', None)
|
4718
4795
|
elif hasattr(config, 'http_options'):
|
@@ -4735,7 +4812,7 @@ class Models(_api_module.BaseModule):
|
|
4735
4812
|
)
|
4736
4813
|
|
4737
4814
|
return_value = types.ListModelsResponse._from_response(
|
4738
|
-
response=response_dict, kwargs=parameter_model
|
4815
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4739
4816
|
)
|
4740
4817
|
self._api_client._verify_response(return_value)
|
4741
4818
|
return return_value
|
@@ -4751,23 +4828,33 @@ class Models(_api_module.BaseModule):
|
|
4751
4828
|
config=config,
|
4752
4829
|
)
|
4753
4830
|
|
4831
|
+
request_url_dict: Optional[dict[str, str]]
|
4832
|
+
|
4754
4833
|
if self._api_client.vertexai:
|
4755
4834
|
request_dict = _UpdateModelParameters_to_vertex(
|
4756
4835
|
self._api_client, parameter_model
|
4757
4836
|
)
|
4758
|
-
|
4837
|
+
request_url_dict = request_dict.get('_url')
|
4838
|
+
if request_url_dict:
|
4839
|
+
path = '{model}'.format_map(request_url_dict)
|
4840
|
+
else:
|
4841
|
+
path = '{model}'
|
4759
4842
|
else:
|
4760
4843
|
request_dict = _UpdateModelParameters_to_mldev(
|
4761
4844
|
self._api_client, parameter_model
|
4762
4845
|
)
|
4763
|
-
|
4846
|
+
request_url_dict = request_dict.get('_url')
|
4847
|
+
if request_url_dict:
|
4848
|
+
path = '{name}'.format_map(request_url_dict)
|
4849
|
+
else:
|
4850
|
+
path = '{name}'
|
4764
4851
|
query_params = request_dict.get('_query')
|
4765
4852
|
if query_params:
|
4766
4853
|
path = f'{path}?{urlencode(query_params)}'
|
4767
4854
|
# TODO: remove the hack that pops config.
|
4768
4855
|
request_dict.pop('config', None)
|
4769
4856
|
|
4770
|
-
http_options = None
|
4857
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4771
4858
|
if isinstance(config, dict):
|
4772
4859
|
http_options = config.get('http_options', None)
|
4773
4860
|
elif hasattr(config, 'http_options'):
|
@@ -4786,7 +4873,7 @@ class Models(_api_module.BaseModule):
|
|
4786
4873
|
response_dict = _Model_from_mldev(self._api_client, response_dict)
|
4787
4874
|
|
4788
4875
|
return_value = types.Model._from_response(
|
4789
|
-
response=response_dict, kwargs=parameter_model
|
4876
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4790
4877
|
)
|
4791
4878
|
self._api_client._verify_response(return_value)
|
4792
4879
|
return return_value
|
@@ -4802,23 +4889,33 @@ class Models(_api_module.BaseModule):
|
|
4802
4889
|
config=config,
|
4803
4890
|
)
|
4804
4891
|
|
4892
|
+
request_url_dict: Optional[dict[str, str]]
|
4893
|
+
|
4805
4894
|
if self._api_client.vertexai:
|
4806
4895
|
request_dict = _DeleteModelParameters_to_vertex(
|
4807
4896
|
self._api_client, parameter_model
|
4808
4897
|
)
|
4809
|
-
|
4898
|
+
request_url_dict = request_dict.get('_url')
|
4899
|
+
if request_url_dict:
|
4900
|
+
path = '{name}'.format_map(request_url_dict)
|
4901
|
+
else:
|
4902
|
+
path = '{name}'
|
4810
4903
|
else:
|
4811
4904
|
request_dict = _DeleteModelParameters_to_mldev(
|
4812
4905
|
self._api_client, parameter_model
|
4813
4906
|
)
|
4814
|
-
|
4907
|
+
request_url_dict = request_dict.get('_url')
|
4908
|
+
if request_url_dict:
|
4909
|
+
path = '{name}'.format_map(request_url_dict)
|
4910
|
+
else:
|
4911
|
+
path = '{name}'
|
4815
4912
|
query_params = request_dict.get('_query')
|
4816
4913
|
if query_params:
|
4817
4914
|
path = f'{path}?{urlencode(query_params)}'
|
4818
4915
|
# TODO: remove the hack that pops config.
|
4819
4916
|
request_dict.pop('config', None)
|
4820
4917
|
|
4821
|
-
http_options = None
|
4918
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4822
4919
|
if isinstance(config, dict):
|
4823
4920
|
http_options = config.get('http_options', None)
|
4824
4921
|
elif hasattr(config, 'http_options'):
|
@@ -4841,7 +4938,7 @@ class Models(_api_module.BaseModule):
|
|
4841
4938
|
)
|
4842
4939
|
|
4843
4940
|
return_value = types.DeleteModelResponse._from_response(
|
4844
|
-
response=response_dict, kwargs=parameter_model
|
4941
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4845
4942
|
)
|
4846
4943
|
self._api_client._verify_response(return_value)
|
4847
4944
|
return return_value
|
@@ -4880,23 +4977,33 @@ class Models(_api_module.BaseModule):
|
|
4880
4977
|
config=config,
|
4881
4978
|
)
|
4882
4979
|
|
4980
|
+
request_url_dict: Optional[dict[str, str]]
|
4981
|
+
|
4883
4982
|
if self._api_client.vertexai:
|
4884
4983
|
request_dict = _CountTokensParameters_to_vertex(
|
4885
4984
|
self._api_client, parameter_model
|
4886
4985
|
)
|
4887
|
-
|
4986
|
+
request_url_dict = request_dict.get('_url')
|
4987
|
+
if request_url_dict:
|
4988
|
+
path = '{model}:countTokens'.format_map(request_url_dict)
|
4989
|
+
else:
|
4990
|
+
path = '{model}:countTokens'
|
4888
4991
|
else:
|
4889
4992
|
request_dict = _CountTokensParameters_to_mldev(
|
4890
4993
|
self._api_client, parameter_model
|
4891
4994
|
)
|
4892
|
-
|
4995
|
+
request_url_dict = request_dict.get('_url')
|
4996
|
+
if request_url_dict:
|
4997
|
+
path = '{model}:countTokens'.format_map(request_url_dict)
|
4998
|
+
else:
|
4999
|
+
path = '{model}:countTokens'
|
4893
5000
|
query_params = request_dict.get('_query')
|
4894
5001
|
if query_params:
|
4895
5002
|
path = f'{path}?{urlencode(query_params)}'
|
4896
5003
|
# TODO: remove the hack that pops config.
|
4897
5004
|
request_dict.pop('config', None)
|
4898
5005
|
|
4899
|
-
http_options = None
|
5006
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4900
5007
|
if isinstance(config, dict):
|
4901
5008
|
http_options = config.get('http_options', None)
|
4902
5009
|
elif hasattr(config, 'http_options'):
|
@@ -4919,7 +5026,7 @@ class Models(_api_module.BaseModule):
|
|
4919
5026
|
)
|
4920
5027
|
|
4921
5028
|
return_value = types.CountTokensResponse._from_response(
|
4922
|
-
response=response_dict, kwargs=parameter_model
|
5029
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
4923
5030
|
)
|
4924
5031
|
self._api_client._verify_response(return_value)
|
4925
5032
|
return return_value
|
@@ -4960,13 +5067,18 @@ class Models(_api_module.BaseModule):
|
|
4960
5067
|
config=config,
|
4961
5068
|
)
|
4962
5069
|
|
5070
|
+
request_url_dict: Optional[dict[str, str]]
|
4963
5071
|
if not self._api_client.vertexai:
|
4964
5072
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
4965
5073
|
else:
|
4966
5074
|
request_dict = _ComputeTokensParameters_to_vertex(
|
4967
5075
|
self._api_client, parameter_model
|
4968
5076
|
)
|
4969
|
-
|
5077
|
+
request_url_dict = request_dict.get('_url')
|
5078
|
+
if request_url_dict:
|
5079
|
+
path = '{model}:computeTokens'.format_map(request_url_dict)
|
5080
|
+
else:
|
5081
|
+
path = '{model}:computeTokens'
|
4970
5082
|
|
4971
5083
|
query_params = request_dict.get('_query')
|
4972
5084
|
if query_params:
|
@@ -4974,7 +5086,7 @@ class Models(_api_module.BaseModule):
|
|
4974
5086
|
# TODO: remove the hack that pops config.
|
4975
5087
|
request_dict.pop('config', None)
|
4976
5088
|
|
4977
|
-
http_options = None
|
5089
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
4978
5090
|
if isinstance(config, dict):
|
4979
5091
|
http_options = config.get('http_options', None)
|
4980
5092
|
elif hasattr(config, 'http_options'):
|
@@ -4997,7 +5109,7 @@ class Models(_api_module.BaseModule):
|
|
4997
5109
|
)
|
4998
5110
|
|
4999
5111
|
return_value = types.ComputeTokensResponse._from_response(
|
5000
|
-
response=response_dict, kwargs=parameter_model
|
5112
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5001
5113
|
)
|
5002
5114
|
self._api_client._verify_response(return_value)
|
5003
5115
|
return return_value
|
@@ -5040,23 +5152,33 @@ class Models(_api_module.BaseModule):
|
|
5040
5152
|
config=config,
|
5041
5153
|
)
|
5042
5154
|
|
5155
|
+
request_url_dict: Optional[dict[str, str]]
|
5156
|
+
|
5043
5157
|
if self._api_client.vertexai:
|
5044
5158
|
request_dict = _GenerateVideosParameters_to_vertex(
|
5045
5159
|
self._api_client, parameter_model
|
5046
5160
|
)
|
5047
|
-
|
5161
|
+
request_url_dict = request_dict.get('_url')
|
5162
|
+
if request_url_dict:
|
5163
|
+
path = '{model}:predictLongRunning'.format_map(request_url_dict)
|
5164
|
+
else:
|
5165
|
+
path = '{model}:predictLongRunning'
|
5048
5166
|
else:
|
5049
5167
|
request_dict = _GenerateVideosParameters_to_mldev(
|
5050
5168
|
self._api_client, parameter_model
|
5051
5169
|
)
|
5052
|
-
|
5170
|
+
request_url_dict = request_dict.get('_url')
|
5171
|
+
if request_url_dict:
|
5172
|
+
path = '{model}:predictLongRunning'.format_map(request_url_dict)
|
5173
|
+
else:
|
5174
|
+
path = '{model}:predictLongRunning'
|
5053
5175
|
query_params = request_dict.get('_query')
|
5054
5176
|
if query_params:
|
5055
5177
|
path = f'{path}?{urlencode(query_params)}'
|
5056
5178
|
# TODO: remove the hack that pops config.
|
5057
5179
|
request_dict.pop('config', None)
|
5058
5180
|
|
5059
|
-
http_options = None
|
5181
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5060
5182
|
if isinstance(config, dict):
|
5061
5183
|
http_options = config.get('http_options', None)
|
5062
5184
|
elif hasattr(config, 'http_options'):
|
@@ -5079,7 +5201,7 @@ class Models(_api_module.BaseModule):
|
|
5079
5201
|
)
|
5080
5202
|
|
5081
5203
|
return_value = types.GenerateVideosOperation._from_response(
|
5082
|
-
response=response_dict, kwargs=parameter_model
|
5204
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5083
5205
|
)
|
5084
5206
|
self._api_client._verify_response(return_value)
|
5085
5207
|
return return_value
|
@@ -5156,7 +5278,7 @@ class Models(_api_module.BaseModule):
|
|
5156
5278
|
logger.info(
|
5157
5279
|
f'AFC is enabled with max remote calls: {remaining_remote_calls_afc}.'
|
5158
5280
|
)
|
5159
|
-
automatic_function_calling_history = []
|
5281
|
+
automatic_function_calling_history: list[types.Content] = []
|
5160
5282
|
response = None
|
5161
5283
|
i = 0
|
5162
5284
|
while remaining_remote_calls_afc > 0:
|
@@ -5277,7 +5399,7 @@ class Models(_api_module.BaseModule):
|
|
5277
5399
|
logger.info(
|
5278
5400
|
f'AFC is enabled with max remote calls: {remaining_remote_calls_afc}.'
|
5279
5401
|
)
|
5280
|
-
automatic_function_calling_history = []
|
5402
|
+
automatic_function_calling_history: list[types.Content] = []
|
5281
5403
|
chunk = None
|
5282
5404
|
func_response_parts = None
|
5283
5405
|
i = 0
|
@@ -5472,23 +5594,33 @@ class AsyncModels(_api_module.BaseModule):
|
|
5472
5594
|
config=config,
|
5473
5595
|
)
|
5474
5596
|
|
5597
|
+
request_url_dict: Optional[dict[str, str]]
|
5598
|
+
|
5475
5599
|
if self._api_client.vertexai:
|
5476
5600
|
request_dict = _GenerateContentParameters_to_vertex(
|
5477
5601
|
self._api_client, parameter_model
|
5478
5602
|
)
|
5479
|
-
|
5603
|
+
request_url_dict = request_dict.get('_url')
|
5604
|
+
if request_url_dict:
|
5605
|
+
path = '{model}:generateContent'.format_map(request_url_dict)
|
5606
|
+
else:
|
5607
|
+
path = '{model}:generateContent'
|
5480
5608
|
else:
|
5481
5609
|
request_dict = _GenerateContentParameters_to_mldev(
|
5482
5610
|
self._api_client, parameter_model
|
5483
5611
|
)
|
5484
|
-
|
5612
|
+
request_url_dict = request_dict.get('_url')
|
5613
|
+
if request_url_dict:
|
5614
|
+
path = '{model}:generateContent'.format_map(request_url_dict)
|
5615
|
+
else:
|
5616
|
+
path = '{model}:generateContent'
|
5485
5617
|
query_params = request_dict.get('_query')
|
5486
5618
|
if query_params:
|
5487
5619
|
path = f'{path}?{urlencode(query_params)}'
|
5488
5620
|
# TODO: remove the hack that pops config.
|
5489
5621
|
request_dict.pop('config', None)
|
5490
5622
|
|
5491
|
-
http_options = None
|
5623
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5492
5624
|
if isinstance(config, dict):
|
5493
5625
|
http_options = config.get('http_options', None)
|
5494
5626
|
elif hasattr(config, 'http_options'):
|
@@ -5511,7 +5643,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5511
5643
|
)
|
5512
5644
|
|
5513
5645
|
return_value = types.GenerateContentResponse._from_response(
|
5514
|
-
response=response_dict, kwargs=parameter_model
|
5646
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5515
5647
|
)
|
5516
5648
|
self._api_client._verify_response(return_value)
|
5517
5649
|
return return_value
|
@@ -5529,27 +5661,37 @@ class AsyncModels(_api_module.BaseModule):
|
|
5529
5661
|
config=config,
|
5530
5662
|
)
|
5531
5663
|
|
5664
|
+
request_url_dict: Optional[dict[str, str]]
|
5665
|
+
|
5532
5666
|
if self._api_client.vertexai:
|
5533
5667
|
request_dict = _GenerateContentParameters_to_vertex(
|
5534
5668
|
self._api_client, parameter_model
|
5535
5669
|
)
|
5536
|
-
|
5537
|
-
|
5538
|
-
|
5670
|
+
request_url_dict = request_dict.get('_url')
|
5671
|
+
if request_url_dict:
|
5672
|
+
path = '{model}:streamGenerateContent?alt=sse'.format_map(
|
5673
|
+
request_url_dict
|
5674
|
+
)
|
5675
|
+
else:
|
5676
|
+
path = '{model}:streamGenerateContent?alt=sse'
|
5539
5677
|
else:
|
5540
5678
|
request_dict = _GenerateContentParameters_to_mldev(
|
5541
5679
|
self._api_client, parameter_model
|
5542
5680
|
)
|
5543
|
-
|
5544
|
-
|
5545
|
-
|
5681
|
+
request_url_dict = request_dict.get('_url')
|
5682
|
+
if request_url_dict:
|
5683
|
+
path = '{model}:streamGenerateContent?alt=sse'.format_map(
|
5684
|
+
request_url_dict
|
5685
|
+
)
|
5686
|
+
else:
|
5687
|
+
path = '{model}:streamGenerateContent?alt=sse'
|
5546
5688
|
query_params = request_dict.get('_query')
|
5547
5689
|
if query_params:
|
5548
5690
|
path = f'{path}?{urlencode(query_params)}'
|
5549
5691
|
# TODO: remove the hack that pops config.
|
5550
5692
|
request_dict.pop('config', None)
|
5551
5693
|
|
5552
|
-
http_options = None
|
5694
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5553
5695
|
if isinstance(config, dict):
|
5554
5696
|
http_options = config.get('http_options', None)
|
5555
5697
|
elif hasattr(config, 'http_options'):
|
@@ -5575,7 +5717,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5575
5717
|
)
|
5576
5718
|
|
5577
5719
|
return_value = types.GenerateContentResponse._from_response(
|
5578
|
-
response=response_dict, kwargs=parameter_model
|
5720
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5579
5721
|
)
|
5580
5722
|
self._api_client._verify_response(return_value)
|
5581
5723
|
yield return_value
|
@@ -5618,23 +5760,33 @@ class AsyncModels(_api_module.BaseModule):
|
|
5618
5760
|
config=config,
|
5619
5761
|
)
|
5620
5762
|
|
5763
|
+
request_url_dict: Optional[dict[str, str]]
|
5764
|
+
|
5621
5765
|
if self._api_client.vertexai:
|
5622
5766
|
request_dict = _EmbedContentParameters_to_vertex(
|
5623
5767
|
self._api_client, parameter_model
|
5624
5768
|
)
|
5625
|
-
|
5769
|
+
request_url_dict = request_dict.get('_url')
|
5770
|
+
if request_url_dict:
|
5771
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
5772
|
+
else:
|
5773
|
+
path = '{model}:predict'
|
5626
5774
|
else:
|
5627
5775
|
request_dict = _EmbedContentParameters_to_mldev(
|
5628
5776
|
self._api_client, parameter_model
|
5629
5777
|
)
|
5630
|
-
|
5778
|
+
request_url_dict = request_dict.get('_url')
|
5779
|
+
if request_url_dict:
|
5780
|
+
path = '{model}:batchEmbedContents'.format_map(request_url_dict)
|
5781
|
+
else:
|
5782
|
+
path = '{model}:batchEmbedContents'
|
5631
5783
|
query_params = request_dict.get('_query')
|
5632
5784
|
if query_params:
|
5633
5785
|
path = f'{path}?{urlencode(query_params)}'
|
5634
5786
|
# TODO: remove the hack that pops config.
|
5635
5787
|
request_dict.pop('config', None)
|
5636
5788
|
|
5637
|
-
http_options = None
|
5789
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5638
5790
|
if isinstance(config, dict):
|
5639
5791
|
http_options = config.get('http_options', None)
|
5640
5792
|
elif hasattr(config, 'http_options'):
|
@@ -5657,7 +5809,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5657
5809
|
)
|
5658
5810
|
|
5659
5811
|
return_value = types.EmbedContentResponse._from_response(
|
5660
|
-
response=response_dict, kwargs=parameter_model
|
5812
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5661
5813
|
)
|
5662
5814
|
self._api_client._verify_response(return_value)
|
5663
5815
|
return return_value
|
@@ -5698,23 +5850,33 @@ class AsyncModels(_api_module.BaseModule):
|
|
5698
5850
|
config=config,
|
5699
5851
|
)
|
5700
5852
|
|
5853
|
+
request_url_dict: Optional[dict[str, str]]
|
5854
|
+
|
5701
5855
|
if self._api_client.vertexai:
|
5702
5856
|
request_dict = _GenerateImagesParameters_to_vertex(
|
5703
5857
|
self._api_client, parameter_model
|
5704
5858
|
)
|
5705
|
-
|
5859
|
+
request_url_dict = request_dict.get('_url')
|
5860
|
+
if request_url_dict:
|
5861
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
5862
|
+
else:
|
5863
|
+
path = '{model}:predict'
|
5706
5864
|
else:
|
5707
5865
|
request_dict = _GenerateImagesParameters_to_mldev(
|
5708
5866
|
self._api_client, parameter_model
|
5709
5867
|
)
|
5710
|
-
|
5868
|
+
request_url_dict = request_dict.get('_url')
|
5869
|
+
if request_url_dict:
|
5870
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
5871
|
+
else:
|
5872
|
+
path = '{model}:predict'
|
5711
5873
|
query_params = request_dict.get('_query')
|
5712
5874
|
if query_params:
|
5713
5875
|
path = f'{path}?{urlencode(query_params)}'
|
5714
5876
|
# TODO: remove the hack that pops config.
|
5715
5877
|
request_dict.pop('config', None)
|
5716
5878
|
|
5717
|
-
http_options = None
|
5879
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5718
5880
|
if isinstance(config, dict):
|
5719
5881
|
http_options = config.get('http_options', None)
|
5720
5882
|
elif hasattr(config, 'http_options'):
|
@@ -5737,7 +5899,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5737
5899
|
)
|
5738
5900
|
|
5739
5901
|
return_value = types.GenerateImagesResponse._from_response(
|
5740
|
-
response=response_dict, kwargs=parameter_model
|
5902
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5741
5903
|
)
|
5742
5904
|
self._api_client._verify_response(return_value)
|
5743
5905
|
return return_value
|
@@ -5779,7 +5941,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5779
5941
|
),
|
5780
5942
|
)
|
5781
5943
|
response = await client.aio.models.edit_image(
|
5782
|
-
model='imagen-3.0-capability-
|
5944
|
+
model='imagen-3.0-capability-001',
|
5783
5945
|
prompt='man with dog',
|
5784
5946
|
reference_images=[raw_ref_image, mask_ref_image],
|
5785
5947
|
config=types.EditImageConfig(
|
@@ -5799,13 +5961,18 @@ class AsyncModels(_api_module.BaseModule):
|
|
5799
5961
|
config=config,
|
5800
5962
|
)
|
5801
5963
|
|
5964
|
+
request_url_dict: Optional[dict[str, str]]
|
5802
5965
|
if not self._api_client.vertexai:
|
5803
5966
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
5804
5967
|
else:
|
5805
5968
|
request_dict = _EditImageParameters_to_vertex(
|
5806
5969
|
self._api_client, parameter_model
|
5807
5970
|
)
|
5808
|
-
|
5971
|
+
request_url_dict = request_dict.get('_url')
|
5972
|
+
if request_url_dict:
|
5973
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
5974
|
+
else:
|
5975
|
+
path = '{model}:predict'
|
5809
5976
|
|
5810
5977
|
query_params = request_dict.get('_query')
|
5811
5978
|
if query_params:
|
@@ -5813,7 +5980,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5813
5980
|
# TODO: remove the hack that pops config.
|
5814
5981
|
request_dict.pop('config', None)
|
5815
5982
|
|
5816
|
-
http_options = None
|
5983
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5817
5984
|
if isinstance(config, dict):
|
5818
5985
|
http_options = config.get('http_options', None)
|
5819
5986
|
elif hasattr(config, 'http_options'):
|
@@ -5836,7 +6003,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5836
6003
|
)
|
5837
6004
|
|
5838
6005
|
return_value = types.EditImageResponse._from_response(
|
5839
|
-
response=response_dict, kwargs=parameter_model
|
6006
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5840
6007
|
)
|
5841
6008
|
self._api_client._verify_response(return_value)
|
5842
6009
|
return return_value
|
@@ -5865,13 +6032,18 @@ class AsyncModels(_api_module.BaseModule):
|
|
5865
6032
|
config=config,
|
5866
6033
|
)
|
5867
6034
|
|
6035
|
+
request_url_dict: Optional[dict[str, str]]
|
5868
6036
|
if not self._api_client.vertexai:
|
5869
6037
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
5870
6038
|
else:
|
5871
6039
|
request_dict = _UpscaleImageAPIParameters_to_vertex(
|
5872
6040
|
self._api_client, parameter_model
|
5873
6041
|
)
|
5874
|
-
|
6042
|
+
request_url_dict = request_dict.get('_url')
|
6043
|
+
if request_url_dict:
|
6044
|
+
path = '{model}:predict'.format_map(request_url_dict)
|
6045
|
+
else:
|
6046
|
+
path = '{model}:predict'
|
5875
6047
|
|
5876
6048
|
query_params = request_dict.get('_query')
|
5877
6049
|
if query_params:
|
@@ -5879,7 +6051,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5879
6051
|
# TODO: remove the hack that pops config.
|
5880
6052
|
request_dict.pop('config', None)
|
5881
6053
|
|
5882
|
-
http_options = None
|
6054
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5883
6055
|
if isinstance(config, dict):
|
5884
6056
|
http_options = config.get('http_options', None)
|
5885
6057
|
elif hasattr(config, 'http_options'):
|
@@ -5902,7 +6074,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5902
6074
|
)
|
5903
6075
|
|
5904
6076
|
return_value = types.UpscaleImageResponse._from_response(
|
5905
|
-
response=response_dict, kwargs=parameter_model
|
6077
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5906
6078
|
)
|
5907
6079
|
self._api_client._verify_response(return_value)
|
5908
6080
|
return return_value
|
@@ -5915,23 +6087,33 @@ class AsyncModels(_api_module.BaseModule):
|
|
5915
6087
|
config=config,
|
5916
6088
|
)
|
5917
6089
|
|
6090
|
+
request_url_dict: Optional[dict[str, str]]
|
6091
|
+
|
5918
6092
|
if self._api_client.vertexai:
|
5919
6093
|
request_dict = _GetModelParameters_to_vertex(
|
5920
6094
|
self._api_client, parameter_model
|
5921
6095
|
)
|
5922
|
-
|
6096
|
+
request_url_dict = request_dict.get('_url')
|
6097
|
+
if request_url_dict:
|
6098
|
+
path = '{name}'.format_map(request_url_dict)
|
6099
|
+
else:
|
6100
|
+
path = '{name}'
|
5923
6101
|
else:
|
5924
6102
|
request_dict = _GetModelParameters_to_mldev(
|
5925
6103
|
self._api_client, parameter_model
|
5926
6104
|
)
|
5927
|
-
|
6105
|
+
request_url_dict = request_dict.get('_url')
|
6106
|
+
if request_url_dict:
|
6107
|
+
path = '{name}'.format_map(request_url_dict)
|
6108
|
+
else:
|
6109
|
+
path = '{name}'
|
5928
6110
|
query_params = request_dict.get('_query')
|
5929
6111
|
if query_params:
|
5930
6112
|
path = f'{path}?{urlencode(query_params)}'
|
5931
6113
|
# TODO: remove the hack that pops config.
|
5932
6114
|
request_dict.pop('config', None)
|
5933
6115
|
|
5934
|
-
http_options = None
|
6116
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5935
6117
|
if isinstance(config, dict):
|
5936
6118
|
http_options = config.get('http_options', None)
|
5937
6119
|
elif hasattr(config, 'http_options'):
|
@@ -5950,7 +6132,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5950
6132
|
response_dict = _Model_from_mldev(self._api_client, response_dict)
|
5951
6133
|
|
5952
6134
|
return_value = types.Model._from_response(
|
5953
|
-
response=response_dict, kwargs=parameter_model
|
6135
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
5954
6136
|
)
|
5955
6137
|
self._api_client._verify_response(return_value)
|
5956
6138
|
return return_value
|
@@ -5962,23 +6144,33 @@ class AsyncModels(_api_module.BaseModule):
|
|
5962
6144
|
config=config,
|
5963
6145
|
)
|
5964
6146
|
|
6147
|
+
request_url_dict: Optional[dict[str, str]]
|
6148
|
+
|
5965
6149
|
if self._api_client.vertexai:
|
5966
6150
|
request_dict = _ListModelsParameters_to_vertex(
|
5967
6151
|
self._api_client, parameter_model
|
5968
6152
|
)
|
5969
|
-
|
6153
|
+
request_url_dict = request_dict.get('_url')
|
6154
|
+
if request_url_dict:
|
6155
|
+
path = '{models_url}'.format_map(request_url_dict)
|
6156
|
+
else:
|
6157
|
+
path = '{models_url}'
|
5970
6158
|
else:
|
5971
6159
|
request_dict = _ListModelsParameters_to_mldev(
|
5972
6160
|
self._api_client, parameter_model
|
5973
6161
|
)
|
5974
|
-
|
6162
|
+
request_url_dict = request_dict.get('_url')
|
6163
|
+
if request_url_dict:
|
6164
|
+
path = '{models_url}'.format_map(request_url_dict)
|
6165
|
+
else:
|
6166
|
+
path = '{models_url}'
|
5975
6167
|
query_params = request_dict.get('_query')
|
5976
6168
|
if query_params:
|
5977
6169
|
path = f'{path}?{urlencode(query_params)}'
|
5978
6170
|
# TODO: remove the hack that pops config.
|
5979
6171
|
request_dict.pop('config', None)
|
5980
6172
|
|
5981
|
-
http_options = None
|
6173
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
5982
6174
|
if isinstance(config, dict):
|
5983
6175
|
http_options = config.get('http_options', None)
|
5984
6176
|
elif hasattr(config, 'http_options'):
|
@@ -6001,7 +6193,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6001
6193
|
)
|
6002
6194
|
|
6003
6195
|
return_value = types.ListModelsResponse._from_response(
|
6004
|
-
response=response_dict, kwargs=parameter_model
|
6196
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
6005
6197
|
)
|
6006
6198
|
self._api_client._verify_response(return_value)
|
6007
6199
|
return return_value
|
@@ -6017,23 +6209,33 @@ class AsyncModels(_api_module.BaseModule):
|
|
6017
6209
|
config=config,
|
6018
6210
|
)
|
6019
6211
|
|
6212
|
+
request_url_dict: Optional[dict[str, str]]
|
6213
|
+
|
6020
6214
|
if self._api_client.vertexai:
|
6021
6215
|
request_dict = _UpdateModelParameters_to_vertex(
|
6022
6216
|
self._api_client, parameter_model
|
6023
6217
|
)
|
6024
|
-
|
6218
|
+
request_url_dict = request_dict.get('_url')
|
6219
|
+
if request_url_dict:
|
6220
|
+
path = '{model}'.format_map(request_url_dict)
|
6221
|
+
else:
|
6222
|
+
path = '{model}'
|
6025
6223
|
else:
|
6026
6224
|
request_dict = _UpdateModelParameters_to_mldev(
|
6027
6225
|
self._api_client, parameter_model
|
6028
6226
|
)
|
6029
|
-
|
6227
|
+
request_url_dict = request_dict.get('_url')
|
6228
|
+
if request_url_dict:
|
6229
|
+
path = '{name}'.format_map(request_url_dict)
|
6230
|
+
else:
|
6231
|
+
path = '{name}'
|
6030
6232
|
query_params = request_dict.get('_query')
|
6031
6233
|
if query_params:
|
6032
6234
|
path = f'{path}?{urlencode(query_params)}'
|
6033
6235
|
# TODO: remove the hack that pops config.
|
6034
6236
|
request_dict.pop('config', None)
|
6035
6237
|
|
6036
|
-
http_options = None
|
6238
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
6037
6239
|
if isinstance(config, dict):
|
6038
6240
|
http_options = config.get('http_options', None)
|
6039
6241
|
elif hasattr(config, 'http_options'):
|
@@ -6052,7 +6254,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6052
6254
|
response_dict = _Model_from_mldev(self._api_client, response_dict)
|
6053
6255
|
|
6054
6256
|
return_value = types.Model._from_response(
|
6055
|
-
response=response_dict, kwargs=parameter_model
|
6257
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
6056
6258
|
)
|
6057
6259
|
self._api_client._verify_response(return_value)
|
6058
6260
|
return return_value
|
@@ -6068,23 +6270,33 @@ class AsyncModels(_api_module.BaseModule):
|
|
6068
6270
|
config=config,
|
6069
6271
|
)
|
6070
6272
|
|
6273
|
+
request_url_dict: Optional[dict[str, str]]
|
6274
|
+
|
6071
6275
|
if self._api_client.vertexai:
|
6072
6276
|
request_dict = _DeleteModelParameters_to_vertex(
|
6073
6277
|
self._api_client, parameter_model
|
6074
6278
|
)
|
6075
|
-
|
6279
|
+
request_url_dict = request_dict.get('_url')
|
6280
|
+
if request_url_dict:
|
6281
|
+
path = '{name}'.format_map(request_url_dict)
|
6282
|
+
else:
|
6283
|
+
path = '{name}'
|
6076
6284
|
else:
|
6077
6285
|
request_dict = _DeleteModelParameters_to_mldev(
|
6078
6286
|
self._api_client, parameter_model
|
6079
6287
|
)
|
6080
|
-
|
6288
|
+
request_url_dict = request_dict.get('_url')
|
6289
|
+
if request_url_dict:
|
6290
|
+
path = '{name}'.format_map(request_url_dict)
|
6291
|
+
else:
|
6292
|
+
path = '{name}'
|
6081
6293
|
query_params = request_dict.get('_query')
|
6082
6294
|
if query_params:
|
6083
6295
|
path = f'{path}?{urlencode(query_params)}'
|
6084
6296
|
# TODO: remove the hack that pops config.
|
6085
6297
|
request_dict.pop('config', None)
|
6086
6298
|
|
6087
|
-
http_options = None
|
6299
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
6088
6300
|
if isinstance(config, dict):
|
6089
6301
|
http_options = config.get('http_options', None)
|
6090
6302
|
elif hasattr(config, 'http_options'):
|
@@ -6107,7 +6319,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6107
6319
|
)
|
6108
6320
|
|
6109
6321
|
return_value = types.DeleteModelResponse._from_response(
|
6110
|
-
response=response_dict, kwargs=parameter_model
|
6322
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
6111
6323
|
)
|
6112
6324
|
self._api_client._verify_response(return_value)
|
6113
6325
|
return return_value
|
@@ -6146,23 +6358,33 @@ class AsyncModels(_api_module.BaseModule):
|
|
6146
6358
|
config=config,
|
6147
6359
|
)
|
6148
6360
|
|
6361
|
+
request_url_dict: Optional[dict[str, str]]
|
6362
|
+
|
6149
6363
|
if self._api_client.vertexai:
|
6150
6364
|
request_dict = _CountTokensParameters_to_vertex(
|
6151
6365
|
self._api_client, parameter_model
|
6152
6366
|
)
|
6153
|
-
|
6367
|
+
request_url_dict = request_dict.get('_url')
|
6368
|
+
if request_url_dict:
|
6369
|
+
path = '{model}:countTokens'.format_map(request_url_dict)
|
6370
|
+
else:
|
6371
|
+
path = '{model}:countTokens'
|
6154
6372
|
else:
|
6155
6373
|
request_dict = _CountTokensParameters_to_mldev(
|
6156
6374
|
self._api_client, parameter_model
|
6157
6375
|
)
|
6158
|
-
|
6376
|
+
request_url_dict = request_dict.get('_url')
|
6377
|
+
if request_url_dict:
|
6378
|
+
path = '{model}:countTokens'.format_map(request_url_dict)
|
6379
|
+
else:
|
6380
|
+
path = '{model}:countTokens'
|
6159
6381
|
query_params = request_dict.get('_query')
|
6160
6382
|
if query_params:
|
6161
6383
|
path = f'{path}?{urlencode(query_params)}'
|
6162
6384
|
# TODO: remove the hack that pops config.
|
6163
6385
|
request_dict.pop('config', None)
|
6164
6386
|
|
6165
|
-
http_options = None
|
6387
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
6166
6388
|
if isinstance(config, dict):
|
6167
6389
|
http_options = config.get('http_options', None)
|
6168
6390
|
elif hasattr(config, 'http_options'):
|
@@ -6185,7 +6407,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6185
6407
|
)
|
6186
6408
|
|
6187
6409
|
return_value = types.CountTokensResponse._from_response(
|
6188
|
-
response=response_dict, kwargs=parameter_model
|
6410
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
6189
6411
|
)
|
6190
6412
|
self._api_client._verify_response(return_value)
|
6191
6413
|
return return_value
|
@@ -6226,13 +6448,18 @@ class AsyncModels(_api_module.BaseModule):
|
|
6226
6448
|
config=config,
|
6227
6449
|
)
|
6228
6450
|
|
6451
|
+
request_url_dict: Optional[dict[str, str]]
|
6229
6452
|
if not self._api_client.vertexai:
|
6230
6453
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
6231
6454
|
else:
|
6232
6455
|
request_dict = _ComputeTokensParameters_to_vertex(
|
6233
6456
|
self._api_client, parameter_model
|
6234
6457
|
)
|
6235
|
-
|
6458
|
+
request_url_dict = request_dict.get('_url')
|
6459
|
+
if request_url_dict:
|
6460
|
+
path = '{model}:computeTokens'.format_map(request_url_dict)
|
6461
|
+
else:
|
6462
|
+
path = '{model}:computeTokens'
|
6236
6463
|
|
6237
6464
|
query_params = request_dict.get('_query')
|
6238
6465
|
if query_params:
|
@@ -6240,7 +6467,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6240
6467
|
# TODO: remove the hack that pops config.
|
6241
6468
|
request_dict.pop('config', None)
|
6242
6469
|
|
6243
|
-
http_options = None
|
6470
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
6244
6471
|
if isinstance(config, dict):
|
6245
6472
|
http_options = config.get('http_options', None)
|
6246
6473
|
elif hasattr(config, 'http_options'):
|
@@ -6263,7 +6490,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6263
6490
|
)
|
6264
6491
|
|
6265
6492
|
return_value = types.ComputeTokensResponse._from_response(
|
6266
|
-
response=response_dict, kwargs=parameter_model
|
6493
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
6267
6494
|
)
|
6268
6495
|
self._api_client._verify_response(return_value)
|
6269
6496
|
return return_value
|
@@ -6306,23 +6533,33 @@ class AsyncModels(_api_module.BaseModule):
|
|
6306
6533
|
config=config,
|
6307
6534
|
)
|
6308
6535
|
|
6536
|
+
request_url_dict: Optional[dict[str, str]]
|
6537
|
+
|
6309
6538
|
if self._api_client.vertexai:
|
6310
6539
|
request_dict = _GenerateVideosParameters_to_vertex(
|
6311
6540
|
self._api_client, parameter_model
|
6312
6541
|
)
|
6313
|
-
|
6542
|
+
request_url_dict = request_dict.get('_url')
|
6543
|
+
if request_url_dict:
|
6544
|
+
path = '{model}:predictLongRunning'.format_map(request_url_dict)
|
6545
|
+
else:
|
6546
|
+
path = '{model}:predictLongRunning'
|
6314
6547
|
else:
|
6315
6548
|
request_dict = _GenerateVideosParameters_to_mldev(
|
6316
6549
|
self._api_client, parameter_model
|
6317
6550
|
)
|
6318
|
-
|
6551
|
+
request_url_dict = request_dict.get('_url')
|
6552
|
+
if request_url_dict:
|
6553
|
+
path = '{model}:predictLongRunning'.format_map(request_url_dict)
|
6554
|
+
else:
|
6555
|
+
path = '{model}:predictLongRunning'
|
6319
6556
|
query_params = request_dict.get('_query')
|
6320
6557
|
if query_params:
|
6321
6558
|
path = f'{path}?{urlencode(query_params)}'
|
6322
6559
|
# TODO: remove the hack that pops config.
|
6323
6560
|
request_dict.pop('config', None)
|
6324
6561
|
|
6325
|
-
http_options = None
|
6562
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
6326
6563
|
if isinstance(config, dict):
|
6327
6564
|
http_options = config.get('http_options', None)
|
6328
6565
|
elif hasattr(config, 'http_options'):
|
@@ -6345,7 +6582,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6345
6582
|
)
|
6346
6583
|
|
6347
6584
|
return_value = types.GenerateVideosOperation._from_response(
|
6348
|
-
response=response_dict, kwargs=parameter_model
|
6585
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
6349
6586
|
)
|
6350
6587
|
self._api_client._verify_response(return_value)
|
6351
6588
|
return return_value
|
@@ -6394,7 +6631,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6394
6631
|
logger.info(
|
6395
6632
|
f'AFC is enabled with max remote calls: {remaining_remote_calls_afc}.'
|
6396
6633
|
)
|
6397
|
-
automatic_function_calling_history = []
|
6634
|
+
automatic_function_calling_history: list[types.Content] = []
|
6398
6635
|
response = None
|
6399
6636
|
while remaining_remote_calls_afc > 0:
|
6400
6637
|
response = await self._generate_content(
|
@@ -6519,7 +6756,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6519
6756
|
logger.info(
|
6520
6757
|
f'AFC is enabled with max remote calls: {remaining_remote_calls_afc}.'
|
6521
6758
|
)
|
6522
|
-
automatic_function_calling_history = []
|
6759
|
+
automatic_function_calling_history: list[types.Content] = []
|
6523
6760
|
func_response_parts = None
|
6524
6761
|
chunk = None
|
6525
6762
|
i = 0
|