google-genai 1.10.0__py3-none-any.whl → 1.12.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 +100 -31
- google/genai/_automatic_function_calling_util.py +4 -24
- google/genai/_common.py +40 -37
- google/genai/_extra_utils.py +72 -12
- google/genai/_live_converters.py +2487 -0
- google/genai/_replay_api_client.py +32 -26
- google/genai/_transformers.py +119 -25
- google/genai/batches.py +45 -45
- google/genai/caches.py +126 -126
- google/genai/chats.py +13 -9
- google/genai/client.py +3 -2
- google/genai/errors.py +6 -6
- google/genai/files.py +38 -38
- google/genai/live.py +138 -1029
- google/genai/models.py +455 -387
- google/genai/operations.py +33 -33
- google/genai/pagers.py +2 -2
- google/genai/py.typed +1 -0
- google/genai/tunings.py +70 -70
- google/genai/types.py +964 -45
- google/genai/version.py +1 -1
- {google_genai-1.10.0.dist-info → google_genai-1.12.0.dist-info}/METADATA +1 -1
- google_genai-1.12.0.dist-info/RECORD +29 -0
- {google_genai-1.10.0.dist-info → google_genai-1.12.0.dist-info}/WHEEL +1 -1
- google_genai-1.10.0.dist-info/RECORD +0 -27
- {google_genai-1.10.0.dist-info → google_genai-1.12.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.10.0.dist-info → google_genai-1.12.0.dist-info}/top_level.txt +0 -0
google/genai/models.py
CHANGED
@@ -33,9 +33,9 @@ logger = logging.getLogger('google_genai.models')
|
|
33
33
|
|
34
34
|
def _Part_to_mldev(
|
35
35
|
api_client: BaseApiClient,
|
36
|
-
from_object: Union[dict, object],
|
37
|
-
parent_object: Optional[dict] = None,
|
38
|
-
) -> dict:
|
36
|
+
from_object: Union[dict[str, Any], object],
|
37
|
+
parent_object: Optional[dict[str, Any]] = None,
|
38
|
+
) -> dict[str, Any]:
|
39
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.')
|
@@ -77,9 +77,9 @@ def _Part_to_mldev(
|
|
77
77
|
|
78
78
|
def _Content_to_mldev(
|
79
79
|
api_client: BaseApiClient,
|
80
|
-
from_object: Union[dict, object],
|
81
|
-
parent_object: Optional[dict] = None,
|
82
|
-
) -> dict:
|
80
|
+
from_object: Union[dict[str, Any], object],
|
81
|
+
parent_object: Optional[dict[str, Any]] = None,
|
82
|
+
) -> dict[str, Any]:
|
83
83
|
to_object: dict[str, Any] = {}
|
84
84
|
if getv(from_object, ['parts']) is not None:
|
85
85
|
setv(
|
@@ -99,9 +99,9 @@ def _Content_to_mldev(
|
|
99
99
|
|
100
100
|
def _Schema_to_mldev(
|
101
101
|
api_client: BaseApiClient,
|
102
|
-
from_object: Union[dict, object],
|
103
|
-
parent_object: Optional[dict] = None,
|
104
|
-
) -> dict:
|
102
|
+
from_object: Union[dict[str, Any], object],
|
103
|
+
parent_object: Optional[dict[str, Any]] = None,
|
104
|
+
) -> dict[str, Any]:
|
105
105
|
to_object: dict[str, Any] = {}
|
106
106
|
if getv(from_object, ['example']) is not None:
|
107
107
|
raise ValueError('example parameter is not supported in Gemini API.')
|
@@ -176,11 +176,25 @@ def _Schema_to_mldev(
|
|
176
176
|
return to_object
|
177
177
|
|
178
178
|
|
179
|
+
def _ModelSelectionConfig_to_mldev(
|
180
|
+
api_client: BaseApiClient,
|
181
|
+
from_object: Union[dict[str, Any], object],
|
182
|
+
parent_object: Optional[dict[str, Any]] = None,
|
183
|
+
) -> dict[str, Any]:
|
184
|
+
to_object: dict[str, Any] = {}
|
185
|
+
if getv(from_object, ['feature_selection_preference']) is not None:
|
186
|
+
raise ValueError(
|
187
|
+
'feature_selection_preference parameter is not supported in Gemini API.'
|
188
|
+
)
|
189
|
+
|
190
|
+
return to_object
|
191
|
+
|
192
|
+
|
179
193
|
def _SafetySetting_to_mldev(
|
180
194
|
api_client: BaseApiClient,
|
181
|
-
from_object: Union[dict, object],
|
182
|
-
parent_object: Optional[dict] = None,
|
183
|
-
) -> dict:
|
195
|
+
from_object: Union[dict[str, Any], object],
|
196
|
+
parent_object: Optional[dict[str, Any]] = None,
|
197
|
+
) -> dict[str, Any]:
|
184
198
|
to_object: dict[str, Any] = {}
|
185
199
|
if getv(from_object, ['method']) is not None:
|
186
200
|
raise ValueError('method parameter is not supported in Gemini API.')
|
@@ -196,9 +210,9 @@ def _SafetySetting_to_mldev(
|
|
196
210
|
|
197
211
|
def _FunctionDeclaration_to_mldev(
|
198
212
|
api_client: BaseApiClient,
|
199
|
-
from_object: Union[dict, object],
|
200
|
-
parent_object: Optional[dict] = None,
|
201
|
-
) -> dict:
|
213
|
+
from_object: Union[dict[str, Any], object],
|
214
|
+
parent_object: Optional[dict[str, Any]] = None,
|
215
|
+
) -> dict[str, Any]:
|
202
216
|
to_object: dict[str, Any] = {}
|
203
217
|
if getv(from_object, ['response']) is not None:
|
204
218
|
raise ValueError('response parameter is not supported in Gemini API.')
|
@@ -217,9 +231,9 @@ def _FunctionDeclaration_to_mldev(
|
|
217
231
|
|
218
232
|
def _GoogleSearch_to_mldev(
|
219
233
|
api_client: BaseApiClient,
|
220
|
-
from_object: Union[dict, object],
|
221
|
-
parent_object: Optional[dict] = None,
|
222
|
-
) -> dict:
|
234
|
+
from_object: Union[dict[str, Any], object],
|
235
|
+
parent_object: Optional[dict[str, Any]] = None,
|
236
|
+
) -> dict[str, Any]:
|
223
237
|
to_object: dict[str, Any] = {}
|
224
238
|
|
225
239
|
return to_object
|
@@ -227,9 +241,9 @@ def _GoogleSearch_to_mldev(
|
|
227
241
|
|
228
242
|
def _DynamicRetrievalConfig_to_mldev(
|
229
243
|
api_client: BaseApiClient,
|
230
|
-
from_object: Union[dict, object],
|
231
|
-
parent_object: Optional[dict] = None,
|
232
|
-
) -> dict:
|
244
|
+
from_object: Union[dict[str, Any], object],
|
245
|
+
parent_object: Optional[dict[str, Any]] = None,
|
246
|
+
) -> dict[str, Any]:
|
233
247
|
to_object: dict[str, Any] = {}
|
234
248
|
if getv(from_object, ['mode']) is not None:
|
235
249
|
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
@@ -246,9 +260,9 @@ def _DynamicRetrievalConfig_to_mldev(
|
|
246
260
|
|
247
261
|
def _GoogleSearchRetrieval_to_mldev(
|
248
262
|
api_client: BaseApiClient,
|
249
|
-
from_object: Union[dict, object],
|
250
|
-
parent_object: Optional[dict] = None,
|
251
|
-
) -> dict:
|
263
|
+
from_object: Union[dict[str, Any], object],
|
264
|
+
parent_object: Optional[dict[str, Any]] = None,
|
265
|
+
) -> dict[str, Any]:
|
252
266
|
to_object: dict[str, Any] = {}
|
253
267
|
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
254
268
|
setv(
|
@@ -266,9 +280,9 @@ def _GoogleSearchRetrieval_to_mldev(
|
|
266
280
|
|
267
281
|
def _Tool_to_mldev(
|
268
282
|
api_client: BaseApiClient,
|
269
|
-
from_object: Union[dict, object],
|
270
|
-
parent_object: Optional[dict] = None,
|
271
|
-
) -> dict:
|
283
|
+
from_object: Union[dict[str, Any], object],
|
284
|
+
parent_object: Optional[dict[str, Any]] = None,
|
285
|
+
) -> dict[str, Any]:
|
272
286
|
to_object: dict[str, Any] = {}
|
273
287
|
if getv(from_object, ['function_declarations']) is not None:
|
274
288
|
setv(
|
@@ -311,9 +325,9 @@ def _Tool_to_mldev(
|
|
311
325
|
|
312
326
|
def _FunctionCallingConfig_to_mldev(
|
313
327
|
api_client: BaseApiClient,
|
314
|
-
from_object: Union[dict, object],
|
315
|
-
parent_object: Optional[dict] = None,
|
316
|
-
) -> dict:
|
328
|
+
from_object: Union[dict[str, Any], object],
|
329
|
+
parent_object: Optional[dict[str, Any]] = None,
|
330
|
+
) -> dict[str, Any]:
|
317
331
|
to_object: dict[str, Any] = {}
|
318
332
|
if getv(from_object, ['mode']) is not None:
|
319
333
|
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
@@ -330,9 +344,9 @@ def _FunctionCallingConfig_to_mldev(
|
|
330
344
|
|
331
345
|
def _ToolConfig_to_mldev(
|
332
346
|
api_client: BaseApiClient,
|
333
|
-
from_object: Union[dict, object],
|
334
|
-
parent_object: Optional[dict] = None,
|
335
|
-
) -> dict:
|
347
|
+
from_object: Union[dict[str, Any], object],
|
348
|
+
parent_object: Optional[dict[str, Any]] = None,
|
349
|
+
) -> dict[str, Any]:
|
336
350
|
to_object: dict[str, Any] = {}
|
337
351
|
if getv(from_object, ['function_calling_config']) is not None:
|
338
352
|
setv(
|
@@ -350,9 +364,9 @@ def _ToolConfig_to_mldev(
|
|
350
364
|
|
351
365
|
def _PrebuiltVoiceConfig_to_mldev(
|
352
366
|
api_client: BaseApiClient,
|
353
|
-
from_object: Union[dict, object],
|
354
|
-
parent_object: Optional[dict] = None,
|
355
|
-
) -> dict:
|
367
|
+
from_object: Union[dict[str, Any], object],
|
368
|
+
parent_object: Optional[dict[str, Any]] = None,
|
369
|
+
) -> dict[str, Any]:
|
356
370
|
to_object: dict[str, Any] = {}
|
357
371
|
if getv(from_object, ['voice_name']) is not None:
|
358
372
|
setv(to_object, ['voiceName'], getv(from_object, ['voice_name']))
|
@@ -362,9 +376,9 @@ def _PrebuiltVoiceConfig_to_mldev(
|
|
362
376
|
|
363
377
|
def _VoiceConfig_to_mldev(
|
364
378
|
api_client: BaseApiClient,
|
365
|
-
from_object: Union[dict, object],
|
366
|
-
parent_object: Optional[dict] = None,
|
367
|
-
) -> dict:
|
379
|
+
from_object: Union[dict[str, Any], object],
|
380
|
+
parent_object: Optional[dict[str, Any]] = None,
|
381
|
+
) -> dict[str, Any]:
|
368
382
|
to_object: dict[str, Any] = {}
|
369
383
|
if getv(from_object, ['prebuilt_voice_config']) is not None:
|
370
384
|
setv(
|
@@ -380,9 +394,9 @@ def _VoiceConfig_to_mldev(
|
|
380
394
|
|
381
395
|
def _SpeechConfig_to_mldev(
|
382
396
|
api_client: BaseApiClient,
|
383
|
-
from_object: Union[dict, object],
|
384
|
-
parent_object: Optional[dict] = None,
|
385
|
-
) -> dict:
|
397
|
+
from_object: Union[dict[str, Any], object],
|
398
|
+
parent_object: Optional[dict[str, Any]] = None,
|
399
|
+
) -> dict[str, Any]:
|
386
400
|
to_object: dict[str, Any] = {}
|
387
401
|
if getv(from_object, ['voice_config']) is not None:
|
388
402
|
setv(
|
@@ -393,14 +407,17 @@ def _SpeechConfig_to_mldev(
|
|
393
407
|
),
|
394
408
|
)
|
395
409
|
|
410
|
+
if getv(from_object, ['language_code']) is not None:
|
411
|
+
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
412
|
+
|
396
413
|
return to_object
|
397
414
|
|
398
415
|
|
399
416
|
def _ThinkingConfig_to_mldev(
|
400
417
|
api_client: BaseApiClient,
|
401
|
-
from_object: Union[dict, object],
|
402
|
-
parent_object: Optional[dict] = None,
|
403
|
-
) -> dict:
|
418
|
+
from_object: Union[dict[str, Any], object],
|
419
|
+
parent_object: Optional[dict[str, Any]] = None,
|
420
|
+
) -> dict[str, Any]:
|
404
421
|
to_object: dict[str, Any] = {}
|
405
422
|
if getv(from_object, ['include_thoughts']) is not None:
|
406
423
|
setv(
|
@@ -415,9 +432,9 @@ def _ThinkingConfig_to_mldev(
|
|
415
432
|
|
416
433
|
def _GenerateContentConfig_to_mldev(
|
417
434
|
api_client: BaseApiClient,
|
418
|
-
from_object: Union[dict, object],
|
419
|
-
parent_object: Optional[dict] = None,
|
420
|
-
) -> dict:
|
435
|
+
from_object: Union[dict[str, Any], object],
|
436
|
+
parent_object: Optional[dict[str, Any]] = None,
|
437
|
+
) -> dict[str, Any]:
|
421
438
|
to_object: dict[str, Any] = {}
|
422
439
|
|
423
440
|
if getv(from_object, ['system_instruction']) is not None:
|
@@ -497,6 +514,11 @@ def _GenerateContentConfig_to_mldev(
|
|
497
514
|
if getv(from_object, ['routing_config']) is not None:
|
498
515
|
raise ValueError('routing_config parameter is not supported in Gemini API.')
|
499
516
|
|
517
|
+
if getv(from_object, ['model_selection_config']) is not None:
|
518
|
+
raise ValueError(
|
519
|
+
'model_selection_config parameter is not supported in Gemini API.'
|
520
|
+
)
|
521
|
+
|
500
522
|
if getv(from_object, ['safety_settings']) is not None:
|
501
523
|
setv(
|
502
524
|
parent_object,
|
@@ -580,9 +602,9 @@ def _GenerateContentConfig_to_mldev(
|
|
580
602
|
|
581
603
|
def _GenerateContentParameters_to_mldev(
|
582
604
|
api_client: BaseApiClient,
|
583
|
-
from_object: Union[dict, object],
|
584
|
-
parent_object: Optional[dict] = None,
|
585
|
-
) -> dict:
|
605
|
+
from_object: Union[dict[str, Any], object],
|
606
|
+
parent_object: Optional[dict[str, Any]] = None,
|
607
|
+
) -> dict[str, Any]:
|
586
608
|
to_object: dict[str, Any] = {}
|
587
609
|
if getv(from_object, ['model']) is not None:
|
588
610
|
setv(
|
@@ -617,9 +639,9 @@ def _GenerateContentParameters_to_mldev(
|
|
617
639
|
|
618
640
|
def _EmbedContentConfig_to_mldev(
|
619
641
|
api_client: BaseApiClient,
|
620
|
-
from_object: Union[dict, object],
|
621
|
-
parent_object: Optional[dict] = None,
|
622
|
-
) -> dict:
|
642
|
+
from_object: Union[dict[str, Any], object],
|
643
|
+
parent_object: Optional[dict[str, Any]] = None,
|
644
|
+
) -> dict[str, Any]:
|
623
645
|
to_object: dict[str, Any] = {}
|
624
646
|
|
625
647
|
if getv(from_object, ['task_type']) is not None:
|
@@ -650,9 +672,9 @@ def _EmbedContentConfig_to_mldev(
|
|
650
672
|
|
651
673
|
def _EmbedContentParameters_to_mldev(
|
652
674
|
api_client: BaseApiClient,
|
653
|
-
from_object: Union[dict, object],
|
654
|
-
parent_object: Optional[dict] = None,
|
655
|
-
) -> dict:
|
675
|
+
from_object: Union[dict[str, Any], object],
|
676
|
+
parent_object: Optional[dict[str, Any]] = None,
|
677
|
+
) -> dict[str, Any]:
|
656
678
|
to_object: dict[str, Any] = {}
|
657
679
|
if getv(from_object, ['model']) is not None:
|
658
680
|
setv(
|
@@ -687,9 +709,9 @@ def _EmbedContentParameters_to_mldev(
|
|
687
709
|
|
688
710
|
def _GenerateImagesConfig_to_mldev(
|
689
711
|
api_client: BaseApiClient,
|
690
|
-
from_object: Union[dict, object],
|
691
|
-
parent_object: Optional[dict] = None,
|
692
|
-
) -> dict:
|
712
|
+
from_object: Union[dict[str, Any], object],
|
713
|
+
parent_object: Optional[dict[str, Any]] = None,
|
714
|
+
) -> dict[str, Any]:
|
693
715
|
to_object: dict[str, Any] = {}
|
694
716
|
|
695
717
|
if getv(from_object, ['output_gcs_uri']) is not None:
|
@@ -790,9 +812,9 @@ def _GenerateImagesConfig_to_mldev(
|
|
790
812
|
|
791
813
|
def _GenerateImagesParameters_to_mldev(
|
792
814
|
api_client: BaseApiClient,
|
793
|
-
from_object: Union[dict, object],
|
794
|
-
parent_object: Optional[dict] = None,
|
795
|
-
) -> dict:
|
815
|
+
from_object: Union[dict[str, Any], object],
|
816
|
+
parent_object: Optional[dict[str, Any]] = None,
|
817
|
+
) -> dict[str, Any]:
|
796
818
|
to_object: dict[str, Any] = {}
|
797
819
|
if getv(from_object, ['model']) is not None:
|
798
820
|
setv(
|
@@ -818,9 +840,9 @@ def _GenerateImagesParameters_to_mldev(
|
|
818
840
|
|
819
841
|
def _GetModelParameters_to_mldev(
|
820
842
|
api_client: BaseApiClient,
|
821
|
-
from_object: Union[dict, object],
|
822
|
-
parent_object: Optional[dict] = None,
|
823
|
-
) -> dict:
|
843
|
+
from_object: Union[dict[str, Any], object],
|
844
|
+
parent_object: Optional[dict[str, Any]] = None,
|
845
|
+
) -> dict[str, Any]:
|
824
846
|
to_object: dict[str, Any] = {}
|
825
847
|
if getv(from_object, ['model']) is not None:
|
826
848
|
setv(
|
@@ -837,9 +859,9 @@ def _GetModelParameters_to_mldev(
|
|
837
859
|
|
838
860
|
def _ListModelsConfig_to_mldev(
|
839
861
|
api_client: BaseApiClient,
|
840
|
-
from_object: Union[dict, object],
|
841
|
-
parent_object: Optional[dict] = None,
|
842
|
-
) -> dict:
|
862
|
+
from_object: Union[dict[str, Any], object],
|
863
|
+
parent_object: Optional[dict[str, Any]] = None,
|
864
|
+
) -> dict[str, Any]:
|
843
865
|
to_object: dict[str, Any] = {}
|
844
866
|
|
845
867
|
if getv(from_object, ['page_size']) is not None:
|
@@ -869,9 +891,9 @@ def _ListModelsConfig_to_mldev(
|
|
869
891
|
|
870
892
|
def _ListModelsParameters_to_mldev(
|
871
893
|
api_client: BaseApiClient,
|
872
|
-
from_object: Union[dict, object],
|
873
|
-
parent_object: Optional[dict] = None,
|
874
|
-
) -> dict:
|
894
|
+
from_object: Union[dict[str, Any], object],
|
895
|
+
parent_object: Optional[dict[str, Any]] = None,
|
896
|
+
) -> dict[str, Any]:
|
875
897
|
to_object: dict[str, Any] = {}
|
876
898
|
if getv(from_object, ['config']) is not None:
|
877
899
|
setv(
|
@@ -887,9 +909,9 @@ def _ListModelsParameters_to_mldev(
|
|
887
909
|
|
888
910
|
def _UpdateModelConfig_to_mldev(
|
889
911
|
api_client: BaseApiClient,
|
890
|
-
from_object: Union[dict, object],
|
891
|
-
parent_object: Optional[dict] = None,
|
892
|
-
) -> dict:
|
912
|
+
from_object: Union[dict[str, Any], object],
|
913
|
+
parent_object: Optional[dict[str, Any]] = None,
|
914
|
+
) -> dict[str, Any]:
|
893
915
|
to_object: dict[str, Any] = {}
|
894
916
|
|
895
917
|
if getv(from_object, ['display_name']) is not None:
|
@@ -903,9 +925,9 @@ def _UpdateModelConfig_to_mldev(
|
|
903
925
|
|
904
926
|
def _UpdateModelParameters_to_mldev(
|
905
927
|
api_client: BaseApiClient,
|
906
|
-
from_object: Union[dict, object],
|
907
|
-
parent_object: Optional[dict] = None,
|
908
|
-
) -> dict:
|
928
|
+
from_object: Union[dict[str, Any], object],
|
929
|
+
parent_object: Optional[dict[str, Any]] = None,
|
930
|
+
) -> dict[str, Any]:
|
909
931
|
to_object: dict[str, Any] = {}
|
910
932
|
if getv(from_object, ['model']) is not None:
|
911
933
|
setv(
|
@@ -928,9 +950,9 @@ def _UpdateModelParameters_to_mldev(
|
|
928
950
|
|
929
951
|
def _DeleteModelParameters_to_mldev(
|
930
952
|
api_client: BaseApiClient,
|
931
|
-
from_object: Union[dict, object],
|
932
|
-
parent_object: Optional[dict] = None,
|
933
|
-
) -> dict:
|
953
|
+
from_object: Union[dict[str, Any], object],
|
954
|
+
parent_object: Optional[dict[str, Any]] = None,
|
955
|
+
) -> dict[str, Any]:
|
934
956
|
to_object: dict[str, Any] = {}
|
935
957
|
if getv(from_object, ['model']) is not None:
|
936
958
|
setv(
|
@@ -947,9 +969,9 @@ def _DeleteModelParameters_to_mldev(
|
|
947
969
|
|
948
970
|
def _CountTokensConfig_to_mldev(
|
949
971
|
api_client: BaseApiClient,
|
950
|
-
from_object: Union[dict, object],
|
951
|
-
parent_object: Optional[dict] = None,
|
952
|
-
) -> dict:
|
972
|
+
from_object: Union[dict[str, Any], object],
|
973
|
+
parent_object: Optional[dict[str, Any]] = None,
|
974
|
+
) -> dict[str, Any]:
|
953
975
|
to_object: dict[str, Any] = {}
|
954
976
|
|
955
977
|
if getv(from_object, ['system_instruction']) is not None:
|
@@ -970,9 +992,9 @@ def _CountTokensConfig_to_mldev(
|
|
970
992
|
|
971
993
|
def _CountTokensParameters_to_mldev(
|
972
994
|
api_client: BaseApiClient,
|
973
|
-
from_object: Union[dict, object],
|
974
|
-
parent_object: Optional[dict] = None,
|
975
|
-
) -> dict:
|
995
|
+
from_object: Union[dict[str, Any], object],
|
996
|
+
parent_object: Optional[dict[str, Any]] = None,
|
997
|
+
) -> dict[str, Any]:
|
976
998
|
to_object: dict[str, Any] = {}
|
977
999
|
if getv(from_object, ['model']) is not None:
|
978
1000
|
setv(
|
@@ -1007,9 +1029,9 @@ def _CountTokensParameters_to_mldev(
|
|
1007
1029
|
|
1008
1030
|
def _Image_to_mldev(
|
1009
1031
|
api_client: BaseApiClient,
|
1010
|
-
from_object: Union[dict, object],
|
1011
|
-
parent_object: Optional[dict] = None,
|
1012
|
-
) -> dict:
|
1032
|
+
from_object: Union[dict[str, Any], object],
|
1033
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1034
|
+
) -> dict[str, Any]:
|
1013
1035
|
to_object: dict[str, Any] = {}
|
1014
1036
|
if getv(from_object, ['gcs_uri']) is not None:
|
1015
1037
|
raise ValueError('gcs_uri parameter is not supported in Gemini API.')
|
@@ -1029,9 +1051,9 @@ def _Image_to_mldev(
|
|
1029
1051
|
|
1030
1052
|
def _GenerateVideosConfig_to_mldev(
|
1031
1053
|
api_client: BaseApiClient,
|
1032
|
-
from_object: Union[dict, object],
|
1033
|
-
parent_object: Optional[dict] = None,
|
1034
|
-
) -> dict:
|
1054
|
+
from_object: Union[dict[str, Any], object],
|
1055
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1056
|
+
) -> dict[str, Any]:
|
1035
1057
|
to_object: dict[str, Any] = {}
|
1036
1058
|
|
1037
1059
|
if getv(from_object, ['number_of_videos']) is not None:
|
@@ -1092,9 +1114,9 @@ def _GenerateVideosConfig_to_mldev(
|
|
1092
1114
|
|
1093
1115
|
def _GenerateVideosParameters_to_mldev(
|
1094
1116
|
api_client: BaseApiClient,
|
1095
|
-
from_object: Union[dict, object],
|
1096
|
-
parent_object: Optional[dict] = None,
|
1097
|
-
) -> dict:
|
1117
|
+
from_object: Union[dict[str, Any], object],
|
1118
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1119
|
+
) -> dict[str, Any]:
|
1098
1120
|
to_object: dict[str, Any] = {}
|
1099
1121
|
if getv(from_object, ['model']) is not None:
|
1100
1122
|
setv(
|
@@ -1127,9 +1149,9 @@ def _GenerateVideosParameters_to_mldev(
|
|
1127
1149
|
|
1128
1150
|
def _Part_to_vertex(
|
1129
1151
|
api_client: BaseApiClient,
|
1130
|
-
from_object: Union[dict, object],
|
1131
|
-
parent_object: Optional[dict] = None,
|
1132
|
-
) -> dict:
|
1152
|
+
from_object: Union[dict[str, Any], object],
|
1153
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1154
|
+
) -> dict[str, Any]:
|
1133
1155
|
to_object: dict[str, Any] = {}
|
1134
1156
|
if getv(from_object, ['video_metadata']) is not None:
|
1135
1157
|
setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
|
@@ -1171,9 +1193,9 @@ def _Part_to_vertex(
|
|
1171
1193
|
|
1172
1194
|
def _Content_to_vertex(
|
1173
1195
|
api_client: BaseApiClient,
|
1174
|
-
from_object: Union[dict, object],
|
1175
|
-
parent_object: Optional[dict] = None,
|
1176
|
-
) -> dict:
|
1196
|
+
from_object: Union[dict[str, Any], object],
|
1197
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1198
|
+
) -> dict[str, Any]:
|
1177
1199
|
to_object: dict[str, Any] = {}
|
1178
1200
|
if getv(from_object, ['parts']) is not None:
|
1179
1201
|
setv(
|
@@ -1193,9 +1215,9 @@ def _Content_to_vertex(
|
|
1193
1215
|
|
1194
1216
|
def _Schema_to_vertex(
|
1195
1217
|
api_client: BaseApiClient,
|
1196
|
-
from_object: Union[dict, object],
|
1197
|
-
parent_object: Optional[dict] = None,
|
1198
|
-
) -> dict:
|
1218
|
+
from_object: Union[dict[str, Any], object],
|
1219
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1220
|
+
) -> dict[str, Any]:
|
1199
1221
|
to_object: dict[str, Any] = {}
|
1200
1222
|
if getv(from_object, ['example']) is not None:
|
1201
1223
|
setv(to_object, ['example'], getv(from_object, ['example']))
|
@@ -1270,11 +1292,27 @@ def _Schema_to_vertex(
|
|
1270
1292
|
return to_object
|
1271
1293
|
|
1272
1294
|
|
1295
|
+
def _ModelSelectionConfig_to_vertex(
|
1296
|
+
api_client: BaseApiClient,
|
1297
|
+
from_object: Union[dict[str, Any], object],
|
1298
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1299
|
+
) -> dict[str, Any]:
|
1300
|
+
to_object: dict[str, Any] = {}
|
1301
|
+
if getv(from_object, ['feature_selection_preference']) is not None:
|
1302
|
+
setv(
|
1303
|
+
to_object,
|
1304
|
+
['featureSelectionPreference'],
|
1305
|
+
getv(from_object, ['feature_selection_preference']),
|
1306
|
+
)
|
1307
|
+
|
1308
|
+
return to_object
|
1309
|
+
|
1310
|
+
|
1273
1311
|
def _SafetySetting_to_vertex(
|
1274
1312
|
api_client: BaseApiClient,
|
1275
|
-
from_object: Union[dict, object],
|
1276
|
-
parent_object: Optional[dict] = None,
|
1277
|
-
) -> dict:
|
1313
|
+
from_object: Union[dict[str, Any], object],
|
1314
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1315
|
+
) -> dict[str, Any]:
|
1278
1316
|
to_object: dict[str, Any] = {}
|
1279
1317
|
if getv(from_object, ['method']) is not None:
|
1280
1318
|
setv(to_object, ['method'], getv(from_object, ['method']))
|
@@ -1290,9 +1328,9 @@ def _SafetySetting_to_vertex(
|
|
1290
1328
|
|
1291
1329
|
def _FunctionDeclaration_to_vertex(
|
1292
1330
|
api_client: BaseApiClient,
|
1293
|
-
from_object: Union[dict, object],
|
1294
|
-
parent_object: Optional[dict] = None,
|
1295
|
-
) -> dict:
|
1331
|
+
from_object: Union[dict[str, Any], object],
|
1332
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1333
|
+
) -> dict[str, Any]:
|
1296
1334
|
to_object: dict[str, Any] = {}
|
1297
1335
|
if getv(from_object, ['response']) is not None:
|
1298
1336
|
setv(
|
@@ -1317,9 +1355,9 @@ def _FunctionDeclaration_to_vertex(
|
|
1317
1355
|
|
1318
1356
|
def _GoogleSearch_to_vertex(
|
1319
1357
|
api_client: BaseApiClient,
|
1320
|
-
from_object: Union[dict, object],
|
1321
|
-
parent_object: Optional[dict] = None,
|
1322
|
-
) -> dict:
|
1358
|
+
from_object: Union[dict[str, Any], object],
|
1359
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1360
|
+
) -> dict[str, Any]:
|
1323
1361
|
to_object: dict[str, Any] = {}
|
1324
1362
|
|
1325
1363
|
return to_object
|
@@ -1327,9 +1365,9 @@ def _GoogleSearch_to_vertex(
|
|
1327
1365
|
|
1328
1366
|
def _DynamicRetrievalConfig_to_vertex(
|
1329
1367
|
api_client: BaseApiClient,
|
1330
|
-
from_object: Union[dict, object],
|
1331
|
-
parent_object: Optional[dict] = None,
|
1332
|
-
) -> dict:
|
1368
|
+
from_object: Union[dict[str, Any], object],
|
1369
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1370
|
+
) -> dict[str, Any]:
|
1333
1371
|
to_object: dict[str, Any] = {}
|
1334
1372
|
if getv(from_object, ['mode']) is not None:
|
1335
1373
|
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
@@ -1346,9 +1384,9 @@ def _DynamicRetrievalConfig_to_vertex(
|
|
1346
1384
|
|
1347
1385
|
def _GoogleSearchRetrieval_to_vertex(
|
1348
1386
|
api_client: BaseApiClient,
|
1349
|
-
from_object: Union[dict, object],
|
1350
|
-
parent_object: Optional[dict] = None,
|
1351
|
-
) -> dict:
|
1387
|
+
from_object: Union[dict[str, Any], object],
|
1388
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1389
|
+
) -> dict[str, Any]:
|
1352
1390
|
to_object: dict[str, Any] = {}
|
1353
1391
|
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
1354
1392
|
setv(
|
@@ -1366,9 +1404,9 @@ def _GoogleSearchRetrieval_to_vertex(
|
|
1366
1404
|
|
1367
1405
|
def _Tool_to_vertex(
|
1368
1406
|
api_client: BaseApiClient,
|
1369
|
-
from_object: Union[dict, object],
|
1370
|
-
parent_object: Optional[dict] = None,
|
1371
|
-
) -> dict:
|
1407
|
+
from_object: Union[dict[str, Any], object],
|
1408
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1409
|
+
) -> dict[str, Any]:
|
1372
1410
|
to_object: dict[str, Any] = {}
|
1373
1411
|
if getv(from_object, ['function_declarations']) is not None:
|
1374
1412
|
setv(
|
@@ -1411,9 +1449,9 @@ def _Tool_to_vertex(
|
|
1411
1449
|
|
1412
1450
|
def _FunctionCallingConfig_to_vertex(
|
1413
1451
|
api_client: BaseApiClient,
|
1414
|
-
from_object: Union[dict, object],
|
1415
|
-
parent_object: Optional[dict] = None,
|
1416
|
-
) -> dict:
|
1452
|
+
from_object: Union[dict[str, Any], object],
|
1453
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1454
|
+
) -> dict[str, Any]:
|
1417
1455
|
to_object: dict[str, Any] = {}
|
1418
1456
|
if getv(from_object, ['mode']) is not None:
|
1419
1457
|
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
@@ -1430,9 +1468,9 @@ def _FunctionCallingConfig_to_vertex(
|
|
1430
1468
|
|
1431
1469
|
def _ToolConfig_to_vertex(
|
1432
1470
|
api_client: BaseApiClient,
|
1433
|
-
from_object: Union[dict, object],
|
1434
|
-
parent_object: Optional[dict] = None,
|
1435
|
-
) -> dict:
|
1471
|
+
from_object: Union[dict[str, Any], object],
|
1472
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1473
|
+
) -> dict[str, Any]:
|
1436
1474
|
to_object: dict[str, Any] = {}
|
1437
1475
|
if getv(from_object, ['function_calling_config']) is not None:
|
1438
1476
|
setv(
|
@@ -1450,9 +1488,9 @@ def _ToolConfig_to_vertex(
|
|
1450
1488
|
|
1451
1489
|
def _PrebuiltVoiceConfig_to_vertex(
|
1452
1490
|
api_client: BaseApiClient,
|
1453
|
-
from_object: Union[dict, object],
|
1454
|
-
parent_object: Optional[dict] = None,
|
1455
|
-
) -> dict:
|
1491
|
+
from_object: Union[dict[str, Any], object],
|
1492
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1493
|
+
) -> dict[str, Any]:
|
1456
1494
|
to_object: dict[str, Any] = {}
|
1457
1495
|
if getv(from_object, ['voice_name']) is not None:
|
1458
1496
|
setv(to_object, ['voiceName'], getv(from_object, ['voice_name']))
|
@@ -1462,9 +1500,9 @@ def _PrebuiltVoiceConfig_to_vertex(
|
|
1462
1500
|
|
1463
1501
|
def _VoiceConfig_to_vertex(
|
1464
1502
|
api_client: BaseApiClient,
|
1465
|
-
from_object: Union[dict, object],
|
1466
|
-
parent_object: Optional[dict] = None,
|
1467
|
-
) -> dict:
|
1503
|
+
from_object: Union[dict[str, Any], object],
|
1504
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1505
|
+
) -> dict[str, Any]:
|
1468
1506
|
to_object: dict[str, Any] = {}
|
1469
1507
|
if getv(from_object, ['prebuilt_voice_config']) is not None:
|
1470
1508
|
setv(
|
@@ -1480,9 +1518,9 @@ def _VoiceConfig_to_vertex(
|
|
1480
1518
|
|
1481
1519
|
def _SpeechConfig_to_vertex(
|
1482
1520
|
api_client: BaseApiClient,
|
1483
|
-
from_object: Union[dict, object],
|
1484
|
-
parent_object: Optional[dict] = None,
|
1485
|
-
) -> dict:
|
1521
|
+
from_object: Union[dict[str, Any], object],
|
1522
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1523
|
+
) -> dict[str, Any]:
|
1486
1524
|
to_object: dict[str, Any] = {}
|
1487
1525
|
if getv(from_object, ['voice_config']) is not None:
|
1488
1526
|
setv(
|
@@ -1493,14 +1531,17 @@ def _SpeechConfig_to_vertex(
|
|
1493
1531
|
),
|
1494
1532
|
)
|
1495
1533
|
|
1534
|
+
if getv(from_object, ['language_code']) is not None:
|
1535
|
+
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
1536
|
+
|
1496
1537
|
return to_object
|
1497
1538
|
|
1498
1539
|
|
1499
1540
|
def _ThinkingConfig_to_vertex(
|
1500
1541
|
api_client: BaseApiClient,
|
1501
|
-
from_object: Union[dict, object],
|
1502
|
-
parent_object: Optional[dict] = None,
|
1503
|
-
) -> dict:
|
1542
|
+
from_object: Union[dict[str, Any], object],
|
1543
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1544
|
+
) -> dict[str, Any]:
|
1504
1545
|
to_object: dict[str, Any] = {}
|
1505
1546
|
if getv(from_object, ['include_thoughts']) is not None:
|
1506
1547
|
setv(
|
@@ -1515,9 +1556,9 @@ def _ThinkingConfig_to_vertex(
|
|
1515
1556
|
|
1516
1557
|
def _GenerateContentConfig_to_vertex(
|
1517
1558
|
api_client: BaseApiClient,
|
1518
|
-
from_object: Union[dict, object],
|
1519
|
-
parent_object: Optional[dict] = None,
|
1520
|
-
) -> dict:
|
1559
|
+
from_object: Union[dict[str, Any], object],
|
1560
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1561
|
+
) -> dict[str, Any]:
|
1521
1562
|
to_object: dict[str, Any] = {}
|
1522
1563
|
|
1523
1564
|
if getv(from_object, ['system_instruction']) is not None:
|
@@ -1597,6 +1638,15 @@ def _GenerateContentConfig_to_vertex(
|
|
1597
1638
|
if getv(from_object, ['routing_config']) is not None:
|
1598
1639
|
setv(to_object, ['routingConfig'], getv(from_object, ['routing_config']))
|
1599
1640
|
|
1641
|
+
if getv(from_object, ['model_selection_config']) is not None:
|
1642
|
+
setv(
|
1643
|
+
to_object,
|
1644
|
+
['modelConfig'],
|
1645
|
+
_ModelSelectionConfig_to_vertex(
|
1646
|
+
api_client, getv(from_object, ['model_selection_config']), to_object
|
1647
|
+
),
|
1648
|
+
)
|
1649
|
+
|
1600
1650
|
if getv(from_object, ['safety_settings']) is not None:
|
1601
1651
|
setv(
|
1602
1652
|
parent_object,
|
@@ -1678,9 +1728,9 @@ def _GenerateContentConfig_to_vertex(
|
|
1678
1728
|
|
1679
1729
|
def _GenerateContentParameters_to_vertex(
|
1680
1730
|
api_client: BaseApiClient,
|
1681
|
-
from_object: Union[dict, object],
|
1682
|
-
parent_object: Optional[dict] = None,
|
1683
|
-
) -> dict:
|
1731
|
+
from_object: Union[dict[str, Any], object],
|
1732
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1733
|
+
) -> dict[str, Any]:
|
1684
1734
|
to_object: dict[str, Any] = {}
|
1685
1735
|
if getv(from_object, ['model']) is not None:
|
1686
1736
|
setv(
|
@@ -1715,9 +1765,9 @@ def _GenerateContentParameters_to_vertex(
|
|
1715
1765
|
|
1716
1766
|
def _EmbedContentConfig_to_vertex(
|
1717
1767
|
api_client: BaseApiClient,
|
1718
|
-
from_object: Union[dict, object],
|
1719
|
-
parent_object: Optional[dict] = None,
|
1720
|
-
) -> dict:
|
1768
|
+
from_object: Union[dict[str, Any], object],
|
1769
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1770
|
+
) -> dict[str, Any]:
|
1721
1771
|
to_object: dict[str, Any] = {}
|
1722
1772
|
|
1723
1773
|
if getv(from_object, ['task_type']) is not None:
|
@@ -1756,9 +1806,9 @@ def _EmbedContentConfig_to_vertex(
|
|
1756
1806
|
|
1757
1807
|
def _EmbedContentParameters_to_vertex(
|
1758
1808
|
api_client: BaseApiClient,
|
1759
|
-
from_object: Union[dict, object],
|
1760
|
-
parent_object: Optional[dict] = None,
|
1761
|
-
) -> dict:
|
1809
|
+
from_object: Union[dict[str, Any], object],
|
1810
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1811
|
+
) -> dict[str, Any]:
|
1762
1812
|
to_object: dict[str, Any] = {}
|
1763
1813
|
if getv(from_object, ['model']) is not None:
|
1764
1814
|
setv(
|
@@ -1788,9 +1838,9 @@ def _EmbedContentParameters_to_vertex(
|
|
1788
1838
|
|
1789
1839
|
def _GenerateImagesConfig_to_vertex(
|
1790
1840
|
api_client: BaseApiClient,
|
1791
|
-
from_object: Union[dict, object],
|
1792
|
-
parent_object: Optional[dict] = None,
|
1793
|
-
) -> dict:
|
1841
|
+
from_object: Union[dict[str, Any], object],
|
1842
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1843
|
+
) -> dict[str, Any]:
|
1794
1844
|
to_object: dict[str, Any] = {}
|
1795
1845
|
|
1796
1846
|
if getv(from_object, ['output_gcs_uri']) is not None:
|
@@ -1899,9 +1949,9 @@ def _GenerateImagesConfig_to_vertex(
|
|
1899
1949
|
|
1900
1950
|
def _GenerateImagesParameters_to_vertex(
|
1901
1951
|
api_client: BaseApiClient,
|
1902
|
-
from_object: Union[dict, object],
|
1903
|
-
parent_object: Optional[dict] = None,
|
1904
|
-
) -> dict:
|
1952
|
+
from_object: Union[dict[str, Any], object],
|
1953
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1954
|
+
) -> dict[str, Any]:
|
1905
1955
|
to_object: dict[str, Any] = {}
|
1906
1956
|
if getv(from_object, ['model']) is not None:
|
1907
1957
|
setv(
|
@@ -1927,9 +1977,9 @@ def _GenerateImagesParameters_to_vertex(
|
|
1927
1977
|
|
1928
1978
|
def _Image_to_vertex(
|
1929
1979
|
api_client: BaseApiClient,
|
1930
|
-
from_object: Union[dict, object],
|
1931
|
-
parent_object: Optional[dict] = None,
|
1932
|
-
) -> dict:
|
1980
|
+
from_object: Union[dict[str, Any], object],
|
1981
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1982
|
+
) -> dict[str, Any]:
|
1933
1983
|
to_object: dict[str, Any] = {}
|
1934
1984
|
if getv(from_object, ['gcs_uri']) is not None:
|
1935
1985
|
setv(to_object, ['gcsUri'], getv(from_object, ['gcs_uri']))
|
@@ -1949,9 +1999,9 @@ def _Image_to_vertex(
|
|
1949
1999
|
|
1950
2000
|
def _MaskReferenceConfig_to_vertex(
|
1951
2001
|
api_client: BaseApiClient,
|
1952
|
-
from_object: Union[dict, object],
|
1953
|
-
parent_object: Optional[dict] = None,
|
1954
|
-
) -> dict:
|
2002
|
+
from_object: Union[dict[str, Any], object],
|
2003
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2004
|
+
) -> dict[str, Any]:
|
1955
2005
|
to_object: dict[str, Any] = {}
|
1956
2006
|
if getv(from_object, ['mask_mode']) is not None:
|
1957
2007
|
setv(to_object, ['maskMode'], getv(from_object, ['mask_mode']))
|
@@ -1969,9 +2019,9 @@ def _MaskReferenceConfig_to_vertex(
|
|
1969
2019
|
|
1970
2020
|
def _ControlReferenceConfig_to_vertex(
|
1971
2021
|
api_client: BaseApiClient,
|
1972
|
-
from_object: Union[dict, object],
|
1973
|
-
parent_object: Optional[dict] = None,
|
1974
|
-
) -> dict:
|
2022
|
+
from_object: Union[dict[str, Any], object],
|
2023
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2024
|
+
) -> dict[str, Any]:
|
1975
2025
|
to_object: dict[str, Any] = {}
|
1976
2026
|
if getv(from_object, ['control_type']) is not None:
|
1977
2027
|
setv(to_object, ['controlType'], getv(from_object, ['control_type']))
|
@@ -1988,9 +2038,9 @@ def _ControlReferenceConfig_to_vertex(
|
|
1988
2038
|
|
1989
2039
|
def _StyleReferenceConfig_to_vertex(
|
1990
2040
|
api_client: BaseApiClient,
|
1991
|
-
from_object: Union[dict, object],
|
1992
|
-
parent_object: Optional[dict] = None,
|
1993
|
-
) -> dict:
|
2041
|
+
from_object: Union[dict[str, Any], object],
|
2042
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2043
|
+
) -> dict[str, Any]:
|
1994
2044
|
to_object: dict[str, Any] = {}
|
1995
2045
|
if getv(from_object, ['style_description']) is not None:
|
1996
2046
|
setv(
|
@@ -2004,9 +2054,9 @@ def _StyleReferenceConfig_to_vertex(
|
|
2004
2054
|
|
2005
2055
|
def _SubjectReferenceConfig_to_vertex(
|
2006
2056
|
api_client: BaseApiClient,
|
2007
|
-
from_object: Union[dict, object],
|
2008
|
-
parent_object: Optional[dict] = None,
|
2009
|
-
) -> dict:
|
2057
|
+
from_object: Union[dict[str, Any], object],
|
2058
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2059
|
+
) -> dict[str, Any]:
|
2010
2060
|
to_object: dict[str, Any] = {}
|
2011
2061
|
if getv(from_object, ['subject_type']) is not None:
|
2012
2062
|
setv(to_object, ['subjectType'], getv(from_object, ['subject_type']))
|
@@ -2023,9 +2073,9 @@ def _SubjectReferenceConfig_to_vertex(
|
|
2023
2073
|
|
2024
2074
|
def _ReferenceImageAPI_to_vertex(
|
2025
2075
|
api_client: BaseApiClient,
|
2026
|
-
from_object: Union[dict, object],
|
2027
|
-
parent_object: Optional[dict] = None,
|
2028
|
-
) -> dict:
|
2076
|
+
from_object: Union[dict[str, Any], object],
|
2077
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2078
|
+
) -> dict[str, Any]:
|
2029
2079
|
to_object: dict[str, Any] = {}
|
2030
2080
|
if getv(from_object, ['reference_image']) is not None:
|
2031
2081
|
setv(
|
@@ -2083,9 +2133,9 @@ def _ReferenceImageAPI_to_vertex(
|
|
2083
2133
|
|
2084
2134
|
def _EditImageConfig_to_vertex(
|
2085
2135
|
api_client: BaseApiClient,
|
2086
|
-
from_object: Union[dict, object],
|
2087
|
-
parent_object: Optional[dict] = None,
|
2088
|
-
) -> dict:
|
2136
|
+
from_object: Union[dict[str, Any], object],
|
2137
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2138
|
+
) -> dict[str, Any]:
|
2089
2139
|
to_object: dict[str, Any] = {}
|
2090
2140
|
|
2091
2141
|
if getv(from_object, ['output_gcs_uri']) is not None:
|
@@ -2194,9 +2244,9 @@ def _EditImageConfig_to_vertex(
|
|
2194
2244
|
|
2195
2245
|
def _EditImageParameters_to_vertex(
|
2196
2246
|
api_client: BaseApiClient,
|
2197
|
-
from_object: Union[dict, object],
|
2198
|
-
parent_object: Optional[dict] = None,
|
2199
|
-
) -> dict:
|
2247
|
+
from_object: Union[dict[str, Any], object],
|
2248
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2249
|
+
) -> dict[str, Any]:
|
2200
2250
|
to_object: dict[str, Any] = {}
|
2201
2251
|
if getv(from_object, ['model']) is not None:
|
2202
2252
|
setv(
|
@@ -2232,9 +2282,9 @@ def _EditImageParameters_to_vertex(
|
|
2232
2282
|
|
2233
2283
|
def _UpscaleImageAPIConfig_to_vertex(
|
2234
2284
|
api_client: BaseApiClient,
|
2235
|
-
from_object: Union[dict, object],
|
2236
|
-
parent_object: Optional[dict] = None,
|
2237
|
-
) -> dict:
|
2285
|
+
from_object: Union[dict[str, Any], object],
|
2286
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2287
|
+
) -> dict[str, Any]:
|
2238
2288
|
to_object: dict[str, Any] = {}
|
2239
2289
|
|
2240
2290
|
if getv(from_object, ['include_rai_reason']) is not None:
|
@@ -2273,9 +2323,9 @@ def _UpscaleImageAPIConfig_to_vertex(
|
|
2273
2323
|
|
2274
2324
|
def _UpscaleImageAPIParameters_to_vertex(
|
2275
2325
|
api_client: BaseApiClient,
|
2276
|
-
from_object: Union[dict, object],
|
2277
|
-
parent_object: Optional[dict] = None,
|
2278
|
-
) -> dict:
|
2326
|
+
from_object: Union[dict[str, Any], object],
|
2327
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2328
|
+
) -> dict[str, Any]:
|
2279
2329
|
to_object: dict[str, Any] = {}
|
2280
2330
|
if getv(from_object, ['model']) is not None:
|
2281
2331
|
setv(
|
@@ -2312,9 +2362,9 @@ def _UpscaleImageAPIParameters_to_vertex(
|
|
2312
2362
|
|
2313
2363
|
def _GetModelParameters_to_vertex(
|
2314
2364
|
api_client: BaseApiClient,
|
2315
|
-
from_object: Union[dict, object],
|
2316
|
-
parent_object: Optional[dict] = None,
|
2317
|
-
) -> dict:
|
2365
|
+
from_object: Union[dict[str, Any], object],
|
2366
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2367
|
+
) -> dict[str, Any]:
|
2318
2368
|
to_object: dict[str, Any] = {}
|
2319
2369
|
if getv(from_object, ['model']) is not None:
|
2320
2370
|
setv(
|
@@ -2331,9 +2381,9 @@ def _GetModelParameters_to_vertex(
|
|
2331
2381
|
|
2332
2382
|
def _ListModelsConfig_to_vertex(
|
2333
2383
|
api_client: BaseApiClient,
|
2334
|
-
from_object: Union[dict, object],
|
2335
|
-
parent_object: Optional[dict] = None,
|
2336
|
-
) -> dict:
|
2384
|
+
from_object: Union[dict[str, Any], object],
|
2385
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2386
|
+
) -> dict[str, Any]:
|
2337
2387
|
to_object: dict[str, Any] = {}
|
2338
2388
|
|
2339
2389
|
if getv(from_object, ['page_size']) is not None:
|
@@ -2363,9 +2413,9 @@ def _ListModelsConfig_to_vertex(
|
|
2363
2413
|
|
2364
2414
|
def _ListModelsParameters_to_vertex(
|
2365
2415
|
api_client: BaseApiClient,
|
2366
|
-
from_object: Union[dict, object],
|
2367
|
-
parent_object: Optional[dict] = None,
|
2368
|
-
) -> dict:
|
2416
|
+
from_object: Union[dict[str, Any], object],
|
2417
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2418
|
+
) -> dict[str, Any]:
|
2369
2419
|
to_object: dict[str, Any] = {}
|
2370
2420
|
if getv(from_object, ['config']) is not None:
|
2371
2421
|
setv(
|
@@ -2381,9 +2431,9 @@ def _ListModelsParameters_to_vertex(
|
|
2381
2431
|
|
2382
2432
|
def _UpdateModelConfig_to_vertex(
|
2383
2433
|
api_client: BaseApiClient,
|
2384
|
-
from_object: Union[dict, object],
|
2385
|
-
parent_object: Optional[dict] = None,
|
2386
|
-
) -> dict:
|
2434
|
+
from_object: Union[dict[str, Any], object],
|
2435
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2436
|
+
) -> dict[str, Any]:
|
2387
2437
|
to_object: dict[str, Any] = {}
|
2388
2438
|
|
2389
2439
|
if getv(from_object, ['display_name']) is not None:
|
@@ -2397,9 +2447,9 @@ def _UpdateModelConfig_to_vertex(
|
|
2397
2447
|
|
2398
2448
|
def _UpdateModelParameters_to_vertex(
|
2399
2449
|
api_client: BaseApiClient,
|
2400
|
-
from_object: Union[dict, object],
|
2401
|
-
parent_object: Optional[dict] = None,
|
2402
|
-
) -> dict:
|
2450
|
+
from_object: Union[dict[str, Any], object],
|
2451
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2452
|
+
) -> dict[str, Any]:
|
2403
2453
|
to_object: dict[str, Any] = {}
|
2404
2454
|
if getv(from_object, ['model']) is not None:
|
2405
2455
|
setv(
|
@@ -2422,9 +2472,9 @@ def _UpdateModelParameters_to_vertex(
|
|
2422
2472
|
|
2423
2473
|
def _DeleteModelParameters_to_vertex(
|
2424
2474
|
api_client: BaseApiClient,
|
2425
|
-
from_object: Union[dict, object],
|
2426
|
-
parent_object: Optional[dict] = None,
|
2427
|
-
) -> dict:
|
2475
|
+
from_object: Union[dict[str, Any], object],
|
2476
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2477
|
+
) -> dict[str, Any]:
|
2428
2478
|
to_object: dict[str, Any] = {}
|
2429
2479
|
if getv(from_object, ['model']) is not None:
|
2430
2480
|
setv(
|
@@ -2441,9 +2491,9 @@ def _DeleteModelParameters_to_vertex(
|
|
2441
2491
|
|
2442
2492
|
def _CountTokensConfig_to_vertex(
|
2443
2493
|
api_client: BaseApiClient,
|
2444
|
-
from_object: Union[dict, object],
|
2445
|
-
parent_object: Optional[dict] = None,
|
2446
|
-
) -> dict:
|
2494
|
+
from_object: Union[dict[str, Any], object],
|
2495
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2496
|
+
) -> dict[str, Any]:
|
2447
2497
|
to_object: dict[str, Any] = {}
|
2448
2498
|
|
2449
2499
|
if getv(from_object, ['system_instruction']) is not None:
|
@@ -2479,9 +2529,9 @@ def _CountTokensConfig_to_vertex(
|
|
2479
2529
|
|
2480
2530
|
def _CountTokensParameters_to_vertex(
|
2481
2531
|
api_client: BaseApiClient,
|
2482
|
-
from_object: Union[dict, object],
|
2483
|
-
parent_object: Optional[dict] = None,
|
2484
|
-
) -> dict:
|
2532
|
+
from_object: Union[dict[str, Any], object],
|
2533
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2534
|
+
) -> dict[str, Any]:
|
2485
2535
|
to_object: dict[str, Any] = {}
|
2486
2536
|
if getv(from_object, ['model']) is not None:
|
2487
2537
|
setv(
|
@@ -2516,9 +2566,9 @@ def _CountTokensParameters_to_vertex(
|
|
2516
2566
|
|
2517
2567
|
def _ComputeTokensParameters_to_vertex(
|
2518
2568
|
api_client: BaseApiClient,
|
2519
|
-
from_object: Union[dict, object],
|
2520
|
-
parent_object: Optional[dict] = None,
|
2521
|
-
) -> dict:
|
2569
|
+
from_object: Union[dict[str, Any], object],
|
2570
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2571
|
+
) -> dict[str, Any]:
|
2522
2572
|
to_object: dict[str, Any] = {}
|
2523
2573
|
if getv(from_object, ['model']) is not None:
|
2524
2574
|
setv(
|
@@ -2547,9 +2597,9 @@ def _ComputeTokensParameters_to_vertex(
|
|
2547
2597
|
|
2548
2598
|
def _GenerateVideosConfig_to_vertex(
|
2549
2599
|
api_client: BaseApiClient,
|
2550
|
-
from_object: Union[dict, object],
|
2551
|
-
parent_object: Optional[dict] = None,
|
2552
|
-
) -> dict:
|
2600
|
+
from_object: Union[dict[str, Any], object],
|
2601
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2602
|
+
) -> dict[str, Any]:
|
2553
2603
|
to_object: dict[str, Any] = {}
|
2554
2604
|
|
2555
2605
|
if getv(from_object, ['number_of_videos']) is not None:
|
@@ -2626,9 +2676,9 @@ def _GenerateVideosConfig_to_vertex(
|
|
2626
2676
|
|
2627
2677
|
def _GenerateVideosParameters_to_vertex(
|
2628
2678
|
api_client: BaseApiClient,
|
2629
|
-
from_object: Union[dict, object],
|
2630
|
-
parent_object: Optional[dict] = None,
|
2631
|
-
) -> dict:
|
2679
|
+
from_object: Union[dict[str, Any], object],
|
2680
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2681
|
+
) -> dict[str, Any]:
|
2632
2682
|
to_object: dict[str, Any] = {}
|
2633
2683
|
if getv(from_object, ['model']) is not None:
|
2634
2684
|
setv(
|
@@ -2659,21 +2709,31 @@ def _GenerateVideosParameters_to_vertex(
|
|
2659
2709
|
return to_object
|
2660
2710
|
|
2661
2711
|
|
2662
|
-
def
|
2712
|
+
def _FeatureSelectionPreference_to_mldev_enum_validate(enum_value: Any) -> None:
|
2713
|
+
if enum_value in set([
|
2714
|
+
'FEATURE_SELECTION_PREFERENCE_UNSPECIFIED',
|
2715
|
+
'PRIORITIZE_QUALITY',
|
2716
|
+
'BALANCED',
|
2717
|
+
'PRIORITIZE_COST',
|
2718
|
+
]):
|
2719
|
+
raise ValueError(f'{enum_value} enum value is not supported in Gemini API.')
|
2720
|
+
|
2721
|
+
|
2722
|
+
def _SafetyFilterLevel_to_mldev_enum_validate(enum_value: Any) -> None:
|
2663
2723
|
if enum_value in set(['BLOCK_NONE']):
|
2664
2724
|
raise ValueError(f'{enum_value} enum value is not supported in Gemini API.')
|
2665
2725
|
|
2666
2726
|
|
2667
|
-
def _PersonGeneration_to_mldev_enum_validate(enum_value: Any):
|
2727
|
+
def _PersonGeneration_to_mldev_enum_validate(enum_value: Any) -> None:
|
2668
2728
|
if enum_value in set(['ALLOW_ALL']):
|
2669
2729
|
raise ValueError(f'{enum_value} enum value is not supported in Gemini API.')
|
2670
2730
|
|
2671
2731
|
|
2672
2732
|
def _Part_from_mldev(
|
2673
2733
|
api_client: BaseApiClient,
|
2674
|
-
from_object: Union[dict, object],
|
2675
|
-
parent_object: Optional[dict] = None,
|
2676
|
-
) -> dict:
|
2734
|
+
from_object: Union[dict[str, Any], object],
|
2735
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2736
|
+
) -> dict[str, Any]:
|
2677
2737
|
to_object: dict[str, Any] = {}
|
2678
2738
|
|
2679
2739
|
if getv(from_object, ['thought']) is not None:
|
@@ -2713,9 +2773,9 @@ def _Part_from_mldev(
|
|
2713
2773
|
|
2714
2774
|
def _Content_from_mldev(
|
2715
2775
|
api_client: BaseApiClient,
|
2716
|
-
from_object: Union[dict, object],
|
2717
|
-
parent_object: Optional[dict] = None,
|
2718
|
-
) -> dict:
|
2776
|
+
from_object: Union[dict[str, Any], object],
|
2777
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2778
|
+
) -> dict[str, Any]:
|
2719
2779
|
to_object: dict[str, Any] = {}
|
2720
2780
|
if getv(from_object, ['parts']) is not None:
|
2721
2781
|
setv(
|
@@ -2735,9 +2795,9 @@ def _Content_from_mldev(
|
|
2735
2795
|
|
2736
2796
|
def _CitationMetadata_from_mldev(
|
2737
2797
|
api_client: BaseApiClient,
|
2738
|
-
from_object: Union[dict, object],
|
2739
|
-
parent_object: Optional[dict] = None,
|
2740
|
-
) -> dict:
|
2798
|
+
from_object: Union[dict[str, Any], object],
|
2799
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2800
|
+
) -> dict[str, Any]:
|
2741
2801
|
to_object: dict[str, Any] = {}
|
2742
2802
|
if getv(from_object, ['citationSources']) is not None:
|
2743
2803
|
setv(to_object, ['citations'], getv(from_object, ['citationSources']))
|
@@ -2747,9 +2807,9 @@ def _CitationMetadata_from_mldev(
|
|
2747
2807
|
|
2748
2808
|
def _Candidate_from_mldev(
|
2749
2809
|
api_client: BaseApiClient,
|
2750
|
-
from_object: Union[dict, object],
|
2751
|
-
parent_object: Optional[dict] = None,
|
2752
|
-
) -> dict:
|
2810
|
+
from_object: Union[dict[str, Any], object],
|
2811
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2812
|
+
) -> dict[str, Any]:
|
2753
2813
|
to_object: dict[str, Any] = {}
|
2754
2814
|
if getv(from_object, ['content']) is not None:
|
2755
2815
|
setv(
|
@@ -2799,9 +2859,9 @@ def _Candidate_from_mldev(
|
|
2799
2859
|
|
2800
2860
|
def _GenerateContentResponse_from_mldev(
|
2801
2861
|
api_client: BaseApiClient,
|
2802
|
-
from_object: Union[dict, object],
|
2803
|
-
parent_object: Optional[dict] = None,
|
2804
|
-
) -> dict:
|
2862
|
+
from_object: Union[dict[str, Any], object],
|
2863
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2864
|
+
) -> dict[str, Any]:
|
2805
2865
|
to_object: dict[str, Any] = {}
|
2806
2866
|
if getv(from_object, ['candidates']) is not None:
|
2807
2867
|
setv(
|
@@ -2827,9 +2887,9 @@ def _GenerateContentResponse_from_mldev(
|
|
2827
2887
|
|
2828
2888
|
def _ContentEmbeddingStatistics_from_mldev(
|
2829
2889
|
api_client: BaseApiClient,
|
2830
|
-
from_object: Union[dict, object],
|
2831
|
-
parent_object: Optional[dict] = None,
|
2832
|
-
) -> dict:
|
2890
|
+
from_object: Union[dict[str, Any], object],
|
2891
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2892
|
+
) -> dict[str, Any]:
|
2833
2893
|
to_object: dict[str, Any] = {}
|
2834
2894
|
|
2835
2895
|
return to_object
|
@@ -2837,9 +2897,9 @@ def _ContentEmbeddingStatistics_from_mldev(
|
|
2837
2897
|
|
2838
2898
|
def _ContentEmbedding_from_mldev(
|
2839
2899
|
api_client: BaseApiClient,
|
2840
|
-
from_object: Union[dict, object],
|
2841
|
-
parent_object: Optional[dict] = None,
|
2842
|
-
) -> dict:
|
2900
|
+
from_object: Union[dict[str, Any], object],
|
2901
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2902
|
+
) -> dict[str, Any]:
|
2843
2903
|
to_object: dict[str, Any] = {}
|
2844
2904
|
if getv(from_object, ['values']) is not None:
|
2845
2905
|
setv(to_object, ['values'], getv(from_object, ['values']))
|
@@ -2849,9 +2909,9 @@ def _ContentEmbedding_from_mldev(
|
|
2849
2909
|
|
2850
2910
|
def _EmbedContentMetadata_from_mldev(
|
2851
2911
|
api_client: BaseApiClient,
|
2852
|
-
from_object: Union[dict, object],
|
2853
|
-
parent_object: Optional[dict] = None,
|
2854
|
-
) -> dict:
|
2912
|
+
from_object: Union[dict[str, Any], object],
|
2913
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2914
|
+
) -> dict[str, Any]:
|
2855
2915
|
to_object: dict[str, Any] = {}
|
2856
2916
|
|
2857
2917
|
return to_object
|
@@ -2859,9 +2919,9 @@ def _EmbedContentMetadata_from_mldev(
|
|
2859
2919
|
|
2860
2920
|
def _EmbedContentResponse_from_mldev(
|
2861
2921
|
api_client: BaseApiClient,
|
2862
|
-
from_object: Union[dict, object],
|
2863
|
-
parent_object: Optional[dict] = None,
|
2864
|
-
) -> dict:
|
2922
|
+
from_object: Union[dict[str, Any], object],
|
2923
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2924
|
+
) -> dict[str, Any]:
|
2865
2925
|
to_object: dict[str, Any] = {}
|
2866
2926
|
if getv(from_object, ['embeddings']) is not None:
|
2867
2927
|
setv(
|
@@ -2887,9 +2947,9 @@ def _EmbedContentResponse_from_mldev(
|
|
2887
2947
|
|
2888
2948
|
def _Image_from_mldev(
|
2889
2949
|
api_client: BaseApiClient,
|
2890
|
-
from_object: Union[dict, object],
|
2891
|
-
parent_object: Optional[dict] = None,
|
2892
|
-
) -> dict:
|
2950
|
+
from_object: Union[dict[str, Any], object],
|
2951
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2952
|
+
) -> dict[str, Any]:
|
2893
2953
|
to_object: dict[str, Any] = {}
|
2894
2954
|
|
2895
2955
|
if getv(from_object, ['bytesBase64Encoded']) is not None:
|
@@ -2907,9 +2967,9 @@ def _Image_from_mldev(
|
|
2907
2967
|
|
2908
2968
|
def _SafetyAttributes_from_mldev(
|
2909
2969
|
api_client: BaseApiClient,
|
2910
|
-
from_object: Union[dict, object],
|
2911
|
-
parent_object: Optional[dict] = None,
|
2912
|
-
) -> dict:
|
2970
|
+
from_object: Union[dict[str, Any], object],
|
2971
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2972
|
+
) -> dict[str, Any]:
|
2913
2973
|
to_object: dict[str, Any] = {}
|
2914
2974
|
if getv(from_object, ['safetyAttributes', 'categories']) is not None:
|
2915
2975
|
setv(
|
@@ -2931,9 +2991,9 @@ def _SafetyAttributes_from_mldev(
|
|
2931
2991
|
|
2932
2992
|
def _GeneratedImage_from_mldev(
|
2933
2993
|
api_client: BaseApiClient,
|
2934
|
-
from_object: Union[dict, object],
|
2935
|
-
parent_object: Optional[dict] = None,
|
2936
|
-
) -> dict:
|
2994
|
+
from_object: Union[dict[str, Any], object],
|
2995
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2996
|
+
) -> dict[str, Any]:
|
2937
2997
|
to_object: dict[str, Any] = {}
|
2938
2998
|
if getv(from_object, ['_self']) is not None:
|
2939
2999
|
setv(
|
@@ -2963,9 +3023,9 @@ def _GeneratedImage_from_mldev(
|
|
2963
3023
|
|
2964
3024
|
def _GenerateImagesResponse_from_mldev(
|
2965
3025
|
api_client: BaseApiClient,
|
2966
|
-
from_object: Union[dict, object],
|
2967
|
-
parent_object: Optional[dict] = None,
|
2968
|
-
) -> dict:
|
3026
|
+
from_object: Union[dict[str, Any], object],
|
3027
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3028
|
+
) -> dict[str, Any]:
|
2969
3029
|
to_object: dict[str, Any] = {}
|
2970
3030
|
if getv(from_object, ['predictions']) is not None:
|
2971
3031
|
setv(
|
@@ -2993,9 +3053,9 @@ def _GenerateImagesResponse_from_mldev(
|
|
2993
3053
|
|
2994
3054
|
def _Endpoint_from_mldev(
|
2995
3055
|
api_client: BaseApiClient,
|
2996
|
-
from_object: Union[dict, object],
|
2997
|
-
parent_object: Optional[dict] = None,
|
2998
|
-
) -> dict:
|
3056
|
+
from_object: Union[dict[str, Any], object],
|
3057
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3058
|
+
) -> dict[str, Any]:
|
2999
3059
|
to_object: dict[str, Any] = {}
|
3000
3060
|
|
3001
3061
|
return to_object
|
@@ -3003,9 +3063,9 @@ def _Endpoint_from_mldev(
|
|
3003
3063
|
|
3004
3064
|
def _TunedModelInfo_from_mldev(
|
3005
3065
|
api_client: BaseApiClient,
|
3006
|
-
from_object: Union[dict, object],
|
3007
|
-
parent_object: Optional[dict] = None,
|
3008
|
-
) -> dict:
|
3066
|
+
from_object: Union[dict[str, Any], object],
|
3067
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3068
|
+
) -> dict[str, Any]:
|
3009
3069
|
to_object: dict[str, Any] = {}
|
3010
3070
|
if getv(from_object, ['baseModel']) is not None:
|
3011
3071
|
setv(to_object, ['base_model'], getv(from_object, ['baseModel']))
|
@@ -3021,9 +3081,9 @@ def _TunedModelInfo_from_mldev(
|
|
3021
3081
|
|
3022
3082
|
def _Model_from_mldev(
|
3023
3083
|
api_client: BaseApiClient,
|
3024
|
-
from_object: Union[dict, object],
|
3025
|
-
parent_object: Optional[dict] = None,
|
3026
|
-
) -> dict:
|
3084
|
+
from_object: Union[dict[str, Any], object],
|
3085
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3086
|
+
) -> dict[str, Any]:
|
3027
3087
|
to_object: dict[str, Any] = {}
|
3028
3088
|
if getv(from_object, ['name']) is not None:
|
3029
3089
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
@@ -3070,9 +3130,9 @@ def _Model_from_mldev(
|
|
3070
3130
|
|
3071
3131
|
def _ListModelsResponse_from_mldev(
|
3072
3132
|
api_client: BaseApiClient,
|
3073
|
-
from_object: Union[dict, object],
|
3074
|
-
parent_object: Optional[dict] = None,
|
3075
|
-
) -> dict:
|
3133
|
+
from_object: Union[dict[str, Any], object],
|
3134
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3135
|
+
) -> dict[str, Any]:
|
3076
3136
|
to_object: dict[str, Any] = {}
|
3077
3137
|
if getv(from_object, ['nextPageToken']) is not None:
|
3078
3138
|
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
@@ -3094,9 +3154,9 @@ def _ListModelsResponse_from_mldev(
|
|
3094
3154
|
|
3095
3155
|
def _DeleteModelResponse_from_mldev(
|
3096
3156
|
api_client: BaseApiClient,
|
3097
|
-
from_object: Union[dict, object],
|
3098
|
-
parent_object: Optional[dict] = None,
|
3099
|
-
) -> dict:
|
3157
|
+
from_object: Union[dict[str, Any], object],
|
3158
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3159
|
+
) -> dict[str, Any]:
|
3100
3160
|
to_object: dict[str, Any] = {}
|
3101
3161
|
|
3102
3162
|
return to_object
|
@@ -3104,9 +3164,9 @@ def _DeleteModelResponse_from_mldev(
|
|
3104
3164
|
|
3105
3165
|
def _CountTokensResponse_from_mldev(
|
3106
3166
|
api_client: BaseApiClient,
|
3107
|
-
from_object: Union[dict, object],
|
3108
|
-
parent_object: Optional[dict] = None,
|
3109
|
-
) -> dict:
|
3167
|
+
from_object: Union[dict[str, Any], object],
|
3168
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3169
|
+
) -> dict[str, Any]:
|
3110
3170
|
to_object: dict[str, Any] = {}
|
3111
3171
|
if getv(from_object, ['totalTokens']) is not None:
|
3112
3172
|
setv(to_object, ['total_tokens'], getv(from_object, ['totalTokens']))
|
@@ -3123,9 +3183,9 @@ def _CountTokensResponse_from_mldev(
|
|
3123
3183
|
|
3124
3184
|
def _Video_from_mldev(
|
3125
3185
|
api_client: BaseApiClient,
|
3126
|
-
from_object: Union[dict, object],
|
3127
|
-
parent_object: Optional[dict] = None,
|
3128
|
-
) -> dict:
|
3186
|
+
from_object: Union[dict[str, Any], object],
|
3187
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3188
|
+
) -> dict[str, Any]:
|
3129
3189
|
to_object: dict[str, Any] = {}
|
3130
3190
|
if getv(from_object, ['video', 'uri']) is not None:
|
3131
3191
|
setv(to_object, ['uri'], getv(from_object, ['video', 'uri']))
|
@@ -3145,9 +3205,9 @@ def _Video_from_mldev(
|
|
3145
3205
|
|
3146
3206
|
def _GeneratedVideo_from_mldev(
|
3147
3207
|
api_client: BaseApiClient,
|
3148
|
-
from_object: Union[dict, object],
|
3149
|
-
parent_object: Optional[dict] = None,
|
3150
|
-
) -> dict:
|
3208
|
+
from_object: Union[dict[str, Any], object],
|
3209
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3210
|
+
) -> dict[str, Any]:
|
3151
3211
|
to_object: dict[str, Any] = {}
|
3152
3212
|
if getv(from_object, ['_self']) is not None:
|
3153
3213
|
setv(
|
@@ -3161,9 +3221,9 @@ def _GeneratedVideo_from_mldev(
|
|
3161
3221
|
|
3162
3222
|
def _GenerateVideosResponse_from_mldev(
|
3163
3223
|
api_client: BaseApiClient,
|
3164
|
-
from_object: Union[dict, object],
|
3165
|
-
parent_object: Optional[dict] = None,
|
3166
|
-
) -> dict:
|
3224
|
+
from_object: Union[dict[str, Any], object],
|
3225
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3226
|
+
) -> dict[str, Any]:
|
3167
3227
|
to_object: dict[str, Any] = {}
|
3168
3228
|
if getv(from_object, ['generatedSamples']) is not None:
|
3169
3229
|
setv(
|
@@ -3194,9 +3254,9 @@ def _GenerateVideosResponse_from_mldev(
|
|
3194
3254
|
|
3195
3255
|
def _GenerateVideosOperation_from_mldev(
|
3196
3256
|
api_client: BaseApiClient,
|
3197
|
-
from_object: Union[dict, object],
|
3198
|
-
parent_object: Optional[dict] = None,
|
3199
|
-
) -> dict:
|
3257
|
+
from_object: Union[dict[str, Any], object],
|
3258
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3259
|
+
) -> dict[str, Any]:
|
3200
3260
|
to_object: dict[str, Any] = {}
|
3201
3261
|
if getv(from_object, ['name']) is not None:
|
3202
3262
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
@@ -3237,9 +3297,9 @@ def _GenerateVideosOperation_from_mldev(
|
|
3237
3297
|
|
3238
3298
|
def _Part_from_vertex(
|
3239
3299
|
api_client: BaseApiClient,
|
3240
|
-
from_object: Union[dict, object],
|
3241
|
-
parent_object: Optional[dict] = None,
|
3242
|
-
) -> dict:
|
3300
|
+
from_object: Union[dict[str, Any], object],
|
3301
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3302
|
+
) -> dict[str, Any]:
|
3243
3303
|
to_object: dict[str, Any] = {}
|
3244
3304
|
if getv(from_object, ['videoMetadata']) is not None:
|
3245
3305
|
setv(to_object, ['video_metadata'], getv(from_object, ['videoMetadata']))
|
@@ -3281,9 +3341,9 @@ def _Part_from_vertex(
|
|
3281
3341
|
|
3282
3342
|
def _Content_from_vertex(
|
3283
3343
|
api_client: BaseApiClient,
|
3284
|
-
from_object: Union[dict, object],
|
3285
|
-
parent_object: Optional[dict] = None,
|
3286
|
-
) -> dict:
|
3344
|
+
from_object: Union[dict[str, Any], object],
|
3345
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3346
|
+
) -> dict[str, Any]:
|
3287
3347
|
to_object: dict[str, Any] = {}
|
3288
3348
|
if getv(from_object, ['parts']) is not None:
|
3289
3349
|
setv(
|
@@ -3303,9 +3363,9 @@ def _Content_from_vertex(
|
|
3303
3363
|
|
3304
3364
|
def _CitationMetadata_from_vertex(
|
3305
3365
|
api_client: BaseApiClient,
|
3306
|
-
from_object: Union[dict, object],
|
3307
|
-
parent_object: Optional[dict] = None,
|
3308
|
-
) -> dict:
|
3366
|
+
from_object: Union[dict[str, Any], object],
|
3367
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3368
|
+
) -> dict[str, Any]:
|
3309
3369
|
to_object: dict[str, Any] = {}
|
3310
3370
|
if getv(from_object, ['citations']) is not None:
|
3311
3371
|
setv(to_object, ['citations'], getv(from_object, ['citations']))
|
@@ -3315,9 +3375,9 @@ def _CitationMetadata_from_vertex(
|
|
3315
3375
|
|
3316
3376
|
def _Candidate_from_vertex(
|
3317
3377
|
api_client: BaseApiClient,
|
3318
|
-
from_object: Union[dict, object],
|
3319
|
-
parent_object: Optional[dict] = None,
|
3320
|
-
) -> dict:
|
3378
|
+
from_object: Union[dict[str, Any], object],
|
3379
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3380
|
+
) -> dict[str, Any]:
|
3321
3381
|
to_object: dict[str, Any] = {}
|
3322
3382
|
if getv(from_object, ['content']) is not None:
|
3323
3383
|
setv(
|
@@ -3367,9 +3427,9 @@ def _Candidate_from_vertex(
|
|
3367
3427
|
|
3368
3428
|
def _GenerateContentResponse_from_vertex(
|
3369
3429
|
api_client: BaseApiClient,
|
3370
|
-
from_object: Union[dict, object],
|
3371
|
-
parent_object: Optional[dict] = None,
|
3372
|
-
) -> dict:
|
3430
|
+
from_object: Union[dict[str, Any], object],
|
3431
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3432
|
+
) -> dict[str, Any]:
|
3373
3433
|
to_object: dict[str, Any] = {}
|
3374
3434
|
if getv(from_object, ['candidates']) is not None:
|
3375
3435
|
setv(
|
@@ -3401,9 +3461,9 @@ def _GenerateContentResponse_from_vertex(
|
|
3401
3461
|
|
3402
3462
|
def _ContentEmbeddingStatistics_from_vertex(
|
3403
3463
|
api_client: BaseApiClient,
|
3404
|
-
from_object: Union[dict, object],
|
3405
|
-
parent_object: Optional[dict] = None,
|
3406
|
-
) -> dict:
|
3464
|
+
from_object: Union[dict[str, Any], object],
|
3465
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3466
|
+
) -> dict[str, Any]:
|
3407
3467
|
to_object: dict[str, Any] = {}
|
3408
3468
|
if getv(from_object, ['truncated']) is not None:
|
3409
3469
|
setv(to_object, ['truncated'], getv(from_object, ['truncated']))
|
@@ -3416,9 +3476,9 @@ def _ContentEmbeddingStatistics_from_vertex(
|
|
3416
3476
|
|
3417
3477
|
def _ContentEmbedding_from_vertex(
|
3418
3478
|
api_client: BaseApiClient,
|
3419
|
-
from_object: Union[dict, object],
|
3420
|
-
parent_object: Optional[dict] = None,
|
3421
|
-
) -> dict:
|
3479
|
+
from_object: Union[dict[str, Any], object],
|
3480
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3481
|
+
) -> dict[str, Any]:
|
3422
3482
|
to_object: dict[str, Any] = {}
|
3423
3483
|
if getv(from_object, ['values']) is not None:
|
3424
3484
|
setv(to_object, ['values'], getv(from_object, ['values']))
|
@@ -3437,9 +3497,9 @@ def _ContentEmbedding_from_vertex(
|
|
3437
3497
|
|
3438
3498
|
def _EmbedContentMetadata_from_vertex(
|
3439
3499
|
api_client: BaseApiClient,
|
3440
|
-
from_object: Union[dict, object],
|
3441
|
-
parent_object: Optional[dict] = None,
|
3442
|
-
) -> dict:
|
3500
|
+
from_object: Union[dict[str, Any], object],
|
3501
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3502
|
+
) -> dict[str, Any]:
|
3443
3503
|
to_object: dict[str, Any] = {}
|
3444
3504
|
if getv(from_object, ['billableCharacterCount']) is not None:
|
3445
3505
|
setv(
|
@@ -3453,9 +3513,9 @@ def _EmbedContentMetadata_from_vertex(
|
|
3453
3513
|
|
3454
3514
|
def _EmbedContentResponse_from_vertex(
|
3455
3515
|
api_client: BaseApiClient,
|
3456
|
-
from_object: Union[dict, object],
|
3457
|
-
parent_object: Optional[dict] = None,
|
3458
|
-
) -> dict:
|
3516
|
+
from_object: Union[dict[str, Any], object],
|
3517
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3518
|
+
) -> dict[str, Any]:
|
3459
3519
|
to_object: dict[str, Any] = {}
|
3460
3520
|
if getv(from_object, ['predictions[]', 'embeddings']) is not None:
|
3461
3521
|
setv(
|
@@ -3481,9 +3541,9 @@ def _EmbedContentResponse_from_vertex(
|
|
3481
3541
|
|
3482
3542
|
def _Image_from_vertex(
|
3483
3543
|
api_client: BaseApiClient,
|
3484
|
-
from_object: Union[dict, object],
|
3485
|
-
parent_object: Optional[dict] = None,
|
3486
|
-
) -> dict:
|
3544
|
+
from_object: Union[dict[str, Any], object],
|
3545
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3546
|
+
) -> dict[str, Any]:
|
3487
3547
|
to_object: dict[str, Any] = {}
|
3488
3548
|
if getv(from_object, ['gcsUri']) is not None:
|
3489
3549
|
setv(to_object, ['gcs_uri'], getv(from_object, ['gcsUri']))
|
@@ -3503,9 +3563,9 @@ def _Image_from_vertex(
|
|
3503
3563
|
|
3504
3564
|
def _SafetyAttributes_from_vertex(
|
3505
3565
|
api_client: BaseApiClient,
|
3506
|
-
from_object: Union[dict, object],
|
3507
|
-
parent_object: Optional[dict] = None,
|
3508
|
-
) -> dict:
|
3566
|
+
from_object: Union[dict[str, Any], object],
|
3567
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3568
|
+
) -> dict[str, Any]:
|
3509
3569
|
to_object: dict[str, Any] = {}
|
3510
3570
|
if getv(from_object, ['safetyAttributes', 'categories']) is not None:
|
3511
3571
|
setv(
|
@@ -3527,9 +3587,9 @@ def _SafetyAttributes_from_vertex(
|
|
3527
3587
|
|
3528
3588
|
def _GeneratedImage_from_vertex(
|
3529
3589
|
api_client: BaseApiClient,
|
3530
|
-
from_object: Union[dict, object],
|
3531
|
-
parent_object: Optional[dict] = None,
|
3532
|
-
) -> dict:
|
3590
|
+
from_object: Union[dict[str, Any], object],
|
3591
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3592
|
+
) -> dict[str, Any]:
|
3533
3593
|
to_object: dict[str, Any] = {}
|
3534
3594
|
if getv(from_object, ['_self']) is not None:
|
3535
3595
|
setv(
|
@@ -3562,9 +3622,9 @@ def _GeneratedImage_from_vertex(
|
|
3562
3622
|
|
3563
3623
|
def _GenerateImagesResponse_from_vertex(
|
3564
3624
|
api_client: BaseApiClient,
|
3565
|
-
from_object: Union[dict, object],
|
3566
|
-
parent_object: Optional[dict] = None,
|
3567
|
-
) -> dict:
|
3625
|
+
from_object: Union[dict[str, Any], object],
|
3626
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3627
|
+
) -> dict[str, Any]:
|
3568
3628
|
to_object: dict[str, Any] = {}
|
3569
3629
|
if getv(from_object, ['predictions']) is not None:
|
3570
3630
|
setv(
|
@@ -3592,9 +3652,9 @@ def _GenerateImagesResponse_from_vertex(
|
|
3592
3652
|
|
3593
3653
|
def _EditImageResponse_from_vertex(
|
3594
3654
|
api_client: BaseApiClient,
|
3595
|
-
from_object: Union[dict, object],
|
3596
|
-
parent_object: Optional[dict] = None,
|
3597
|
-
) -> dict:
|
3655
|
+
from_object: Union[dict[str, Any], object],
|
3656
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3657
|
+
) -> dict[str, Any]:
|
3598
3658
|
to_object: dict[str, Any] = {}
|
3599
3659
|
if getv(from_object, ['predictions']) is not None:
|
3600
3660
|
setv(
|
@@ -3611,9 +3671,9 @@ def _EditImageResponse_from_vertex(
|
|
3611
3671
|
|
3612
3672
|
def _UpscaleImageResponse_from_vertex(
|
3613
3673
|
api_client: BaseApiClient,
|
3614
|
-
from_object: Union[dict, object],
|
3615
|
-
parent_object: Optional[dict] = None,
|
3616
|
-
) -> dict:
|
3674
|
+
from_object: Union[dict[str, Any], object],
|
3675
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3676
|
+
) -> dict[str, Any]:
|
3617
3677
|
to_object: dict[str, Any] = {}
|
3618
3678
|
if getv(from_object, ['predictions']) is not None:
|
3619
3679
|
setv(
|
@@ -3630,9 +3690,9 @@ def _UpscaleImageResponse_from_vertex(
|
|
3630
3690
|
|
3631
3691
|
def _Endpoint_from_vertex(
|
3632
3692
|
api_client: BaseApiClient,
|
3633
|
-
from_object: Union[dict, object],
|
3634
|
-
parent_object: Optional[dict] = None,
|
3635
|
-
) -> dict:
|
3693
|
+
from_object: Union[dict[str, Any], object],
|
3694
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3695
|
+
) -> dict[str, Any]:
|
3636
3696
|
to_object: dict[str, Any] = {}
|
3637
3697
|
if getv(from_object, ['endpoint']) is not None:
|
3638
3698
|
setv(to_object, ['name'], getv(from_object, ['endpoint']))
|
@@ -3647,9 +3707,9 @@ def _Endpoint_from_vertex(
|
|
3647
3707
|
|
3648
3708
|
def _TunedModelInfo_from_vertex(
|
3649
3709
|
api_client: BaseApiClient,
|
3650
|
-
from_object: Union[dict, object],
|
3651
|
-
parent_object: Optional[dict] = None,
|
3652
|
-
) -> dict:
|
3710
|
+
from_object: Union[dict[str, Any], object],
|
3711
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3712
|
+
) -> dict[str, Any]:
|
3653
3713
|
to_object: dict[str, Any] = {}
|
3654
3714
|
if (
|
3655
3715
|
getv(from_object, ['labels', 'google-vertex-llm-tuning-base-model-id'])
|
@@ -3672,9 +3732,9 @@ def _TunedModelInfo_from_vertex(
|
|
3672
3732
|
|
3673
3733
|
def _Model_from_vertex(
|
3674
3734
|
api_client: BaseApiClient,
|
3675
|
-
from_object: Union[dict, object],
|
3676
|
-
parent_object: Optional[dict] = None,
|
3677
|
-
) -> dict:
|
3735
|
+
from_object: Union[dict[str, Any], object],
|
3736
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3737
|
+
) -> dict[str, Any]:
|
3678
3738
|
to_object: dict[str, Any] = {}
|
3679
3739
|
if getv(from_object, ['name']) is not None:
|
3680
3740
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
@@ -3715,9 +3775,9 @@ def _Model_from_vertex(
|
|
3715
3775
|
|
3716
3776
|
def _ListModelsResponse_from_vertex(
|
3717
3777
|
api_client: BaseApiClient,
|
3718
|
-
from_object: Union[dict, object],
|
3719
|
-
parent_object: Optional[dict] = None,
|
3720
|
-
) -> dict:
|
3778
|
+
from_object: Union[dict[str, Any], object],
|
3779
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3780
|
+
) -> dict[str, Any]:
|
3721
3781
|
to_object: dict[str, Any] = {}
|
3722
3782
|
if getv(from_object, ['nextPageToken']) is not None:
|
3723
3783
|
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
@@ -3739,9 +3799,9 @@ def _ListModelsResponse_from_vertex(
|
|
3739
3799
|
|
3740
3800
|
def _DeleteModelResponse_from_vertex(
|
3741
3801
|
api_client: BaseApiClient,
|
3742
|
-
from_object: Union[dict, object],
|
3743
|
-
parent_object: Optional[dict] = None,
|
3744
|
-
) -> dict:
|
3802
|
+
from_object: Union[dict[str, Any], object],
|
3803
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3804
|
+
) -> dict[str, Any]:
|
3745
3805
|
to_object: dict[str, Any] = {}
|
3746
3806
|
|
3747
3807
|
return to_object
|
@@ -3749,9 +3809,9 @@ def _DeleteModelResponse_from_vertex(
|
|
3749
3809
|
|
3750
3810
|
def _CountTokensResponse_from_vertex(
|
3751
3811
|
api_client: BaseApiClient,
|
3752
|
-
from_object: Union[dict, object],
|
3753
|
-
parent_object: Optional[dict] = None,
|
3754
|
-
) -> dict:
|
3812
|
+
from_object: Union[dict[str, Any], object],
|
3813
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3814
|
+
) -> dict[str, Any]:
|
3755
3815
|
to_object: dict[str, Any] = {}
|
3756
3816
|
if getv(from_object, ['totalTokens']) is not None:
|
3757
3817
|
setv(to_object, ['total_tokens'], getv(from_object, ['totalTokens']))
|
@@ -3761,9 +3821,9 @@ def _CountTokensResponse_from_vertex(
|
|
3761
3821
|
|
3762
3822
|
def _ComputeTokensResponse_from_vertex(
|
3763
3823
|
api_client: BaseApiClient,
|
3764
|
-
from_object: Union[dict, object],
|
3765
|
-
parent_object: Optional[dict] = None,
|
3766
|
-
) -> dict:
|
3824
|
+
from_object: Union[dict[str, Any], object],
|
3825
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3826
|
+
) -> dict[str, Any]:
|
3767
3827
|
to_object: dict[str, Any] = {}
|
3768
3828
|
if getv(from_object, ['tokensInfo']) is not None:
|
3769
3829
|
setv(to_object, ['tokens_info'], getv(from_object, ['tokensInfo']))
|
@@ -3773,9 +3833,9 @@ def _ComputeTokensResponse_from_vertex(
|
|
3773
3833
|
|
3774
3834
|
def _Video_from_vertex(
|
3775
3835
|
api_client: BaseApiClient,
|
3776
|
-
from_object: Union[dict, object],
|
3777
|
-
parent_object: Optional[dict] = None,
|
3778
|
-
) -> dict:
|
3836
|
+
from_object: Union[dict[str, Any], object],
|
3837
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3838
|
+
) -> dict[str, Any]:
|
3779
3839
|
to_object: dict[str, Any] = {}
|
3780
3840
|
if getv(from_object, ['gcsUri']) is not None:
|
3781
3841
|
setv(to_object, ['uri'], getv(from_object, ['gcsUri']))
|
@@ -3795,9 +3855,9 @@ def _Video_from_vertex(
|
|
3795
3855
|
|
3796
3856
|
def _GeneratedVideo_from_vertex(
|
3797
3857
|
api_client: BaseApiClient,
|
3798
|
-
from_object: Union[dict, object],
|
3799
|
-
parent_object: Optional[dict] = None,
|
3800
|
-
) -> dict:
|
3858
|
+
from_object: Union[dict[str, Any], object],
|
3859
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3860
|
+
) -> dict[str, Any]:
|
3801
3861
|
to_object: dict[str, Any] = {}
|
3802
3862
|
if getv(from_object, ['_self']) is not None:
|
3803
3863
|
setv(
|
@@ -3811,9 +3871,9 @@ def _GeneratedVideo_from_vertex(
|
|
3811
3871
|
|
3812
3872
|
def _GenerateVideosResponse_from_vertex(
|
3813
3873
|
api_client: BaseApiClient,
|
3814
|
-
from_object: Union[dict, object],
|
3815
|
-
parent_object: Optional[dict] = None,
|
3816
|
-
) -> dict:
|
3874
|
+
from_object: Union[dict[str, Any], object],
|
3875
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3876
|
+
) -> dict[str, Any]:
|
3817
3877
|
to_object: dict[str, Any] = {}
|
3818
3878
|
if getv(from_object, ['videos']) is not None:
|
3819
3879
|
setv(
|
@@ -3844,9 +3904,9 @@ def _GenerateVideosResponse_from_vertex(
|
|
3844
3904
|
|
3845
3905
|
def _GenerateVideosOperation_from_vertex(
|
3846
3906
|
api_client: BaseApiClient,
|
3847
|
-
from_object: Union[dict, object],
|
3848
|
-
parent_object: Optional[dict] = None,
|
3849
|
-
) -> dict:
|
3907
|
+
from_object: Union[dict[str, Any], object],
|
3908
|
+
parent_object: Optional[dict[str, Any]] = None,
|
3909
|
+
) -> dict[str, Any]:
|
3850
3910
|
to_object: dict[str, Any] = {}
|
3851
3911
|
if getv(from_object, ['name']) is not None:
|
3852
3912
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
@@ -5505,7 +5565,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5505
5565
|
'post', path, request_dict, http_options
|
5506
5566
|
)
|
5507
5567
|
|
5508
|
-
async def async_generator():
|
5568
|
+
async def async_generator(): # type: ignore[no-untyped-def]
|
5509
5569
|
async for response_dict in response_stream:
|
5510
5570
|
|
5511
5571
|
if self._api_client.vertexai:
|
@@ -5524,7 +5584,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
5524
5584
|
self._api_client._verify_response(return_value)
|
5525
5585
|
yield return_value
|
5526
5586
|
|
5527
|
-
return async_generator()
|
5587
|
+
return async_generator() # type: ignore[no-untyped-call, no-any-return]
|
5528
5588
|
|
5529
5589
|
async def embed_content(
|
5530
5590
|
self,
|
@@ -6433,7 +6493,9 @@ class AsyncModels(_api_module.BaseModule):
|
|
6433
6493
|
if remaining_remote_calls_afc == 0:
|
6434
6494
|
logger.info('Reached max remote calls for automatic function calling.')
|
6435
6495
|
|
6436
|
-
function_map = _extra_utils.get_function_map(
|
6496
|
+
function_map = _extra_utils.get_function_map(
|
6497
|
+
config, is_caller_method_async=True
|
6498
|
+
)
|
6437
6499
|
if not function_map:
|
6438
6500
|
break
|
6439
6501
|
if not response:
|
@@ -6444,8 +6506,10 @@ class AsyncModels(_api_module.BaseModule):
|
|
6444
6506
|
or not response.candidates[0].content.parts
|
6445
6507
|
):
|
6446
6508
|
break
|
6447
|
-
func_response_parts =
|
6448
|
-
|
6509
|
+
func_response_parts = (
|
6510
|
+
await _extra_utils.get_function_response_parts_async(
|
6511
|
+
response, function_map
|
6512
|
+
)
|
6449
6513
|
)
|
6450
6514
|
if not func_response_parts:
|
6451
6515
|
break
|
@@ -6475,7 +6539,7 @@ class AsyncModels(_api_module.BaseModule):
|
|
6475
6539
|
model: str,
|
6476
6540
|
contents: Union[types.ContentListUnion, types.ContentListUnionDict],
|
6477
6541
|
config: Optional[types.GenerateContentConfigOrDict] = None,
|
6478
|
-
) ->
|
6542
|
+
) -> AsyncIterator[types.GenerateContentResponse]:
|
6479
6543
|
"""Makes an API request to generate content using a model and yields the model's response in chunks.
|
6480
6544
|
|
6481
6545
|
For the `model` parameter, supported formats for Vertex AI API include:
|
@@ -6538,13 +6602,13 @@ class AsyncModels(_api_module.BaseModule):
|
|
6538
6602
|
model=model, contents=contents, config=config
|
6539
6603
|
)
|
6540
6604
|
|
6541
|
-
async def base_async_generator(model, contents, config):
|
6605
|
+
async def base_async_generator(model, contents, config): # type: ignore[no-untyped-def]
|
6542
6606
|
async for chunk in response: # type: ignore[attr-defined]
|
6543
6607
|
yield chunk
|
6544
6608
|
|
6545
|
-
return base_async_generator(model, contents, config)
|
6609
|
+
return base_async_generator(model, contents, config) # type: ignore[no-untyped-call, no-any-return]
|
6546
6610
|
|
6547
|
-
async def async_generator(model, contents, config):
|
6611
|
+
async def async_generator(model, contents, config): # type: ignore[no-untyped-def]
|
6548
6612
|
remaining_remote_calls_afc = _extra_utils.get_max_remote_calls_afc(config)
|
6549
6613
|
logger.info(
|
6550
6614
|
f'AFC is enabled with max remote calls: {remaining_remote_calls_afc}.'
|
@@ -6565,7 +6629,9 @@ class AsyncModels(_api_module.BaseModule):
|
|
6565
6629
|
'Reached max remote calls for automatic function calling.'
|
6566
6630
|
)
|
6567
6631
|
|
6568
|
-
function_map = _extra_utils.get_function_map(
|
6632
|
+
function_map = _extra_utils.get_function_map(
|
6633
|
+
config, is_caller_method_async=True
|
6634
|
+
)
|
6569
6635
|
|
6570
6636
|
if i == 1:
|
6571
6637
|
# First request gets a function call.
|
@@ -6581,8 +6647,10 @@ class AsyncModels(_api_module.BaseModule):
|
|
6581
6647
|
or not chunk.candidates[0].content.parts
|
6582
6648
|
):
|
6583
6649
|
break
|
6584
|
-
func_response_parts =
|
6585
|
-
|
6650
|
+
func_response_parts = (
|
6651
|
+
await _extra_utils.get_function_response_parts_async(
|
6652
|
+
chunk, function_map
|
6653
|
+
)
|
6586
6654
|
)
|
6587
6655
|
if not func_response_parts:
|
6588
6656
|
yield chunk
|
@@ -6619,15 +6687,15 @@ class AsyncModels(_api_module.BaseModule):
|
|
6619
6687
|
)
|
6620
6688
|
contents = t.t_contents(self._api_client, contents)
|
6621
6689
|
if not automatic_function_calling_history:
|
6622
|
-
automatic_function_calling_history.extend(contents)
|
6690
|
+
automatic_function_calling_history.extend(contents)
|
6623
6691
|
if isinstance(contents, list) and func_call_content is not None:
|
6624
|
-
contents.append(func_call_content)
|
6625
|
-
contents.append(func_response_content)
|
6692
|
+
contents.append(func_call_content)
|
6693
|
+
contents.append(func_response_content)
|
6626
6694
|
if func_call_content is not None:
|
6627
6695
|
automatic_function_calling_history.append(func_call_content)
|
6628
6696
|
automatic_function_calling_history.append(func_response_content)
|
6629
6697
|
|
6630
|
-
return async_generator(model, contents, config)
|
6698
|
+
return async_generator(model, contents, config) # type: ignore[no-untyped-call, no-any-return]
|
6631
6699
|
|
6632
6700
|
async def edit_image(
|
6633
6701
|
self,
|