google-genai 1.19.0__py3-none-any.whl → 1.21.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/models.py CHANGED
@@ -15,9 +15,11 @@
15
15
 
16
16
  # Code generated by the Google Gen AI SDK generator DO NOT EDIT.
17
17
 
18
+ import json
18
19
  import logging
19
20
  from typing import Any, AsyncIterator, Awaitable, Iterator, Optional, Union
20
21
  from urllib.parse import urlencode
22
+
21
23
  from . import _api_module
22
24
  from . import _common
23
25
  from . import _extra_utils
@@ -34,7 +36,6 @@ logger = logging.getLogger('google_genai.models')
34
36
 
35
37
 
36
38
  def _VideoMetadata_to_mldev(
37
- api_client: BaseApiClient,
38
39
  from_object: Union[dict[str, Any], object],
39
40
  parent_object: Optional[dict[str, Any]] = None,
40
41
  ) -> dict[str, Any]:
@@ -52,7 +53,6 @@ def _VideoMetadata_to_mldev(
52
53
 
53
54
 
54
55
  def _Blob_to_mldev(
55
- api_client: BaseApiClient,
56
56
  from_object: Union[dict[str, Any], object],
57
57
  parent_object: Optional[dict[str, Any]] = None,
58
58
  ) -> dict[str, Any]:
@@ -70,7 +70,6 @@ def _Blob_to_mldev(
70
70
 
71
71
 
72
72
  def _FileData_to_mldev(
73
- api_client: BaseApiClient,
74
73
  from_object: Union[dict[str, Any], object],
75
74
  parent_object: Optional[dict[str, Any]] = None,
76
75
  ) -> dict[str, Any]:
@@ -88,7 +87,6 @@ def _FileData_to_mldev(
88
87
 
89
88
 
90
89
  def _Part_to_mldev(
91
- api_client: BaseApiClient,
92
90
  from_object: Union[dict[str, Any], object],
93
91
  parent_object: Optional[dict[str, Any]] = None,
94
92
  ) -> dict[str, Any]:
@@ -98,7 +96,7 @@ def _Part_to_mldev(
98
96
  to_object,
99
97
  ['videoMetadata'],
100
98
  _VideoMetadata_to_mldev(
101
- api_client, getv(from_object, ['video_metadata']), to_object
99
+ getv(from_object, ['video_metadata']), to_object
102
100
  ),
103
101
  )
104
102
 
@@ -109,18 +107,14 @@ def _Part_to_mldev(
109
107
  setv(
110
108
  to_object,
111
109
  ['inlineData'],
112
- _Blob_to_mldev(
113
- api_client, getv(from_object, ['inline_data']), to_object
114
- ),
110
+ _Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
115
111
  )
116
112
 
117
113
  if getv(from_object, ['file_data']) is not None:
118
114
  setv(
119
115
  to_object,
120
116
  ['fileData'],
121
- _FileData_to_mldev(
122
- api_client, getv(from_object, ['file_data']), to_object
123
- ),
117
+ _FileData_to_mldev(getv(from_object, ['file_data']), to_object),
124
118
  )
125
119
 
126
120
  if getv(from_object, ['thought_signature']) is not None:
@@ -157,7 +151,6 @@ def _Part_to_mldev(
157
151
 
158
152
 
159
153
  def _Content_to_mldev(
160
- api_client: BaseApiClient,
161
154
  from_object: Union[dict[str, Any], object],
162
155
  parent_object: Optional[dict[str, Any]] = None,
163
156
  ) -> dict[str, Any]:
@@ -167,7 +160,7 @@ def _Content_to_mldev(
167
160
  to_object,
168
161
  ['parts'],
169
162
  [
170
- _Part_to_mldev(api_client, item, to_object)
163
+ _Part_to_mldev(item, to_object)
171
164
  for item in getv(from_object, ['parts'])
172
165
  ],
173
166
  )
@@ -179,7 +172,6 @@ def _Content_to_mldev(
179
172
 
180
173
 
181
174
  def _Schema_to_mldev(
182
- api_client: BaseApiClient,
183
175
  from_object: Union[dict[str, Any], object],
184
176
  parent_object: Optional[dict[str, Any]] = None,
185
177
  ) -> dict[str, Any]:
@@ -269,7 +261,6 @@ def _Schema_to_mldev(
269
261
 
270
262
 
271
263
  def _ModelSelectionConfig_to_mldev(
272
- api_client: BaseApiClient,
273
264
  from_object: Union[dict[str, Any], object],
274
265
  parent_object: Optional[dict[str, Any]] = None,
275
266
  ) -> dict[str, Any]:
@@ -283,7 +274,6 @@ def _ModelSelectionConfig_to_mldev(
283
274
 
284
275
 
285
276
  def _SafetySetting_to_mldev(
286
- api_client: BaseApiClient,
287
277
  from_object: Union[dict[str, Any], object],
288
278
  parent_object: Optional[dict[str, Any]] = None,
289
279
  ) -> dict[str, Any]:
@@ -301,7 +291,6 @@ def _SafetySetting_to_mldev(
301
291
 
302
292
 
303
293
  def _FunctionDeclaration_to_mldev(
304
- api_client: BaseApiClient,
305
294
  from_object: Union[dict[str, Any], object],
306
295
  parent_object: Optional[dict[str, Any]] = None,
307
296
  ) -> dict[str, Any]:
@@ -318,14 +307,27 @@ def _FunctionDeclaration_to_mldev(
318
307
  if getv(from_object, ['parameters']) is not None:
319
308
  setv(to_object, ['parameters'], getv(from_object, ['parameters']))
320
309
 
310
+ if getv(from_object, ['parameters_json_schema']) is not None:
311
+ setv(
312
+ to_object,
313
+ ['parametersJsonSchema'],
314
+ getv(from_object, ['parameters_json_schema']),
315
+ )
316
+
321
317
  if getv(from_object, ['response']) is not None:
322
318
  setv(to_object, ['response'], getv(from_object, ['response']))
323
319
 
320
+ if getv(from_object, ['response_json_schema']) is not None:
321
+ setv(
322
+ to_object,
323
+ ['responseJsonSchema'],
324
+ getv(from_object, ['response_json_schema']),
325
+ )
326
+
324
327
  return to_object
325
328
 
326
329
 
327
330
  def _Interval_to_mldev(
328
- api_client: BaseApiClient,
329
331
  from_object: Union[dict[str, Any], object],
330
332
  parent_object: Optional[dict[str, Any]] = None,
331
333
  ) -> dict[str, Any]:
@@ -340,7 +342,6 @@ def _Interval_to_mldev(
340
342
 
341
343
 
342
344
  def _GoogleSearch_to_mldev(
343
- api_client: BaseApiClient,
344
345
  from_object: Union[dict[str, Any], object],
345
346
  parent_object: Optional[dict[str, Any]] = None,
346
347
  ) -> dict[str, Any]:
@@ -349,16 +350,13 @@ def _GoogleSearch_to_mldev(
349
350
  setv(
350
351
  to_object,
351
352
  ['timeRangeFilter'],
352
- _Interval_to_mldev(
353
- api_client, getv(from_object, ['time_range_filter']), to_object
354
- ),
353
+ _Interval_to_mldev(getv(from_object, ['time_range_filter']), to_object),
355
354
  )
356
355
 
357
356
  return to_object
358
357
 
359
358
 
360
359
  def _DynamicRetrievalConfig_to_mldev(
361
- api_client: BaseApiClient,
362
360
  from_object: Union[dict[str, Any], object],
363
361
  parent_object: Optional[dict[str, Any]] = None,
364
362
  ) -> dict[str, Any]:
@@ -377,7 +375,6 @@ def _DynamicRetrievalConfig_to_mldev(
377
375
 
378
376
 
379
377
  def _GoogleSearchRetrieval_to_mldev(
380
- api_client: BaseApiClient,
381
378
  from_object: Union[dict[str, Any], object],
382
379
  parent_object: Optional[dict[str, Any]] = None,
383
380
  ) -> dict[str, Any]:
@@ -387,9 +384,7 @@ def _GoogleSearchRetrieval_to_mldev(
387
384
  to_object,
388
385
  ['dynamicRetrievalConfig'],
389
386
  _DynamicRetrievalConfig_to_mldev(
390
- api_client,
391
- getv(from_object, ['dynamic_retrieval_config']),
392
- to_object,
387
+ getv(from_object, ['dynamic_retrieval_config']), to_object
393
388
  ),
394
389
  )
395
390
 
@@ -397,7 +392,6 @@ def _GoogleSearchRetrieval_to_mldev(
397
392
 
398
393
 
399
394
  def _EnterpriseWebSearch_to_mldev(
400
- api_client: BaseApiClient,
401
395
  from_object: Union[dict[str, Any], object],
402
396
  parent_object: Optional[dict[str, Any]] = None,
403
397
  ) -> dict[str, Any]:
@@ -407,7 +401,6 @@ def _EnterpriseWebSearch_to_mldev(
407
401
 
408
402
 
409
403
  def _ApiKeyConfig_to_mldev(
410
- api_client: BaseApiClient,
411
404
  from_object: Union[dict[str, Any], object],
412
405
  parent_object: Optional[dict[str, Any]] = None,
413
406
  ) -> dict[str, Any]:
@@ -419,7 +412,6 @@ def _ApiKeyConfig_to_mldev(
419
412
 
420
413
 
421
414
  def _AuthConfig_to_mldev(
422
- api_client: BaseApiClient,
423
415
  from_object: Union[dict[str, Any], object],
424
416
  parent_object: Optional[dict[str, Any]] = None,
425
417
  ) -> dict[str, Any]:
@@ -454,7 +446,6 @@ def _AuthConfig_to_mldev(
454
446
 
455
447
 
456
448
  def _GoogleMaps_to_mldev(
457
- api_client: BaseApiClient,
458
449
  from_object: Union[dict[str, Any], object],
459
450
  parent_object: Optional[dict[str, Any]] = None,
460
451
  ) -> dict[str, Any]:
@@ -466,7 +457,6 @@ def _GoogleMaps_to_mldev(
466
457
 
467
458
 
468
459
  def _UrlContext_to_mldev(
469
- api_client: BaseApiClient,
470
460
  from_object: Union[dict[str, Any], object],
471
461
  parent_object: Optional[dict[str, Any]] = None,
472
462
  ) -> dict[str, Any]:
@@ -476,7 +466,6 @@ def _UrlContext_to_mldev(
476
466
 
477
467
 
478
468
  def _Tool_to_mldev(
479
- api_client: BaseApiClient,
480
469
  from_object: Union[dict[str, Any], object],
481
470
  parent_object: Optional[dict[str, Any]] = None,
482
471
  ) -> dict[str, Any]:
@@ -486,7 +475,7 @@ def _Tool_to_mldev(
486
475
  to_object,
487
476
  ['functionDeclarations'],
488
477
  [
489
- _FunctionDeclaration_to_mldev(api_client, item, to_object)
478
+ _FunctionDeclaration_to_mldev(item, to_object)
490
479
  for item in getv(from_object, ['function_declarations'])
491
480
  ],
492
481
  )
@@ -498,9 +487,7 @@ def _Tool_to_mldev(
498
487
  setv(
499
488
  to_object,
500
489
  ['googleSearch'],
501
- _GoogleSearch_to_mldev(
502
- api_client, getv(from_object, ['google_search']), to_object
503
- ),
490
+ _GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
504
491
  )
505
492
 
506
493
  if getv(from_object, ['google_search_retrieval']) is not None:
@@ -508,9 +495,7 @@ def _Tool_to_mldev(
508
495
  to_object,
509
496
  ['googleSearchRetrieval'],
510
497
  _GoogleSearchRetrieval_to_mldev(
511
- api_client,
512
- getv(from_object, ['google_search_retrieval']),
513
- to_object,
498
+ getv(from_object, ['google_search_retrieval']), to_object
514
499
  ),
515
500
  )
516
501
 
@@ -526,9 +511,7 @@ def _Tool_to_mldev(
526
511
  setv(
527
512
  to_object,
528
513
  ['urlContext'],
529
- _UrlContext_to_mldev(
530
- api_client, getv(from_object, ['url_context']), to_object
531
- ),
514
+ _UrlContext_to_mldev(getv(from_object, ['url_context']), to_object),
532
515
  )
533
516
 
534
517
  if getv(from_object, ['code_execution']) is not None:
@@ -538,7 +521,6 @@ def _Tool_to_mldev(
538
521
 
539
522
 
540
523
  def _FunctionCallingConfig_to_mldev(
541
- api_client: BaseApiClient,
542
524
  from_object: Union[dict[str, Any], object],
543
525
  parent_object: Optional[dict[str, Any]] = None,
544
526
  ) -> dict[str, Any]:
@@ -557,7 +539,6 @@ def _FunctionCallingConfig_to_mldev(
557
539
 
558
540
 
559
541
  def _LatLng_to_mldev(
560
- api_client: BaseApiClient,
561
542
  from_object: Union[dict[str, Any], object],
562
543
  parent_object: Optional[dict[str, Any]] = None,
563
544
  ) -> dict[str, Any]:
@@ -572,7 +553,6 @@ def _LatLng_to_mldev(
572
553
 
573
554
 
574
555
  def _RetrievalConfig_to_mldev(
575
- api_client: BaseApiClient,
576
556
  from_object: Union[dict[str, Any], object],
577
557
  parent_object: Optional[dict[str, Any]] = None,
578
558
  ) -> dict[str, Any]:
@@ -581,7 +561,7 @@ def _RetrievalConfig_to_mldev(
581
561
  setv(
582
562
  to_object,
583
563
  ['latLng'],
584
- _LatLng_to_mldev(api_client, getv(from_object, ['lat_lng']), to_object),
564
+ _LatLng_to_mldev(getv(from_object, ['lat_lng']), to_object),
585
565
  )
586
566
 
587
567
  if getv(from_object, ['language_code']) is not None:
@@ -591,7 +571,6 @@ def _RetrievalConfig_to_mldev(
591
571
 
592
572
 
593
573
  def _ToolConfig_to_mldev(
594
- api_client: BaseApiClient,
595
574
  from_object: Union[dict[str, Any], object],
596
575
  parent_object: Optional[dict[str, Any]] = None,
597
576
  ) -> dict[str, Any]:
@@ -601,9 +580,7 @@ def _ToolConfig_to_mldev(
601
580
  to_object,
602
581
  ['functionCallingConfig'],
603
582
  _FunctionCallingConfig_to_mldev(
604
- api_client,
605
- getv(from_object, ['function_calling_config']),
606
- to_object,
583
+ getv(from_object, ['function_calling_config']), to_object
607
584
  ),
608
585
  )
609
586
 
@@ -612,7 +589,7 @@ def _ToolConfig_to_mldev(
612
589
  to_object,
613
590
  ['retrievalConfig'],
614
591
  _RetrievalConfig_to_mldev(
615
- api_client, getv(from_object, ['retrieval_config']), to_object
592
+ getv(from_object, ['retrieval_config']), to_object
616
593
  ),
617
594
  )
618
595
 
@@ -620,7 +597,6 @@ def _ToolConfig_to_mldev(
620
597
 
621
598
 
622
599
  def _PrebuiltVoiceConfig_to_mldev(
623
- api_client: BaseApiClient,
624
600
  from_object: Union[dict[str, Any], object],
625
601
  parent_object: Optional[dict[str, Any]] = None,
626
602
  ) -> dict[str, Any]:
@@ -632,7 +608,6 @@ def _PrebuiltVoiceConfig_to_mldev(
632
608
 
633
609
 
634
610
  def _VoiceConfig_to_mldev(
635
- api_client: BaseApiClient,
636
611
  from_object: Union[dict[str, Any], object],
637
612
  parent_object: Optional[dict[str, Any]] = None,
638
613
  ) -> dict[str, Any]:
@@ -642,7 +617,7 @@ def _VoiceConfig_to_mldev(
642
617
  to_object,
643
618
  ['prebuiltVoiceConfig'],
644
619
  _PrebuiltVoiceConfig_to_mldev(
645
- api_client, getv(from_object, ['prebuilt_voice_config']), to_object
620
+ getv(from_object, ['prebuilt_voice_config']), to_object
646
621
  ),
647
622
  )
648
623
 
@@ -650,7 +625,6 @@ def _VoiceConfig_to_mldev(
650
625
 
651
626
 
652
627
  def _SpeakerVoiceConfig_to_mldev(
653
- api_client: BaseApiClient,
654
628
  from_object: Union[dict[str, Any], object],
655
629
  parent_object: Optional[dict[str, Any]] = None,
656
630
  ) -> dict[str, Any]:
@@ -662,16 +636,13 @@ def _SpeakerVoiceConfig_to_mldev(
662
636
  setv(
663
637
  to_object,
664
638
  ['voiceConfig'],
665
- _VoiceConfig_to_mldev(
666
- api_client, getv(from_object, ['voice_config']), to_object
667
- ),
639
+ _VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
668
640
  )
669
641
 
670
642
  return to_object
671
643
 
672
644
 
673
645
  def _MultiSpeakerVoiceConfig_to_mldev(
674
- api_client: BaseApiClient,
675
646
  from_object: Union[dict[str, Any], object],
676
647
  parent_object: Optional[dict[str, Any]] = None,
677
648
  ) -> dict[str, Any]:
@@ -681,7 +652,7 @@ def _MultiSpeakerVoiceConfig_to_mldev(
681
652
  to_object,
682
653
  ['speakerVoiceConfigs'],
683
654
  [
684
- _SpeakerVoiceConfig_to_mldev(api_client, item, to_object)
655
+ _SpeakerVoiceConfig_to_mldev(item, to_object)
685
656
  for item in getv(from_object, ['speaker_voice_configs'])
686
657
  ],
687
658
  )
@@ -690,7 +661,6 @@ def _MultiSpeakerVoiceConfig_to_mldev(
690
661
 
691
662
 
692
663
  def _SpeechConfig_to_mldev(
693
- api_client: BaseApiClient,
694
664
  from_object: Union[dict[str, Any], object],
695
665
  parent_object: Optional[dict[str, Any]] = None,
696
666
  ) -> dict[str, Any]:
@@ -699,9 +669,7 @@ def _SpeechConfig_to_mldev(
699
669
  setv(
700
670
  to_object,
701
671
  ['voiceConfig'],
702
- _VoiceConfig_to_mldev(
703
- api_client, getv(from_object, ['voice_config']), to_object
704
- ),
672
+ _VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
705
673
  )
706
674
 
707
675
  if getv(from_object, ['multi_speaker_voice_config']) is not None:
@@ -709,9 +677,7 @@ def _SpeechConfig_to_mldev(
709
677
  to_object,
710
678
  ['multiSpeakerVoiceConfig'],
711
679
  _MultiSpeakerVoiceConfig_to_mldev(
712
- api_client,
713
- getv(from_object, ['multi_speaker_voice_config']),
714
- to_object,
680
+ getv(from_object, ['multi_speaker_voice_config']), to_object
715
681
  ),
716
682
  )
717
683
 
@@ -722,7 +688,6 @@ def _SpeechConfig_to_mldev(
722
688
 
723
689
 
724
690
  def _ThinkingConfig_to_mldev(
725
- api_client: BaseApiClient,
726
691
  from_object: Union[dict[str, Any], object],
727
692
  parent_object: Optional[dict[str, Any]] = None,
728
693
  ) -> dict[str, Any]:
@@ -750,9 +715,7 @@ def _GenerateContentConfig_to_mldev(
750
715
  parent_object,
751
716
  ['systemInstruction'],
752
717
  _Content_to_mldev(
753
- api_client,
754
- t.t_content(api_client, getv(from_object, ['system_instruction'])),
755
- to_object,
718
+ t.t_content(getv(from_object, ['system_instruction'])), to_object
756
719
  ),
757
720
  )
758
721
 
@@ -813,7 +776,6 @@ def _GenerateContentConfig_to_mldev(
813
776
  to_object,
814
777
  ['responseSchema'],
815
778
  _Schema_to_mldev(
816
- api_client,
817
779
  t.t_schema(api_client, getv(from_object, ['response_schema'])),
818
780
  to_object,
819
781
  ),
@@ -832,7 +794,7 @@ def _GenerateContentConfig_to_mldev(
832
794
  parent_object,
833
795
  ['safetySettings'],
834
796
  [
835
- _SafetySetting_to_mldev(api_client, item, to_object)
797
+ _SafetySetting_to_mldev(item, to_object)
836
798
  for item in getv(from_object, ['safety_settings'])
837
799
  ],
838
800
  )
@@ -842,7 +804,7 @@ def _GenerateContentConfig_to_mldev(
842
804
  parent_object,
843
805
  ['tools'],
844
806
  [
845
- _Tool_to_mldev(api_client, t.t_tool(api_client, item), to_object)
807
+ _Tool_to_mldev(t.t_tool(api_client, item), to_object)
846
808
  for item in t.t_tools(api_client, getv(from_object, ['tools']))
847
809
  ],
848
810
  )
@@ -851,9 +813,7 @@ def _GenerateContentConfig_to_mldev(
851
813
  setv(
852
814
  parent_object,
853
815
  ['toolConfig'],
854
- _ToolConfig_to_mldev(
855
- api_client, getv(from_object, ['tool_config']), to_object
856
- ),
816
+ _ToolConfig_to_mldev(getv(from_object, ['tool_config']), to_object),
857
817
  )
858
818
 
859
819
  if getv(from_object, ['labels']) is not None:
@@ -885,9 +845,7 @@ def _GenerateContentConfig_to_mldev(
885
845
  to_object,
886
846
  ['speechConfig'],
887
847
  _SpeechConfig_to_mldev(
888
- api_client,
889
- t.t_speech_config(api_client, getv(from_object, ['speech_config'])),
890
- to_object,
848
+ t.t_speech_config(getv(from_object, ['speech_config'])), to_object
891
849
  ),
892
850
  )
893
851
 
@@ -901,7 +859,7 @@ def _GenerateContentConfig_to_mldev(
901
859
  to_object,
902
860
  ['thinkingConfig'],
903
861
  _ThinkingConfig_to_mldev(
904
- api_client, getv(from_object, ['thinking_config']), to_object
862
+ getv(from_object, ['thinking_config']), to_object
905
863
  ),
906
864
  )
907
865
 
@@ -926,10 +884,8 @@ def _GenerateContentParameters_to_mldev(
926
884
  to_object,
927
885
  ['contents'],
928
886
  [
929
- _Content_to_mldev(api_client, item, to_object)
930
- for item in t.t_contents(
931
- api_client, getv(from_object, ['contents'])
932
- )
887
+ _Content_to_mldev(item, to_object)
888
+ for item in t.t_contents(getv(from_object, ['contents']))
933
889
  ],
934
890
  )
935
891
 
@@ -946,7 +902,6 @@ def _GenerateContentParameters_to_mldev(
946
902
 
947
903
 
948
904
  def _EmbedContentConfig_to_mldev(
949
- api_client: BaseApiClient,
950
905
  from_object: Union[dict[str, Any], object],
951
906
  parent_object: Optional[dict[str, Any]] = None,
952
907
  ) -> dict[str, Any]:
@@ -1002,9 +957,7 @@ def _EmbedContentParameters_to_mldev(
1002
957
  setv(
1003
958
  to_object,
1004
959
  ['config'],
1005
- _EmbedContentConfig_to_mldev(
1006
- api_client, getv(from_object, ['config']), to_object
1007
- ),
960
+ _EmbedContentConfig_to_mldev(getv(from_object, ['config']), to_object),
1008
961
  )
1009
962
 
1010
963
  setv(
@@ -1016,7 +969,6 @@ def _EmbedContentParameters_to_mldev(
1016
969
 
1017
970
 
1018
971
  def _GenerateImagesConfig_to_mldev(
1019
- api_client: BaseApiClient,
1020
972
  from_object: Union[dict[str, Any], object],
1021
973
  parent_object: Optional[dict[str, Any]] = None,
1022
974
  ) -> dict[str, Any]:
@@ -1139,7 +1091,7 @@ def _GenerateImagesParameters_to_mldev(
1139
1091
  to_object,
1140
1092
  ['config'],
1141
1093
  _GenerateImagesConfig_to_mldev(
1142
- api_client, getv(from_object, ['config']), to_object
1094
+ getv(from_object, ['config']), to_object
1143
1095
  ),
1144
1096
  )
1145
1097
 
@@ -1216,7 +1168,6 @@ def _ListModelsParameters_to_mldev(
1216
1168
 
1217
1169
 
1218
1170
  def _UpdateModelConfig_to_mldev(
1219
- api_client: BaseApiClient,
1220
1171
  from_object: Union[dict[str, Any], object],
1221
1172
  parent_object: Optional[dict[str, Any]] = None,
1222
1173
  ) -> dict[str, Any]:
@@ -1255,9 +1206,7 @@ def _UpdateModelParameters_to_mldev(
1255
1206
  setv(
1256
1207
  to_object,
1257
1208
  ['config'],
1258
- _UpdateModelConfig_to_mldev(
1259
- api_client, getv(from_object, ['config']), to_object
1260
- ),
1209
+ _UpdateModelConfig_to_mldev(getv(from_object, ['config']), to_object),
1261
1210
  )
1262
1211
 
1263
1212
  return to_object
@@ -1283,7 +1232,6 @@ def _DeleteModelParameters_to_mldev(
1283
1232
 
1284
1233
 
1285
1234
  def _CountTokensConfig_to_mldev(
1286
- api_client: BaseApiClient,
1287
1235
  from_object: Union[dict[str, Any], object],
1288
1236
  parent_object: Optional[dict[str, Any]] = None,
1289
1237
  ) -> dict[str, Any]:
@@ -1323,10 +1271,8 @@ def _CountTokensParameters_to_mldev(
1323
1271
  to_object,
1324
1272
  ['contents'],
1325
1273
  [
1326
- _Content_to_mldev(api_client, item, to_object)
1327
- for item in t.t_contents(
1328
- api_client, getv(from_object, ['contents'])
1329
- )
1274
+ _Content_to_mldev(item, to_object)
1275
+ for item in t.t_contents(getv(from_object, ['contents']))
1330
1276
  ],
1331
1277
  )
1332
1278
 
@@ -1334,16 +1280,13 @@ def _CountTokensParameters_to_mldev(
1334
1280
  setv(
1335
1281
  to_object,
1336
1282
  ['config'],
1337
- _CountTokensConfig_to_mldev(
1338
- api_client, getv(from_object, ['config']), to_object
1339
- ),
1283
+ _CountTokensConfig_to_mldev(getv(from_object, ['config']), to_object),
1340
1284
  )
1341
1285
 
1342
1286
  return to_object
1343
1287
 
1344
1288
 
1345
1289
  def _Image_to_mldev(
1346
- api_client: BaseApiClient,
1347
1290
  from_object: Union[dict[str, Any], object],
1348
1291
  parent_object: Optional[dict[str, Any]] = None,
1349
1292
  ) -> dict[str, Any]:
@@ -1355,7 +1298,7 @@ def _Image_to_mldev(
1355
1298
  setv(
1356
1299
  to_object,
1357
1300
  ['bytesBase64Encoded'],
1358
- t.t_bytes(api_client, getv(from_object, ['image_bytes'])),
1301
+ t.t_bytes(getv(from_object, ['image_bytes'])),
1359
1302
  )
1360
1303
 
1361
1304
  if getv(from_object, ['mime_type']) is not None:
@@ -1364,8 +1307,28 @@ def _Image_to_mldev(
1364
1307
  return to_object
1365
1308
 
1366
1309
 
1310
+ def _Video_to_mldev(
1311
+ from_object: Union[dict[str, Any], object],
1312
+ parent_object: Optional[dict[str, Any]] = None,
1313
+ ) -> dict[str, Any]:
1314
+ to_object: dict[str, Any] = {}
1315
+ if getv(from_object, ['uri']) is not None:
1316
+ setv(to_object, ['video', 'uri'], getv(from_object, ['uri']))
1317
+
1318
+ if getv(from_object, ['video_bytes']) is not None:
1319
+ setv(
1320
+ to_object,
1321
+ ['video', 'encodedVideo'],
1322
+ t.t_bytes(getv(from_object, ['video_bytes'])),
1323
+ )
1324
+
1325
+ if getv(from_object, ['mime_type']) is not None:
1326
+ setv(to_object, ['encoding'], getv(from_object, ['mime_type']))
1327
+
1328
+ return to_object
1329
+
1330
+
1367
1331
  def _GenerateVideosConfig_to_mldev(
1368
- api_client: BaseApiClient,
1369
1332
  from_object: Union[dict[str, Any], object],
1370
1333
  parent_object: Optional[dict[str, Any]] = None,
1371
1334
  ) -> dict[str, Any]:
@@ -1431,6 +1394,9 @@ def _GenerateVideosConfig_to_mldev(
1431
1394
  if getv(from_object, ['generate_audio']) is not None:
1432
1395
  raise ValueError('generate_audio parameter is not supported in Gemini API.')
1433
1396
 
1397
+ if getv(from_object, ['last_frame']) is not None:
1398
+ raise ValueError('last_frame parameter is not supported in Gemini API.')
1399
+
1434
1400
  return to_object
1435
1401
 
1436
1402
 
@@ -1454,15 +1420,18 @@ def _GenerateVideosParameters_to_mldev(
1454
1420
  setv(
1455
1421
  to_object,
1456
1422
  ['instances[0]', 'image'],
1457
- _Image_to_mldev(api_client, getv(from_object, ['image']), to_object),
1423
+ _Image_to_mldev(getv(from_object, ['image']), to_object),
1458
1424
  )
1459
1425
 
1426
+ if getv(from_object, ['video']) is not None:
1427
+ raise ValueError('video parameter is not supported in Gemini API.')
1428
+
1460
1429
  if getv(from_object, ['config']) is not None:
1461
1430
  setv(
1462
1431
  to_object,
1463
1432
  ['config'],
1464
1433
  _GenerateVideosConfig_to_mldev(
1465
- api_client, getv(from_object, ['config']), to_object
1434
+ getv(from_object, ['config']), to_object
1466
1435
  ),
1467
1436
  )
1468
1437
 
@@ -1470,7 +1439,6 @@ def _GenerateVideosParameters_to_mldev(
1470
1439
 
1471
1440
 
1472
1441
  def _VideoMetadata_to_vertex(
1473
- api_client: BaseApiClient,
1474
1442
  from_object: Union[dict[str, Any], object],
1475
1443
  parent_object: Optional[dict[str, Any]] = None,
1476
1444
  ) -> dict[str, Any]:
@@ -1488,7 +1456,6 @@ def _VideoMetadata_to_vertex(
1488
1456
 
1489
1457
 
1490
1458
  def _Blob_to_vertex(
1491
- api_client: BaseApiClient,
1492
1459
  from_object: Union[dict[str, Any], object],
1493
1460
  parent_object: Optional[dict[str, Any]] = None,
1494
1461
  ) -> dict[str, Any]:
@@ -1506,7 +1473,6 @@ def _Blob_to_vertex(
1506
1473
 
1507
1474
 
1508
1475
  def _FileData_to_vertex(
1509
- api_client: BaseApiClient,
1510
1476
  from_object: Union[dict[str, Any], object],
1511
1477
  parent_object: Optional[dict[str, Any]] = None,
1512
1478
  ) -> dict[str, Any]:
@@ -1524,7 +1490,6 @@ def _FileData_to_vertex(
1524
1490
 
1525
1491
 
1526
1492
  def _Part_to_vertex(
1527
- api_client: BaseApiClient,
1528
1493
  from_object: Union[dict[str, Any], object],
1529
1494
  parent_object: Optional[dict[str, Any]] = None,
1530
1495
  ) -> dict[str, Any]:
@@ -1534,7 +1499,7 @@ def _Part_to_vertex(
1534
1499
  to_object,
1535
1500
  ['videoMetadata'],
1536
1501
  _VideoMetadata_to_vertex(
1537
- api_client, getv(from_object, ['video_metadata']), to_object
1502
+ getv(from_object, ['video_metadata']), to_object
1538
1503
  ),
1539
1504
  )
1540
1505
 
@@ -1545,18 +1510,14 @@ def _Part_to_vertex(
1545
1510
  setv(
1546
1511
  to_object,
1547
1512
  ['inlineData'],
1548
- _Blob_to_vertex(
1549
- api_client, getv(from_object, ['inline_data']), to_object
1550
- ),
1513
+ _Blob_to_vertex(getv(from_object, ['inline_data']), to_object),
1551
1514
  )
1552
1515
 
1553
1516
  if getv(from_object, ['file_data']) is not None:
1554
1517
  setv(
1555
1518
  to_object,
1556
1519
  ['fileData'],
1557
- _FileData_to_vertex(
1558
- api_client, getv(from_object, ['file_data']), to_object
1559
- ),
1520
+ _FileData_to_vertex(getv(from_object, ['file_data']), to_object),
1560
1521
  )
1561
1522
 
1562
1523
  if getv(from_object, ['thought_signature']) is not None:
@@ -1593,7 +1554,6 @@ def _Part_to_vertex(
1593
1554
 
1594
1555
 
1595
1556
  def _Content_to_vertex(
1596
- api_client: BaseApiClient,
1597
1557
  from_object: Union[dict[str, Any], object],
1598
1558
  parent_object: Optional[dict[str, Any]] = None,
1599
1559
  ) -> dict[str, Any]:
@@ -1603,7 +1563,7 @@ def _Content_to_vertex(
1603
1563
  to_object,
1604
1564
  ['parts'],
1605
1565
  [
1606
- _Part_to_vertex(api_client, item, to_object)
1566
+ _Part_to_vertex(item, to_object)
1607
1567
  for item in getv(from_object, ['parts'])
1608
1568
  ],
1609
1569
  )
@@ -1615,7 +1575,6 @@ def _Content_to_vertex(
1615
1575
 
1616
1576
 
1617
1577
  def _Schema_to_vertex(
1618
- api_client: BaseApiClient,
1619
1578
  from_object: Union[dict[str, Any], object],
1620
1579
  parent_object: Optional[dict[str, Any]] = None,
1621
1580
  ) -> dict[str, Any]:
@@ -1707,7 +1666,6 @@ def _Schema_to_vertex(
1707
1666
 
1708
1667
 
1709
1668
  def _ModelSelectionConfig_to_vertex(
1710
- api_client: BaseApiClient,
1711
1669
  from_object: Union[dict[str, Any], object],
1712
1670
  parent_object: Optional[dict[str, Any]] = None,
1713
1671
  ) -> dict[str, Any]:
@@ -1723,7 +1681,6 @@ def _ModelSelectionConfig_to_vertex(
1723
1681
 
1724
1682
 
1725
1683
  def _SafetySetting_to_vertex(
1726
- api_client: BaseApiClient,
1727
1684
  from_object: Union[dict[str, Any], object],
1728
1685
  parent_object: Optional[dict[str, Any]] = None,
1729
1686
  ) -> dict[str, Any]:
@@ -1741,7 +1698,6 @@ def _SafetySetting_to_vertex(
1741
1698
 
1742
1699
 
1743
1700
  def _FunctionDeclaration_to_vertex(
1744
- api_client: BaseApiClient,
1745
1701
  from_object: Union[dict[str, Any], object],
1746
1702
  parent_object: Optional[dict[str, Any]] = None,
1747
1703
  ) -> dict[str, Any]:
@@ -1758,14 +1714,27 @@ def _FunctionDeclaration_to_vertex(
1758
1714
  if getv(from_object, ['parameters']) is not None:
1759
1715
  setv(to_object, ['parameters'], getv(from_object, ['parameters']))
1760
1716
 
1717
+ if getv(from_object, ['parameters_json_schema']) is not None:
1718
+ setv(
1719
+ to_object,
1720
+ ['parametersJsonSchema'],
1721
+ getv(from_object, ['parameters_json_schema']),
1722
+ )
1723
+
1761
1724
  if getv(from_object, ['response']) is not None:
1762
1725
  setv(to_object, ['response'], getv(from_object, ['response']))
1763
1726
 
1727
+ if getv(from_object, ['response_json_schema']) is not None:
1728
+ setv(
1729
+ to_object,
1730
+ ['responseJsonSchema'],
1731
+ getv(from_object, ['response_json_schema']),
1732
+ )
1733
+
1764
1734
  return to_object
1765
1735
 
1766
1736
 
1767
1737
  def _Interval_to_vertex(
1768
- api_client: BaseApiClient,
1769
1738
  from_object: Union[dict[str, Any], object],
1770
1739
  parent_object: Optional[dict[str, Any]] = None,
1771
1740
  ) -> dict[str, Any]:
@@ -1780,7 +1749,6 @@ def _Interval_to_vertex(
1780
1749
 
1781
1750
 
1782
1751
  def _GoogleSearch_to_vertex(
1783
- api_client: BaseApiClient,
1784
1752
  from_object: Union[dict[str, Any], object],
1785
1753
  parent_object: Optional[dict[str, Any]] = None,
1786
1754
  ) -> dict[str, Any]:
@@ -1790,7 +1758,7 @@ def _GoogleSearch_to_vertex(
1790
1758
  to_object,
1791
1759
  ['timeRangeFilter'],
1792
1760
  _Interval_to_vertex(
1793
- api_client, getv(from_object, ['time_range_filter']), to_object
1761
+ getv(from_object, ['time_range_filter']), to_object
1794
1762
  ),
1795
1763
  )
1796
1764
 
@@ -1798,7 +1766,6 @@ def _GoogleSearch_to_vertex(
1798
1766
 
1799
1767
 
1800
1768
  def _DynamicRetrievalConfig_to_vertex(
1801
- api_client: BaseApiClient,
1802
1769
  from_object: Union[dict[str, Any], object],
1803
1770
  parent_object: Optional[dict[str, Any]] = None,
1804
1771
  ) -> dict[str, Any]:
@@ -1817,7 +1784,6 @@ def _DynamicRetrievalConfig_to_vertex(
1817
1784
 
1818
1785
 
1819
1786
  def _GoogleSearchRetrieval_to_vertex(
1820
- api_client: BaseApiClient,
1821
1787
  from_object: Union[dict[str, Any], object],
1822
1788
  parent_object: Optional[dict[str, Any]] = None,
1823
1789
  ) -> dict[str, Any]:
@@ -1827,9 +1793,7 @@ def _GoogleSearchRetrieval_to_vertex(
1827
1793
  to_object,
1828
1794
  ['dynamicRetrievalConfig'],
1829
1795
  _DynamicRetrievalConfig_to_vertex(
1830
- api_client,
1831
- getv(from_object, ['dynamic_retrieval_config']),
1832
- to_object,
1796
+ getv(from_object, ['dynamic_retrieval_config']), to_object
1833
1797
  ),
1834
1798
  )
1835
1799
 
@@ -1837,7 +1801,6 @@ def _GoogleSearchRetrieval_to_vertex(
1837
1801
 
1838
1802
 
1839
1803
  def _EnterpriseWebSearch_to_vertex(
1840
- api_client: BaseApiClient,
1841
1804
  from_object: Union[dict[str, Any], object],
1842
1805
  parent_object: Optional[dict[str, Any]] = None,
1843
1806
  ) -> dict[str, Any]:
@@ -1847,7 +1810,6 @@ def _EnterpriseWebSearch_to_vertex(
1847
1810
 
1848
1811
 
1849
1812
  def _ApiKeyConfig_to_vertex(
1850
- api_client: BaseApiClient,
1851
1813
  from_object: Union[dict[str, Any], object],
1852
1814
  parent_object: Optional[dict[str, Any]] = None,
1853
1815
  ) -> dict[str, Any]:
@@ -1859,7 +1821,6 @@ def _ApiKeyConfig_to_vertex(
1859
1821
 
1860
1822
 
1861
1823
  def _AuthConfig_to_vertex(
1862
- api_client: BaseApiClient,
1863
1824
  from_object: Union[dict[str, Any], object],
1864
1825
  parent_object: Optional[dict[str, Any]] = None,
1865
1826
  ) -> dict[str, Any]:
@@ -1869,7 +1830,7 @@ def _AuthConfig_to_vertex(
1869
1830
  to_object,
1870
1831
  ['apiKeyConfig'],
1871
1832
  _ApiKeyConfig_to_vertex(
1872
- api_client, getv(from_object, ['api_key_config']), to_object
1833
+ getv(from_object, ['api_key_config']), to_object
1873
1834
  ),
1874
1835
  )
1875
1836
 
@@ -1900,7 +1861,6 @@ def _AuthConfig_to_vertex(
1900
1861
 
1901
1862
 
1902
1863
  def _GoogleMaps_to_vertex(
1903
- api_client: BaseApiClient,
1904
1864
  from_object: Union[dict[str, Any], object],
1905
1865
  parent_object: Optional[dict[str, Any]] = None,
1906
1866
  ) -> dict[str, Any]:
@@ -1909,16 +1869,13 @@ def _GoogleMaps_to_vertex(
1909
1869
  setv(
1910
1870
  to_object,
1911
1871
  ['authConfig'],
1912
- _AuthConfig_to_vertex(
1913
- api_client, getv(from_object, ['auth_config']), to_object
1914
- ),
1872
+ _AuthConfig_to_vertex(getv(from_object, ['auth_config']), to_object),
1915
1873
  )
1916
1874
 
1917
1875
  return to_object
1918
1876
 
1919
1877
 
1920
1878
  def _UrlContext_to_vertex(
1921
- api_client: BaseApiClient,
1922
1879
  from_object: Union[dict[str, Any], object],
1923
1880
  parent_object: Optional[dict[str, Any]] = None,
1924
1881
  ) -> dict[str, Any]:
@@ -1928,7 +1885,6 @@ def _UrlContext_to_vertex(
1928
1885
 
1929
1886
 
1930
1887
  def _Tool_to_vertex(
1931
- api_client: BaseApiClient,
1932
1888
  from_object: Union[dict[str, Any], object],
1933
1889
  parent_object: Optional[dict[str, Any]] = None,
1934
1890
  ) -> dict[str, Any]:
@@ -1938,7 +1894,7 @@ def _Tool_to_vertex(
1938
1894
  to_object,
1939
1895
  ['functionDeclarations'],
1940
1896
  [
1941
- _FunctionDeclaration_to_vertex(api_client, item, to_object)
1897
+ _FunctionDeclaration_to_vertex(item, to_object)
1942
1898
  for item in getv(from_object, ['function_declarations'])
1943
1899
  ],
1944
1900
  )
@@ -1951,7 +1907,7 @@ def _Tool_to_vertex(
1951
1907
  to_object,
1952
1908
  ['googleSearch'],
1953
1909
  _GoogleSearch_to_vertex(
1954
- api_client, getv(from_object, ['google_search']), to_object
1910
+ getv(from_object, ['google_search']), to_object
1955
1911
  ),
1956
1912
  )
1957
1913
 
@@ -1960,9 +1916,7 @@ def _Tool_to_vertex(
1960
1916
  to_object,
1961
1917
  ['googleSearchRetrieval'],
1962
1918
  _GoogleSearchRetrieval_to_vertex(
1963
- api_client,
1964
- getv(from_object, ['google_search_retrieval']),
1965
- to_object,
1919
+ getv(from_object, ['google_search_retrieval']), to_object
1966
1920
  ),
1967
1921
  )
1968
1922
 
@@ -1971,7 +1925,7 @@ def _Tool_to_vertex(
1971
1925
  to_object,
1972
1926
  ['enterpriseWebSearch'],
1973
1927
  _EnterpriseWebSearch_to_vertex(
1974
- api_client, getv(from_object, ['enterprise_web_search']), to_object
1928
+ getv(from_object, ['enterprise_web_search']), to_object
1975
1929
  ),
1976
1930
  )
1977
1931
 
@@ -1979,18 +1933,14 @@ def _Tool_to_vertex(
1979
1933
  setv(
1980
1934
  to_object,
1981
1935
  ['googleMaps'],
1982
- _GoogleMaps_to_vertex(
1983
- api_client, getv(from_object, ['google_maps']), to_object
1984
- ),
1936
+ _GoogleMaps_to_vertex(getv(from_object, ['google_maps']), to_object),
1985
1937
  )
1986
1938
 
1987
1939
  if getv(from_object, ['url_context']) is not None:
1988
1940
  setv(
1989
1941
  to_object,
1990
1942
  ['urlContext'],
1991
- _UrlContext_to_vertex(
1992
- api_client, getv(from_object, ['url_context']), to_object
1993
- ),
1943
+ _UrlContext_to_vertex(getv(from_object, ['url_context']), to_object),
1994
1944
  )
1995
1945
 
1996
1946
  if getv(from_object, ['code_execution']) is not None:
@@ -2000,7 +1950,6 @@ def _Tool_to_vertex(
2000
1950
 
2001
1951
 
2002
1952
  def _FunctionCallingConfig_to_vertex(
2003
- api_client: BaseApiClient,
2004
1953
  from_object: Union[dict[str, Any], object],
2005
1954
  parent_object: Optional[dict[str, Any]] = None,
2006
1955
  ) -> dict[str, Any]:
@@ -2019,7 +1968,6 @@ def _FunctionCallingConfig_to_vertex(
2019
1968
 
2020
1969
 
2021
1970
  def _LatLng_to_vertex(
2022
- api_client: BaseApiClient,
2023
1971
  from_object: Union[dict[str, Any], object],
2024
1972
  parent_object: Optional[dict[str, Any]] = None,
2025
1973
  ) -> dict[str, Any]:
@@ -2034,7 +1982,6 @@ def _LatLng_to_vertex(
2034
1982
 
2035
1983
 
2036
1984
  def _RetrievalConfig_to_vertex(
2037
- api_client: BaseApiClient,
2038
1985
  from_object: Union[dict[str, Any], object],
2039
1986
  parent_object: Optional[dict[str, Any]] = None,
2040
1987
  ) -> dict[str, Any]:
@@ -2043,9 +1990,7 @@ def _RetrievalConfig_to_vertex(
2043
1990
  setv(
2044
1991
  to_object,
2045
1992
  ['latLng'],
2046
- _LatLng_to_vertex(
2047
- api_client, getv(from_object, ['lat_lng']), to_object
2048
- ),
1993
+ _LatLng_to_vertex(getv(from_object, ['lat_lng']), to_object),
2049
1994
  )
2050
1995
 
2051
1996
  if getv(from_object, ['language_code']) is not None:
@@ -2055,7 +2000,6 @@ def _RetrievalConfig_to_vertex(
2055
2000
 
2056
2001
 
2057
2002
  def _ToolConfig_to_vertex(
2058
- api_client: BaseApiClient,
2059
2003
  from_object: Union[dict[str, Any], object],
2060
2004
  parent_object: Optional[dict[str, Any]] = None,
2061
2005
  ) -> dict[str, Any]:
@@ -2065,9 +2009,7 @@ def _ToolConfig_to_vertex(
2065
2009
  to_object,
2066
2010
  ['functionCallingConfig'],
2067
2011
  _FunctionCallingConfig_to_vertex(
2068
- api_client,
2069
- getv(from_object, ['function_calling_config']),
2070
- to_object,
2012
+ getv(from_object, ['function_calling_config']), to_object
2071
2013
  ),
2072
2014
  )
2073
2015
 
@@ -2076,7 +2018,7 @@ def _ToolConfig_to_vertex(
2076
2018
  to_object,
2077
2019
  ['retrievalConfig'],
2078
2020
  _RetrievalConfig_to_vertex(
2079
- api_client, getv(from_object, ['retrieval_config']), to_object
2021
+ getv(from_object, ['retrieval_config']), to_object
2080
2022
  ),
2081
2023
  )
2082
2024
 
@@ -2084,7 +2026,6 @@ def _ToolConfig_to_vertex(
2084
2026
 
2085
2027
 
2086
2028
  def _PrebuiltVoiceConfig_to_vertex(
2087
- api_client: BaseApiClient,
2088
2029
  from_object: Union[dict[str, Any], object],
2089
2030
  parent_object: Optional[dict[str, Any]] = None,
2090
2031
  ) -> dict[str, Any]:
@@ -2096,7 +2037,6 @@ def _PrebuiltVoiceConfig_to_vertex(
2096
2037
 
2097
2038
 
2098
2039
  def _VoiceConfig_to_vertex(
2099
- api_client: BaseApiClient,
2100
2040
  from_object: Union[dict[str, Any], object],
2101
2041
  parent_object: Optional[dict[str, Any]] = None,
2102
2042
  ) -> dict[str, Any]:
@@ -2106,7 +2046,7 @@ def _VoiceConfig_to_vertex(
2106
2046
  to_object,
2107
2047
  ['prebuiltVoiceConfig'],
2108
2048
  _PrebuiltVoiceConfig_to_vertex(
2109
- api_client, getv(from_object, ['prebuilt_voice_config']), to_object
2049
+ getv(from_object, ['prebuilt_voice_config']), to_object
2110
2050
  ),
2111
2051
  )
2112
2052
 
@@ -2114,7 +2054,6 @@ def _VoiceConfig_to_vertex(
2114
2054
 
2115
2055
 
2116
2056
  def _SpeakerVoiceConfig_to_vertex(
2117
- api_client: BaseApiClient,
2118
2057
  from_object: Union[dict[str, Any], object],
2119
2058
  parent_object: Optional[dict[str, Any]] = None,
2120
2059
  ) -> dict[str, Any]:
@@ -2129,7 +2068,6 @@ def _SpeakerVoiceConfig_to_vertex(
2129
2068
 
2130
2069
 
2131
2070
  def _MultiSpeakerVoiceConfig_to_vertex(
2132
- api_client: BaseApiClient,
2133
2071
  from_object: Union[dict[str, Any], object],
2134
2072
  parent_object: Optional[dict[str, Any]] = None,
2135
2073
  ) -> dict[str, Any]:
@@ -2143,7 +2081,6 @@ def _MultiSpeakerVoiceConfig_to_vertex(
2143
2081
 
2144
2082
 
2145
2083
  def _SpeechConfig_to_vertex(
2146
- api_client: BaseApiClient,
2147
2084
  from_object: Union[dict[str, Any], object],
2148
2085
  parent_object: Optional[dict[str, Any]] = None,
2149
2086
  ) -> dict[str, Any]:
@@ -2152,9 +2089,7 @@ def _SpeechConfig_to_vertex(
2152
2089
  setv(
2153
2090
  to_object,
2154
2091
  ['voiceConfig'],
2155
- _VoiceConfig_to_vertex(
2156
- api_client, getv(from_object, ['voice_config']), to_object
2157
- ),
2092
+ _VoiceConfig_to_vertex(getv(from_object, ['voice_config']), to_object),
2158
2093
  )
2159
2094
 
2160
2095
  if getv(from_object, ['multi_speaker_voice_config']) is not None:
@@ -2169,7 +2104,6 @@ def _SpeechConfig_to_vertex(
2169
2104
 
2170
2105
 
2171
2106
  def _ThinkingConfig_to_vertex(
2172
- api_client: BaseApiClient,
2173
2107
  from_object: Union[dict[str, Any], object],
2174
2108
  parent_object: Optional[dict[str, Any]] = None,
2175
2109
  ) -> dict[str, Any]:
@@ -2197,9 +2131,7 @@ def _GenerateContentConfig_to_vertex(
2197
2131
  parent_object,
2198
2132
  ['systemInstruction'],
2199
2133
  _Content_to_vertex(
2200
- api_client,
2201
- t.t_content(api_client, getv(from_object, ['system_instruction'])),
2202
- to_object,
2134
+ t.t_content(getv(from_object, ['system_instruction'])), to_object
2203
2135
  ),
2204
2136
  )
2205
2137
 
@@ -2260,7 +2192,6 @@ def _GenerateContentConfig_to_vertex(
2260
2192
  to_object,
2261
2193
  ['responseSchema'],
2262
2194
  _Schema_to_vertex(
2263
- api_client,
2264
2195
  t.t_schema(api_client, getv(from_object, ['response_schema'])),
2265
2196
  to_object,
2266
2197
  ),
@@ -2274,7 +2205,7 @@ def _GenerateContentConfig_to_vertex(
2274
2205
  to_object,
2275
2206
  ['modelConfig'],
2276
2207
  _ModelSelectionConfig_to_vertex(
2277
- api_client, getv(from_object, ['model_selection_config']), to_object
2208
+ getv(from_object, ['model_selection_config']), to_object
2278
2209
  ),
2279
2210
  )
2280
2211
 
@@ -2283,7 +2214,7 @@ def _GenerateContentConfig_to_vertex(
2283
2214
  parent_object,
2284
2215
  ['safetySettings'],
2285
2216
  [
2286
- _SafetySetting_to_vertex(api_client, item, to_object)
2217
+ _SafetySetting_to_vertex(item, to_object)
2287
2218
  for item in getv(from_object, ['safety_settings'])
2288
2219
  ],
2289
2220
  )
@@ -2293,7 +2224,7 @@ def _GenerateContentConfig_to_vertex(
2293
2224
  parent_object,
2294
2225
  ['tools'],
2295
2226
  [
2296
- _Tool_to_vertex(api_client, t.t_tool(api_client, item), to_object)
2227
+ _Tool_to_vertex(t.t_tool(api_client, item), to_object)
2297
2228
  for item in t.t_tools(api_client, getv(from_object, ['tools']))
2298
2229
  ],
2299
2230
  )
@@ -2302,9 +2233,7 @@ def _GenerateContentConfig_to_vertex(
2302
2233
  setv(
2303
2234
  parent_object,
2304
2235
  ['toolConfig'],
2305
- _ToolConfig_to_vertex(
2306
- api_client, getv(from_object, ['tool_config']), to_object
2307
- ),
2236
+ _ToolConfig_to_vertex(getv(from_object, ['tool_config']), to_object),
2308
2237
  )
2309
2238
 
2310
2239
  if getv(from_object, ['labels']) is not None:
@@ -2336,9 +2265,7 @@ def _GenerateContentConfig_to_vertex(
2336
2265
  to_object,
2337
2266
  ['speechConfig'],
2338
2267
  _SpeechConfig_to_vertex(
2339
- api_client,
2340
- t.t_speech_config(api_client, getv(from_object, ['speech_config'])),
2341
- to_object,
2268
+ t.t_speech_config(getv(from_object, ['speech_config'])), to_object
2342
2269
  ),
2343
2270
  )
2344
2271
 
@@ -2350,7 +2277,7 @@ def _GenerateContentConfig_to_vertex(
2350
2277
  to_object,
2351
2278
  ['thinkingConfig'],
2352
2279
  _ThinkingConfig_to_vertex(
2353
- api_client, getv(from_object, ['thinking_config']), to_object
2280
+ getv(from_object, ['thinking_config']), to_object
2354
2281
  ),
2355
2282
  )
2356
2283
 
@@ -2375,10 +2302,8 @@ def _GenerateContentParameters_to_vertex(
2375
2302
  to_object,
2376
2303
  ['contents'],
2377
2304
  [
2378
- _Content_to_vertex(api_client, item, to_object)
2379
- for item in t.t_contents(
2380
- api_client, getv(from_object, ['contents'])
2381
- )
2305
+ _Content_to_vertex(item, to_object)
2306
+ for item in t.t_contents(getv(from_object, ['contents']))
2382
2307
  ],
2383
2308
  )
2384
2309
 
@@ -2395,7 +2320,6 @@ def _GenerateContentParameters_to_vertex(
2395
2320
 
2396
2321
 
2397
2322
  def _EmbedContentConfig_to_vertex(
2398
- api_client: BaseApiClient,
2399
2323
  from_object: Union[dict[str, Any], object],
2400
2324
  parent_object: Optional[dict[str, Any]] = None,
2401
2325
  ) -> dict[str, Any]:
@@ -2459,16 +2383,13 @@ def _EmbedContentParameters_to_vertex(
2459
2383
  setv(
2460
2384
  to_object,
2461
2385
  ['config'],
2462
- _EmbedContentConfig_to_vertex(
2463
- api_client, getv(from_object, ['config']), to_object
2464
- ),
2386
+ _EmbedContentConfig_to_vertex(getv(from_object, ['config']), to_object),
2465
2387
  )
2466
2388
 
2467
2389
  return to_object
2468
2390
 
2469
2391
 
2470
2392
  def _GenerateImagesConfig_to_vertex(
2471
- api_client: BaseApiClient,
2472
2393
  from_object: Union[dict[str, Any], object],
2473
2394
  parent_object: Optional[dict[str, Any]] = None,
2474
2395
  ) -> dict[str, Any]:
@@ -2599,7 +2520,7 @@ def _GenerateImagesParameters_to_vertex(
2599
2520
  to_object,
2600
2521
  ['config'],
2601
2522
  _GenerateImagesConfig_to_vertex(
2602
- api_client, getv(from_object, ['config']), to_object
2523
+ getv(from_object, ['config']), to_object
2603
2524
  ),
2604
2525
  )
2605
2526
 
@@ -2607,7 +2528,6 @@ def _GenerateImagesParameters_to_vertex(
2607
2528
 
2608
2529
 
2609
2530
  def _Image_to_vertex(
2610
- api_client: BaseApiClient,
2611
2531
  from_object: Union[dict[str, Any], object],
2612
2532
  parent_object: Optional[dict[str, Any]] = None,
2613
2533
  ) -> dict[str, Any]:
@@ -2619,7 +2539,7 @@ def _Image_to_vertex(
2619
2539
  setv(
2620
2540
  to_object,
2621
2541
  ['bytesBase64Encoded'],
2622
- t.t_bytes(api_client, getv(from_object, ['image_bytes'])),
2542
+ t.t_bytes(getv(from_object, ['image_bytes'])),
2623
2543
  )
2624
2544
 
2625
2545
  if getv(from_object, ['mime_type']) is not None:
@@ -2629,7 +2549,6 @@ def _Image_to_vertex(
2629
2549
 
2630
2550
 
2631
2551
  def _MaskReferenceConfig_to_vertex(
2632
- api_client: BaseApiClient,
2633
2552
  from_object: Union[dict[str, Any], object],
2634
2553
  parent_object: Optional[dict[str, Any]] = None,
2635
2554
  ) -> dict[str, Any]:
@@ -2649,7 +2568,6 @@ def _MaskReferenceConfig_to_vertex(
2649
2568
 
2650
2569
 
2651
2570
  def _ControlReferenceConfig_to_vertex(
2652
- api_client: BaseApiClient,
2653
2571
  from_object: Union[dict[str, Any], object],
2654
2572
  parent_object: Optional[dict[str, Any]] = None,
2655
2573
  ) -> dict[str, Any]:
@@ -2668,7 +2586,6 @@ def _ControlReferenceConfig_to_vertex(
2668
2586
 
2669
2587
 
2670
2588
  def _StyleReferenceConfig_to_vertex(
2671
- api_client: BaseApiClient,
2672
2589
  from_object: Union[dict[str, Any], object],
2673
2590
  parent_object: Optional[dict[str, Any]] = None,
2674
2591
  ) -> dict[str, Any]:
@@ -2684,7 +2601,6 @@ def _StyleReferenceConfig_to_vertex(
2684
2601
 
2685
2602
 
2686
2603
  def _SubjectReferenceConfig_to_vertex(
2687
- api_client: BaseApiClient,
2688
2604
  from_object: Union[dict[str, Any], object],
2689
2605
  parent_object: Optional[dict[str, Any]] = None,
2690
2606
  ) -> dict[str, Any]:
@@ -2703,7 +2619,6 @@ def _SubjectReferenceConfig_to_vertex(
2703
2619
 
2704
2620
 
2705
2621
  def _ReferenceImageAPI_to_vertex(
2706
- api_client: BaseApiClient,
2707
2622
  from_object: Union[dict[str, Any], object],
2708
2623
  parent_object: Optional[dict[str, Any]] = None,
2709
2624
  ) -> dict[str, Any]:
@@ -2712,9 +2627,7 @@ def _ReferenceImageAPI_to_vertex(
2712
2627
  setv(
2713
2628
  to_object,
2714
2629
  ['referenceImage'],
2715
- _Image_to_vertex(
2716
- api_client, getv(from_object, ['reference_image']), to_object
2717
- ),
2630
+ _Image_to_vertex(getv(from_object, ['reference_image']), to_object),
2718
2631
  )
2719
2632
 
2720
2633
  if getv(from_object, ['reference_id']) is not None:
@@ -2728,7 +2641,7 @@ def _ReferenceImageAPI_to_vertex(
2728
2641
  to_object,
2729
2642
  ['maskImageConfig'],
2730
2643
  _MaskReferenceConfig_to_vertex(
2731
- api_client, getv(from_object, ['mask_image_config']), to_object
2644
+ getv(from_object, ['mask_image_config']), to_object
2732
2645
  ),
2733
2646
  )
2734
2647
 
@@ -2737,7 +2650,7 @@ def _ReferenceImageAPI_to_vertex(
2737
2650
  to_object,
2738
2651
  ['controlImageConfig'],
2739
2652
  _ControlReferenceConfig_to_vertex(
2740
- api_client, getv(from_object, ['control_image_config']), to_object
2653
+ getv(from_object, ['control_image_config']), to_object
2741
2654
  ),
2742
2655
  )
2743
2656
 
@@ -2746,7 +2659,7 @@ def _ReferenceImageAPI_to_vertex(
2746
2659
  to_object,
2747
2660
  ['styleImageConfig'],
2748
2661
  _StyleReferenceConfig_to_vertex(
2749
- api_client, getv(from_object, ['style_image_config']), to_object
2662
+ getv(from_object, ['style_image_config']), to_object
2750
2663
  ),
2751
2664
  )
2752
2665
 
@@ -2755,7 +2668,7 @@ def _ReferenceImageAPI_to_vertex(
2755
2668
  to_object,
2756
2669
  ['subjectImageConfig'],
2757
2670
  _SubjectReferenceConfig_to_vertex(
2758
- api_client, getv(from_object, ['subject_image_config']), to_object
2671
+ getv(from_object, ['subject_image_config']), to_object
2759
2672
  ),
2760
2673
  )
2761
2674
 
@@ -2763,7 +2676,6 @@ def _ReferenceImageAPI_to_vertex(
2763
2676
 
2764
2677
 
2765
2678
  def _EditImageConfig_to_vertex(
2766
- api_client: BaseApiClient,
2767
2679
  from_object: Union[dict[str, Any], object],
2768
2680
  parent_object: Optional[dict[str, Any]] = None,
2769
2681
  ) -> dict[str, Any]:
@@ -2894,7 +2806,7 @@ def _EditImageParameters_to_vertex(
2894
2806
  to_object,
2895
2807
  ['instances[0]', 'referenceImages'],
2896
2808
  [
2897
- _ReferenceImageAPI_to_vertex(api_client, item, to_object)
2809
+ _ReferenceImageAPI_to_vertex(item, to_object)
2898
2810
  for item in getv(from_object, ['reference_images'])
2899
2811
  ],
2900
2812
  )
@@ -2903,16 +2815,13 @@ def _EditImageParameters_to_vertex(
2903
2815
  setv(
2904
2816
  to_object,
2905
2817
  ['config'],
2906
- _EditImageConfig_to_vertex(
2907
- api_client, getv(from_object, ['config']), to_object
2908
- ),
2818
+ _EditImageConfig_to_vertex(getv(from_object, ['config']), to_object),
2909
2819
  )
2910
2820
 
2911
2821
  return to_object
2912
2822
 
2913
2823
 
2914
2824
  def _UpscaleImageAPIConfig_to_vertex(
2915
- api_client: BaseApiClient,
2916
2825
  from_object: Union[dict[str, Any], object],
2917
2826
  parent_object: Optional[dict[str, Any]] = None,
2918
2827
  ) -> dict[str, Any]:
@@ -2969,7 +2878,7 @@ def _UpscaleImageAPIParameters_to_vertex(
2969
2878
  setv(
2970
2879
  to_object,
2971
2880
  ['instances[0]', 'image'],
2972
- _Image_to_vertex(api_client, getv(from_object, ['image']), to_object),
2881
+ _Image_to_vertex(getv(from_object, ['image']), to_object),
2973
2882
  )
2974
2883
 
2975
2884
  if getv(from_object, ['upscale_factor']) is not None:
@@ -2984,7 +2893,7 @@ def _UpscaleImageAPIParameters_to_vertex(
2984
2893
  to_object,
2985
2894
  ['config'],
2986
2895
  _UpscaleImageAPIConfig_to_vertex(
2987
- api_client, getv(from_object, ['config']), to_object
2896
+ getv(from_object, ['config']), to_object
2988
2897
  ),
2989
2898
  )
2990
2899
 
@@ -3061,7 +2970,6 @@ def _ListModelsParameters_to_vertex(
3061
2970
 
3062
2971
 
3063
2972
  def _UpdateModelConfig_to_vertex(
3064
- api_client: BaseApiClient,
3065
2973
  from_object: Union[dict[str, Any], object],
3066
2974
  parent_object: Optional[dict[str, Any]] = None,
3067
2975
  ) -> dict[str, Any]:
@@ -3100,9 +3008,7 @@ def _UpdateModelParameters_to_vertex(
3100
3008
  setv(
3101
3009
  to_object,
3102
3010
  ['config'],
3103
- _UpdateModelConfig_to_vertex(
3104
- api_client, getv(from_object, ['config']), to_object
3105
- ),
3011
+ _UpdateModelConfig_to_vertex(getv(from_object, ['config']), to_object),
3106
3012
  )
3107
3013
 
3108
3014
  return to_object
@@ -3128,7 +3034,6 @@ def _DeleteModelParameters_to_vertex(
3128
3034
 
3129
3035
 
3130
3036
  def _CountTokensConfig_to_vertex(
3131
- api_client: BaseApiClient,
3132
3037
  from_object: Union[dict[str, Any], object],
3133
3038
  parent_object: Optional[dict[str, Any]] = None,
3134
3039
  ) -> dict[str, Any]:
@@ -3139,9 +3044,7 @@ def _CountTokensConfig_to_vertex(
3139
3044
  parent_object,
3140
3045
  ['systemInstruction'],
3141
3046
  _Content_to_vertex(
3142
- api_client,
3143
- t.t_content(api_client, getv(from_object, ['system_instruction'])),
3144
- to_object,
3047
+ t.t_content(getv(from_object, ['system_instruction'])), to_object
3145
3048
  ),
3146
3049
  )
3147
3050
 
@@ -3150,7 +3053,7 @@ def _CountTokensConfig_to_vertex(
3150
3053
  parent_object,
3151
3054
  ['tools'],
3152
3055
  [
3153
- _Tool_to_vertex(api_client, item, to_object)
3056
+ _Tool_to_vertex(item, to_object)
3154
3057
  for item in getv(from_object, ['tools'])
3155
3058
  ],
3156
3059
  )
@@ -3183,10 +3086,8 @@ def _CountTokensParameters_to_vertex(
3183
3086
  to_object,
3184
3087
  ['contents'],
3185
3088
  [
3186
- _Content_to_vertex(api_client, item, to_object)
3187
- for item in t.t_contents(
3188
- api_client, getv(from_object, ['contents'])
3189
- )
3089
+ _Content_to_vertex(item, to_object)
3090
+ for item in t.t_contents(getv(from_object, ['contents']))
3190
3091
  ],
3191
3092
  )
3192
3093
 
@@ -3194,9 +3095,7 @@ def _CountTokensParameters_to_vertex(
3194
3095
  setv(
3195
3096
  to_object,
3196
3097
  ['config'],
3197
- _CountTokensConfig_to_vertex(
3198
- api_client, getv(from_object, ['config']), to_object
3199
- ),
3098
+ _CountTokensConfig_to_vertex(getv(from_object, ['config']), to_object),
3200
3099
  )
3201
3100
 
3202
3101
  return to_object
@@ -3220,10 +3119,8 @@ def _ComputeTokensParameters_to_vertex(
3220
3119
  to_object,
3221
3120
  ['contents'],
3222
3121
  [
3223
- _Content_to_vertex(api_client, item, to_object)
3224
- for item in t.t_contents(
3225
- api_client, getv(from_object, ['contents'])
3226
- )
3122
+ _Content_to_vertex(item, to_object)
3123
+ for item in t.t_contents(getv(from_object, ['contents']))
3227
3124
  ],
3228
3125
  )
3229
3126
 
@@ -3233,8 +3130,28 @@ def _ComputeTokensParameters_to_vertex(
3233
3130
  return to_object
3234
3131
 
3235
3132
 
3133
+ def _Video_to_vertex(
3134
+ from_object: Union[dict[str, Any], object],
3135
+ parent_object: Optional[dict[str, Any]] = None,
3136
+ ) -> dict[str, Any]:
3137
+ to_object: dict[str, Any] = {}
3138
+ if getv(from_object, ['uri']) is not None:
3139
+ setv(to_object, ['gcsUri'], getv(from_object, ['uri']))
3140
+
3141
+ if getv(from_object, ['video_bytes']) is not None:
3142
+ setv(
3143
+ to_object,
3144
+ ['bytesBase64Encoded'],
3145
+ t.t_bytes(getv(from_object, ['video_bytes'])),
3146
+ )
3147
+
3148
+ if getv(from_object, ['mime_type']) is not None:
3149
+ setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
3150
+
3151
+ return to_object
3152
+
3153
+
3236
3154
  def _GenerateVideosConfig_to_vertex(
3237
- api_client: BaseApiClient,
3238
3155
  from_object: Union[dict[str, Any], object],
3239
3156
  parent_object: Optional[dict[str, Any]] = None,
3240
3157
  ) -> dict[str, Any]:
@@ -3316,6 +3233,13 @@ def _GenerateVideosConfig_to_vertex(
3316
3233
  getv(from_object, ['generate_audio']),
3317
3234
  )
3318
3235
 
3236
+ if getv(from_object, ['last_frame']) is not None:
3237
+ setv(
3238
+ parent_object,
3239
+ ['instances[0]', 'lastFrame'],
3240
+ _Image_to_vertex(getv(from_object, ['last_frame']), to_object),
3241
+ )
3242
+
3319
3243
  return to_object
3320
3244
 
3321
3245
 
@@ -3339,7 +3263,14 @@ def _GenerateVideosParameters_to_vertex(
3339
3263
  setv(
3340
3264
  to_object,
3341
3265
  ['instances[0]', 'image'],
3342
- _Image_to_vertex(api_client, getv(from_object, ['image']), to_object),
3266
+ _Image_to_vertex(getv(from_object, ['image']), to_object),
3267
+ )
3268
+
3269
+ if getv(from_object, ['video']) is not None:
3270
+ setv(
3271
+ to_object,
3272
+ ['instances[0]', 'video'],
3273
+ _Video_to_vertex(getv(from_object, ['video']), to_object),
3343
3274
  )
3344
3275
 
3345
3276
  if getv(from_object, ['config']) is not None:
@@ -3347,7 +3278,7 @@ def _GenerateVideosParameters_to_vertex(
3347
3278
  to_object,
3348
3279
  ['config'],
3349
3280
  _GenerateVideosConfig_to_vertex(
3350
- api_client, getv(from_object, ['config']), to_object
3281
+ getv(from_object, ['config']), to_object
3351
3282
  ),
3352
3283
  )
3353
3284
 
@@ -3355,12 +3286,14 @@ def _GenerateVideosParameters_to_vertex(
3355
3286
 
3356
3287
 
3357
3288
  def _FeatureSelectionPreference_to_mldev_enum_validate(enum_value: Any) -> None:
3358
- if enum_value in set([
3359
- 'FEATURE_SELECTION_PREFERENCE_UNSPECIFIED',
3360
- 'PRIORITIZE_QUALITY',
3361
- 'BALANCED',
3362
- 'PRIORITIZE_COST',
3363
- ]):
3289
+ if enum_value in set(
3290
+ [
3291
+ 'FEATURE_SELECTION_PREFERENCE_UNSPECIFIED',
3292
+ 'PRIORITIZE_QUALITY',
3293
+ 'BALANCED',
3294
+ 'PRIORITIZE_COST',
3295
+ ]
3296
+ ):
3364
3297
  raise ValueError(f'{enum_value} enum value is not supported in Gemini API.')
3365
3298
 
3366
3299
 
@@ -3380,7 +3313,6 @@ def _Behavior_to_vertex_enum_validate(enum_value: Any) -> None:
3380
3313
 
3381
3314
 
3382
3315
  def _VideoMetadata_from_mldev(
3383
- api_client: BaseApiClient,
3384
3316
  from_object: Union[dict[str, Any], object],
3385
3317
  parent_object: Optional[dict[str, Any]] = None,
3386
3318
  ) -> dict[str, Any]:
@@ -3398,7 +3330,6 @@ def _VideoMetadata_from_mldev(
3398
3330
 
3399
3331
 
3400
3332
  def _Blob_from_mldev(
3401
- api_client: BaseApiClient,
3402
3333
  from_object: Union[dict[str, Any], object],
3403
3334
  parent_object: Optional[dict[str, Any]] = None,
3404
3335
  ) -> dict[str, Any]:
@@ -3414,7 +3345,6 @@ def _Blob_from_mldev(
3414
3345
 
3415
3346
 
3416
3347
  def _FileData_from_mldev(
3417
- api_client: BaseApiClient,
3418
3348
  from_object: Union[dict[str, Any], object],
3419
3349
  parent_object: Optional[dict[str, Any]] = None,
3420
3350
  ) -> dict[str, Any]:
@@ -3430,7 +3360,6 @@ def _FileData_from_mldev(
3430
3360
 
3431
3361
 
3432
3362
  def _Part_from_mldev(
3433
- api_client: BaseApiClient,
3434
3363
  from_object: Union[dict[str, Any], object],
3435
3364
  parent_object: Optional[dict[str, Any]] = None,
3436
3365
  ) -> dict[str, Any]:
@@ -3440,7 +3369,7 @@ def _Part_from_mldev(
3440
3369
  to_object,
3441
3370
  ['video_metadata'],
3442
3371
  _VideoMetadata_from_mldev(
3443
- api_client, getv(from_object, ['videoMetadata']), to_object
3372
+ getv(from_object, ['videoMetadata']), to_object
3444
3373
  ),
3445
3374
  )
3446
3375
 
@@ -3451,18 +3380,14 @@ def _Part_from_mldev(
3451
3380
  setv(
3452
3381
  to_object,
3453
3382
  ['inline_data'],
3454
- _Blob_from_mldev(
3455
- api_client, getv(from_object, ['inlineData']), to_object
3456
- ),
3383
+ _Blob_from_mldev(getv(from_object, ['inlineData']), to_object),
3457
3384
  )
3458
3385
 
3459
3386
  if getv(from_object, ['fileData']) is not None:
3460
3387
  setv(
3461
3388
  to_object,
3462
3389
  ['file_data'],
3463
- _FileData_from_mldev(
3464
- api_client, getv(from_object, ['fileData']), to_object
3465
- ),
3390
+ _FileData_from_mldev(getv(from_object, ['fileData']), to_object),
3466
3391
  )
3467
3392
 
3468
3393
  if getv(from_object, ['thoughtSignature']) is not None:
@@ -3499,7 +3424,6 @@ def _Part_from_mldev(
3499
3424
 
3500
3425
 
3501
3426
  def _Content_from_mldev(
3502
- api_client: BaseApiClient,
3503
3427
  from_object: Union[dict[str, Any], object],
3504
3428
  parent_object: Optional[dict[str, Any]] = None,
3505
3429
  ) -> dict[str, Any]:
@@ -3509,7 +3433,7 @@ def _Content_from_mldev(
3509
3433
  to_object,
3510
3434
  ['parts'],
3511
3435
  [
3512
- _Part_from_mldev(api_client, item, to_object)
3436
+ _Part_from_mldev(item, to_object)
3513
3437
  for item in getv(from_object, ['parts'])
3514
3438
  ],
3515
3439
  )
@@ -3521,7 +3445,6 @@ def _Content_from_mldev(
3521
3445
 
3522
3446
 
3523
3447
  def _CitationMetadata_from_mldev(
3524
- api_client: BaseApiClient,
3525
3448
  from_object: Union[dict[str, Any], object],
3526
3449
  parent_object: Optional[dict[str, Any]] = None,
3527
3450
  ) -> dict[str, Any]:
@@ -3533,7 +3456,6 @@ def _CitationMetadata_from_mldev(
3533
3456
 
3534
3457
 
3535
3458
  def _UrlMetadata_from_mldev(
3536
- api_client: BaseApiClient,
3537
3459
  from_object: Union[dict[str, Any], object],
3538
3460
  parent_object: Optional[dict[str, Any]] = None,
3539
3461
  ) -> dict[str, Any]:
@@ -3552,7 +3474,6 @@ def _UrlMetadata_from_mldev(
3552
3474
 
3553
3475
 
3554
3476
  def _UrlContextMetadata_from_mldev(
3555
- api_client: BaseApiClient,
3556
3477
  from_object: Union[dict[str, Any], object],
3557
3478
  parent_object: Optional[dict[str, Any]] = None,
3558
3479
  ) -> dict[str, Any]:
@@ -3562,7 +3483,7 @@ def _UrlContextMetadata_from_mldev(
3562
3483
  to_object,
3563
3484
  ['url_metadata'],
3564
3485
  [
3565
- _UrlMetadata_from_mldev(api_client, item, to_object)
3486
+ _UrlMetadata_from_mldev(item, to_object)
3566
3487
  for item in getv(from_object, ['urlMetadata'])
3567
3488
  ],
3568
3489
  )
@@ -3571,7 +3492,6 @@ def _UrlContextMetadata_from_mldev(
3571
3492
 
3572
3493
 
3573
3494
  def _Candidate_from_mldev(
3574
- api_client: BaseApiClient,
3575
3495
  from_object: Union[dict[str, Any], object],
3576
3496
  parent_object: Optional[dict[str, Any]] = None,
3577
3497
  ) -> dict[str, Any]:
@@ -3580,9 +3500,7 @@ def _Candidate_from_mldev(
3580
3500
  setv(
3581
3501
  to_object,
3582
3502
  ['content'],
3583
- _Content_from_mldev(
3584
- api_client, getv(from_object, ['content']), to_object
3585
- ),
3503
+ _Content_from_mldev(getv(from_object, ['content']), to_object),
3586
3504
  )
3587
3505
 
3588
3506
  if getv(from_object, ['citationMetadata']) is not None:
@@ -3590,7 +3508,7 @@ def _Candidate_from_mldev(
3590
3508
  to_object,
3591
3509
  ['citation_metadata'],
3592
3510
  _CitationMetadata_from_mldev(
3593
- api_client, getv(from_object, ['citationMetadata']), to_object
3511
+ getv(from_object, ['citationMetadata']), to_object
3594
3512
  ),
3595
3513
  )
3596
3514
 
@@ -3605,7 +3523,7 @@ def _Candidate_from_mldev(
3605
3523
  to_object,
3606
3524
  ['url_context_metadata'],
3607
3525
  _UrlContextMetadata_from_mldev(
3608
- api_client, getv(from_object, ['urlContextMetadata']), to_object
3526
+ getv(from_object, ['urlContextMetadata']), to_object
3609
3527
  ),
3610
3528
  )
3611
3529
 
@@ -3632,7 +3550,6 @@ def _Candidate_from_mldev(
3632
3550
 
3633
3551
 
3634
3552
  def _GenerateContentResponse_from_mldev(
3635
- api_client: BaseApiClient,
3636
3553
  from_object: Union[dict[str, Any], object],
3637
3554
  parent_object: Optional[dict[str, Any]] = None,
3638
3555
  ) -> dict[str, Any]:
@@ -3642,7 +3559,7 @@ def _GenerateContentResponse_from_mldev(
3642
3559
  to_object,
3643
3560
  ['candidates'],
3644
3561
  [
3645
- _Candidate_from_mldev(api_client, item, to_object)
3562
+ _Candidate_from_mldev(item, to_object)
3646
3563
  for item in getv(from_object, ['candidates'])
3647
3564
  ],
3648
3565
  )
@@ -3660,7 +3577,6 @@ def _GenerateContentResponse_from_mldev(
3660
3577
 
3661
3578
 
3662
3579
  def _ContentEmbeddingStatistics_from_mldev(
3663
- api_client: BaseApiClient,
3664
3580
  from_object: Union[dict[str, Any], object],
3665
3581
  parent_object: Optional[dict[str, Any]] = None,
3666
3582
  ) -> dict[str, Any]:
@@ -3670,7 +3586,6 @@ def _ContentEmbeddingStatistics_from_mldev(
3670
3586
 
3671
3587
 
3672
3588
  def _ContentEmbedding_from_mldev(
3673
- api_client: BaseApiClient,
3674
3589
  from_object: Union[dict[str, Any], object],
3675
3590
  parent_object: Optional[dict[str, Any]] = None,
3676
3591
  ) -> dict[str, Any]:
@@ -3682,7 +3597,6 @@ def _ContentEmbedding_from_mldev(
3682
3597
 
3683
3598
 
3684
3599
  def _EmbedContentMetadata_from_mldev(
3685
- api_client: BaseApiClient,
3686
3600
  from_object: Union[dict[str, Any], object],
3687
3601
  parent_object: Optional[dict[str, Any]] = None,
3688
3602
  ) -> dict[str, Any]:
@@ -3692,7 +3606,6 @@ def _EmbedContentMetadata_from_mldev(
3692
3606
 
3693
3607
 
3694
3608
  def _EmbedContentResponse_from_mldev(
3695
- api_client: BaseApiClient,
3696
3609
  from_object: Union[dict[str, Any], object],
3697
3610
  parent_object: Optional[dict[str, Any]] = None,
3698
3611
  ) -> dict[str, Any]:
@@ -3702,7 +3615,7 @@ def _EmbedContentResponse_from_mldev(
3702
3615
  to_object,
3703
3616
  ['embeddings'],
3704
3617
  [
3705
- _ContentEmbedding_from_mldev(api_client, item, to_object)
3618
+ _ContentEmbedding_from_mldev(item, to_object)
3706
3619
  for item in getv(from_object, ['embeddings'])
3707
3620
  ],
3708
3621
  )
@@ -3712,7 +3625,7 @@ def _EmbedContentResponse_from_mldev(
3712
3625
  to_object,
3713
3626
  ['metadata'],
3714
3627
  _EmbedContentMetadata_from_mldev(
3715
- api_client, getv(from_object, ['metadata']), to_object
3628
+ getv(from_object, ['metadata']), to_object
3716
3629
  ),
3717
3630
  )
3718
3631
 
@@ -3720,7 +3633,6 @@ def _EmbedContentResponse_from_mldev(
3720
3633
 
3721
3634
 
3722
3635
  def _Image_from_mldev(
3723
- api_client: BaseApiClient,
3724
3636
  from_object: Union[dict[str, Any], object],
3725
3637
  parent_object: Optional[dict[str, Any]] = None,
3726
3638
  ) -> dict[str, Any]:
@@ -3730,7 +3642,7 @@ def _Image_from_mldev(
3730
3642
  setv(
3731
3643
  to_object,
3732
3644
  ['image_bytes'],
3733
- t.t_bytes(api_client, getv(from_object, ['bytesBase64Encoded'])),
3645
+ t.t_bytes(getv(from_object, ['bytesBase64Encoded'])),
3734
3646
  )
3735
3647
 
3736
3648
  if getv(from_object, ['mimeType']) is not None:
@@ -3740,7 +3652,6 @@ def _Image_from_mldev(
3740
3652
 
3741
3653
 
3742
3654
  def _SafetyAttributes_from_mldev(
3743
- api_client: BaseApiClient,
3744
3655
  from_object: Union[dict[str, Any], object],
3745
3656
  parent_object: Optional[dict[str, Any]] = None,
3746
3657
  ) -> dict[str, Any]:
@@ -3764,7 +3675,6 @@ def _SafetyAttributes_from_mldev(
3764
3675
 
3765
3676
 
3766
3677
  def _GeneratedImage_from_mldev(
3767
- api_client: BaseApiClient,
3768
3678
  from_object: Union[dict[str, Any], object],
3769
3679
  parent_object: Optional[dict[str, Any]] = None,
3770
3680
  ) -> dict[str, Any]:
@@ -3773,7 +3683,7 @@ def _GeneratedImage_from_mldev(
3773
3683
  setv(
3774
3684
  to_object,
3775
3685
  ['image'],
3776
- _Image_from_mldev(api_client, getv(from_object, ['_self']), to_object),
3686
+ _Image_from_mldev(getv(from_object, ['_self']), to_object),
3777
3687
  )
3778
3688
 
3779
3689
  if getv(from_object, ['raiFilteredReason']) is not None:
@@ -3787,16 +3697,13 @@ def _GeneratedImage_from_mldev(
3787
3697
  setv(
3788
3698
  to_object,
3789
3699
  ['safety_attributes'],
3790
- _SafetyAttributes_from_mldev(
3791
- api_client, getv(from_object, ['_self']), to_object
3792
- ),
3700
+ _SafetyAttributes_from_mldev(getv(from_object, ['_self']), to_object),
3793
3701
  )
3794
3702
 
3795
3703
  return to_object
3796
3704
 
3797
3705
 
3798
3706
  def _GenerateImagesResponse_from_mldev(
3799
- api_client: BaseApiClient,
3800
3707
  from_object: Union[dict[str, Any], object],
3801
3708
  parent_object: Optional[dict[str, Any]] = None,
3802
3709
  ) -> dict[str, Any]:
@@ -3806,7 +3713,7 @@ def _GenerateImagesResponse_from_mldev(
3806
3713
  to_object,
3807
3714
  ['generated_images'],
3808
3715
  [
3809
- _GeneratedImage_from_mldev(api_client, item, to_object)
3716
+ _GeneratedImage_from_mldev(item, to_object)
3810
3717
  for item in getv(from_object, ['predictions'])
3811
3718
  ],
3812
3719
  )
@@ -3816,9 +3723,7 @@ def _GenerateImagesResponse_from_mldev(
3816
3723
  to_object,
3817
3724
  ['positive_prompt_safety_attributes'],
3818
3725
  _SafetyAttributes_from_mldev(
3819
- api_client,
3820
- getv(from_object, ['positivePromptSafetyAttributes']),
3821
- to_object,
3726
+ getv(from_object, ['positivePromptSafetyAttributes']), to_object
3822
3727
  ),
3823
3728
  )
3824
3729
 
@@ -3826,7 +3731,6 @@ def _GenerateImagesResponse_from_mldev(
3826
3731
 
3827
3732
 
3828
3733
  def _Endpoint_from_mldev(
3829
- api_client: BaseApiClient,
3830
3734
  from_object: Union[dict[str, Any], object],
3831
3735
  parent_object: Optional[dict[str, Any]] = None,
3832
3736
  ) -> dict[str, Any]:
@@ -3836,7 +3740,6 @@ def _Endpoint_from_mldev(
3836
3740
 
3837
3741
 
3838
3742
  def _TunedModelInfo_from_mldev(
3839
- api_client: BaseApiClient,
3840
3743
  from_object: Union[dict[str, Any], object],
3841
3744
  parent_object: Optional[dict[str, Any]] = None,
3842
3745
  ) -> dict[str, Any]:
@@ -3854,7 +3757,6 @@ def _TunedModelInfo_from_mldev(
3854
3757
 
3855
3758
 
3856
3759
  def _Checkpoint_from_mldev(
3857
- api_client: BaseApiClient,
3858
3760
  from_object: Union[dict[str, Any], object],
3859
3761
  parent_object: Optional[dict[str, Any]] = None,
3860
3762
  ) -> dict[str, Any]:
@@ -3864,7 +3766,6 @@ def _Checkpoint_from_mldev(
3864
3766
 
3865
3767
 
3866
3768
  def _Model_from_mldev(
3867
- api_client: BaseApiClient,
3868
3769
  from_object: Union[dict[str, Any], object],
3869
3770
  parent_object: Optional[dict[str, Any]] = None,
3870
3771
  ) -> dict[str, Any]:
@@ -3885,9 +3786,7 @@ def _Model_from_mldev(
3885
3786
  setv(
3886
3787
  to_object,
3887
3788
  ['tuned_model_info'],
3888
- _TunedModelInfo_from_mldev(
3889
- api_client, getv(from_object, ['_self']), to_object
3890
- ),
3789
+ _TunedModelInfo_from_mldev(getv(from_object, ['_self']), to_object),
3891
3790
  )
3892
3791
 
3893
3792
  if getv(from_object, ['inputTokenLimit']) is not None:
@@ -3913,7 +3812,6 @@ def _Model_from_mldev(
3913
3812
 
3914
3813
 
3915
3814
  def _ListModelsResponse_from_mldev(
3916
- api_client: BaseApiClient,
3917
3815
  from_object: Union[dict[str, Any], object],
3918
3816
  parent_object: Optional[dict[str, Any]] = None,
3919
3817
  ) -> dict[str, Any]:
@@ -3926,10 +3824,8 @@ def _ListModelsResponse_from_mldev(
3926
3824
  to_object,
3927
3825
  ['models'],
3928
3826
  [
3929
- _Model_from_mldev(api_client, item, to_object)
3930
- for item in t.t_extract_models(
3931
- api_client, getv(from_object, ['_self'])
3932
- )
3827
+ _Model_from_mldev(item, to_object)
3828
+ for item in t.t_extract_models(getv(from_object, ['_self']))
3933
3829
  ],
3934
3830
  )
3935
3831
 
@@ -3937,7 +3833,6 @@ def _ListModelsResponse_from_mldev(
3937
3833
 
3938
3834
 
3939
3835
  def _DeleteModelResponse_from_mldev(
3940
- api_client: BaseApiClient,
3941
3836
  from_object: Union[dict[str, Any], object],
3942
3837
  parent_object: Optional[dict[str, Any]] = None,
3943
3838
  ) -> dict[str, Any]:
@@ -3947,7 +3842,6 @@ def _DeleteModelResponse_from_mldev(
3947
3842
 
3948
3843
 
3949
3844
  def _CountTokensResponse_from_mldev(
3950
- api_client: BaseApiClient,
3951
3845
  from_object: Union[dict[str, Any], object],
3952
3846
  parent_object: Optional[dict[str, Any]] = None,
3953
3847
  ) -> dict[str, Any]:
@@ -3966,7 +3860,6 @@ def _CountTokensResponse_from_mldev(
3966
3860
 
3967
3861
 
3968
3862
  def _Video_from_mldev(
3969
- api_client: BaseApiClient,
3970
3863
  from_object: Union[dict[str, Any], object],
3971
3864
  parent_object: Optional[dict[str, Any]] = None,
3972
3865
  ) -> dict[str, Any]:
@@ -3978,7 +3871,7 @@ def _Video_from_mldev(
3978
3871
  setv(
3979
3872
  to_object,
3980
3873
  ['video_bytes'],
3981
- t.t_bytes(api_client, getv(from_object, ['video', 'encodedVideo'])),
3874
+ t.t_bytes(getv(from_object, ['video', 'encodedVideo'])),
3982
3875
  )
3983
3876
 
3984
3877
  if getv(from_object, ['encoding']) is not None:
@@ -3988,7 +3881,6 @@ def _Video_from_mldev(
3988
3881
 
3989
3882
 
3990
3883
  def _GeneratedVideo_from_mldev(
3991
- api_client: BaseApiClient,
3992
3884
  from_object: Union[dict[str, Any], object],
3993
3885
  parent_object: Optional[dict[str, Any]] = None,
3994
3886
  ) -> dict[str, Any]:
@@ -3997,14 +3889,13 @@ def _GeneratedVideo_from_mldev(
3997
3889
  setv(
3998
3890
  to_object,
3999
3891
  ['video'],
4000
- _Video_from_mldev(api_client, getv(from_object, ['_self']), to_object),
3892
+ _Video_from_mldev(getv(from_object, ['_self']), to_object),
4001
3893
  )
4002
3894
 
4003
3895
  return to_object
4004
3896
 
4005
3897
 
4006
3898
  def _GenerateVideosResponse_from_mldev(
4007
- api_client: BaseApiClient,
4008
3899
  from_object: Union[dict[str, Any], object],
4009
3900
  parent_object: Optional[dict[str, Any]] = None,
4010
3901
  ) -> dict[str, Any]:
@@ -4014,7 +3905,7 @@ def _GenerateVideosResponse_from_mldev(
4014
3905
  to_object,
4015
3906
  ['generated_videos'],
4016
3907
  [
4017
- _GeneratedVideo_from_mldev(api_client, item, to_object)
3908
+ _GeneratedVideo_from_mldev(item, to_object)
4018
3909
  for item in getv(from_object, ['generatedSamples'])
4019
3910
  ],
4020
3911
  )
@@ -4037,7 +3928,6 @@ def _GenerateVideosResponse_from_mldev(
4037
3928
 
4038
3929
 
4039
3930
  def _GenerateVideosOperation_from_mldev(
4040
- api_client: BaseApiClient,
4041
3931
  from_object: Union[dict[str, Any], object],
4042
3932
  parent_object: Optional[dict[str, Any]] = None,
4043
3933
  ) -> dict[str, Any]:
@@ -4059,9 +3949,7 @@ def _GenerateVideosOperation_from_mldev(
4059
3949
  to_object,
4060
3950
  ['response'],
4061
3951
  _GenerateVideosResponse_from_mldev(
4062
- api_client,
4063
- getv(from_object, ['response', 'generateVideoResponse']),
4064
- to_object,
3952
+ getv(from_object, ['response', 'generateVideoResponse']), to_object
4065
3953
  ),
4066
3954
  )
4067
3955
 
@@ -4070,9 +3958,7 @@ def _GenerateVideosOperation_from_mldev(
4070
3958
  to_object,
4071
3959
  ['result'],
4072
3960
  _GenerateVideosResponse_from_mldev(
4073
- api_client,
4074
- getv(from_object, ['response', 'generateVideoResponse']),
4075
- to_object,
3961
+ getv(from_object, ['response', 'generateVideoResponse']), to_object
4076
3962
  ),
4077
3963
  )
4078
3964
 
@@ -4080,7 +3966,6 @@ def _GenerateVideosOperation_from_mldev(
4080
3966
 
4081
3967
 
4082
3968
  def _VideoMetadata_from_vertex(
4083
- api_client: BaseApiClient,
4084
3969
  from_object: Union[dict[str, Any], object],
4085
3970
  parent_object: Optional[dict[str, Any]] = None,
4086
3971
  ) -> dict[str, Any]:
@@ -4098,7 +3983,6 @@ def _VideoMetadata_from_vertex(
4098
3983
 
4099
3984
 
4100
3985
  def _Blob_from_vertex(
4101
- api_client: BaseApiClient,
4102
3986
  from_object: Union[dict[str, Any], object],
4103
3987
  parent_object: Optional[dict[str, Any]] = None,
4104
3988
  ) -> dict[str, Any]:
@@ -4116,7 +4000,6 @@ def _Blob_from_vertex(
4116
4000
 
4117
4001
 
4118
4002
  def _FileData_from_vertex(
4119
- api_client: BaseApiClient,
4120
4003
  from_object: Union[dict[str, Any], object],
4121
4004
  parent_object: Optional[dict[str, Any]] = None,
4122
4005
  ) -> dict[str, Any]:
@@ -4134,7 +4017,6 @@ def _FileData_from_vertex(
4134
4017
 
4135
4018
 
4136
4019
  def _Part_from_vertex(
4137
- api_client: BaseApiClient,
4138
4020
  from_object: Union[dict[str, Any], object],
4139
4021
  parent_object: Optional[dict[str, Any]] = None,
4140
4022
  ) -> dict[str, Any]:
@@ -4144,7 +4026,7 @@ def _Part_from_vertex(
4144
4026
  to_object,
4145
4027
  ['video_metadata'],
4146
4028
  _VideoMetadata_from_vertex(
4147
- api_client, getv(from_object, ['videoMetadata']), to_object
4029
+ getv(from_object, ['videoMetadata']), to_object
4148
4030
  ),
4149
4031
  )
4150
4032
 
@@ -4155,18 +4037,14 @@ def _Part_from_vertex(
4155
4037
  setv(
4156
4038
  to_object,
4157
4039
  ['inline_data'],
4158
- _Blob_from_vertex(
4159
- api_client, getv(from_object, ['inlineData']), to_object
4160
- ),
4040
+ _Blob_from_vertex(getv(from_object, ['inlineData']), to_object),
4161
4041
  )
4162
4042
 
4163
4043
  if getv(from_object, ['fileData']) is not None:
4164
4044
  setv(
4165
4045
  to_object,
4166
4046
  ['file_data'],
4167
- _FileData_from_vertex(
4168
- api_client, getv(from_object, ['fileData']), to_object
4169
- ),
4047
+ _FileData_from_vertex(getv(from_object, ['fileData']), to_object),
4170
4048
  )
4171
4049
 
4172
4050
  if getv(from_object, ['thoughtSignature']) is not None:
@@ -4203,7 +4081,6 @@ def _Part_from_vertex(
4203
4081
 
4204
4082
 
4205
4083
  def _Content_from_vertex(
4206
- api_client: BaseApiClient,
4207
4084
  from_object: Union[dict[str, Any], object],
4208
4085
  parent_object: Optional[dict[str, Any]] = None,
4209
4086
  ) -> dict[str, Any]:
@@ -4213,7 +4090,7 @@ def _Content_from_vertex(
4213
4090
  to_object,
4214
4091
  ['parts'],
4215
4092
  [
4216
- _Part_from_vertex(api_client, item, to_object)
4093
+ _Part_from_vertex(item, to_object)
4217
4094
  for item in getv(from_object, ['parts'])
4218
4095
  ],
4219
4096
  )
@@ -4225,7 +4102,6 @@ def _Content_from_vertex(
4225
4102
 
4226
4103
 
4227
4104
  def _CitationMetadata_from_vertex(
4228
- api_client: BaseApiClient,
4229
4105
  from_object: Union[dict[str, Any], object],
4230
4106
  parent_object: Optional[dict[str, Any]] = None,
4231
4107
  ) -> dict[str, Any]:
@@ -4237,7 +4113,6 @@ def _CitationMetadata_from_vertex(
4237
4113
 
4238
4114
 
4239
4115
  def _UrlMetadata_from_vertex(
4240
- api_client: BaseApiClient,
4241
4116
  from_object: Union[dict[str, Any], object],
4242
4117
  parent_object: Optional[dict[str, Any]] = None,
4243
4118
  ) -> dict[str, Any]:
@@ -4256,7 +4131,6 @@ def _UrlMetadata_from_vertex(
4256
4131
 
4257
4132
 
4258
4133
  def _UrlContextMetadata_from_vertex(
4259
- api_client: BaseApiClient,
4260
4134
  from_object: Union[dict[str, Any], object],
4261
4135
  parent_object: Optional[dict[str, Any]] = None,
4262
4136
  ) -> dict[str, Any]:
@@ -4266,7 +4140,7 @@ def _UrlContextMetadata_from_vertex(
4266
4140
  to_object,
4267
4141
  ['url_metadata'],
4268
4142
  [
4269
- _UrlMetadata_from_vertex(api_client, item, to_object)
4143
+ _UrlMetadata_from_vertex(item, to_object)
4270
4144
  for item in getv(from_object, ['urlMetadata'])
4271
4145
  ],
4272
4146
  )
@@ -4275,7 +4149,6 @@ def _UrlContextMetadata_from_vertex(
4275
4149
 
4276
4150
 
4277
4151
  def _Candidate_from_vertex(
4278
- api_client: BaseApiClient,
4279
4152
  from_object: Union[dict[str, Any], object],
4280
4153
  parent_object: Optional[dict[str, Any]] = None,
4281
4154
  ) -> dict[str, Any]:
@@ -4284,9 +4157,7 @@ def _Candidate_from_vertex(
4284
4157
  setv(
4285
4158
  to_object,
4286
4159
  ['content'],
4287
- _Content_from_vertex(
4288
- api_client, getv(from_object, ['content']), to_object
4289
- ),
4160
+ _Content_from_vertex(getv(from_object, ['content']), to_object),
4290
4161
  )
4291
4162
 
4292
4163
  if getv(from_object, ['citationMetadata']) is not None:
@@ -4294,7 +4165,7 @@ def _Candidate_from_vertex(
4294
4165
  to_object,
4295
4166
  ['citation_metadata'],
4296
4167
  _CitationMetadata_from_vertex(
4297
- api_client, getv(from_object, ['citationMetadata']), to_object
4168
+ getv(from_object, ['citationMetadata']), to_object
4298
4169
  ),
4299
4170
  )
4300
4171
 
@@ -4309,7 +4180,7 @@ def _Candidate_from_vertex(
4309
4180
  to_object,
4310
4181
  ['url_context_metadata'],
4311
4182
  _UrlContextMetadata_from_vertex(
4312
- api_client, getv(from_object, ['urlContextMetadata']), to_object
4183
+ getv(from_object, ['urlContextMetadata']), to_object
4313
4184
  ),
4314
4185
  )
4315
4186
 
@@ -4336,7 +4207,6 @@ def _Candidate_from_vertex(
4336
4207
 
4337
4208
 
4338
4209
  def _GenerateContentResponse_from_vertex(
4339
- api_client: BaseApiClient,
4340
4210
  from_object: Union[dict[str, Any], object],
4341
4211
  parent_object: Optional[dict[str, Any]] = None,
4342
4212
  ) -> dict[str, Any]:
@@ -4346,7 +4216,7 @@ def _GenerateContentResponse_from_vertex(
4346
4216
  to_object,
4347
4217
  ['candidates'],
4348
4218
  [
4349
- _Candidate_from_vertex(api_client, item, to_object)
4219
+ _Candidate_from_vertex(item, to_object)
4350
4220
  for item in getv(from_object, ['candidates'])
4351
4221
  ],
4352
4222
  )
@@ -4370,7 +4240,6 @@ def _GenerateContentResponse_from_vertex(
4370
4240
 
4371
4241
 
4372
4242
  def _ContentEmbeddingStatistics_from_vertex(
4373
- api_client: BaseApiClient,
4374
4243
  from_object: Union[dict[str, Any], object],
4375
4244
  parent_object: Optional[dict[str, Any]] = None,
4376
4245
  ) -> dict[str, Any]:
@@ -4385,7 +4254,6 @@ def _ContentEmbeddingStatistics_from_vertex(
4385
4254
 
4386
4255
 
4387
4256
  def _ContentEmbedding_from_vertex(
4388
- api_client: BaseApiClient,
4389
4257
  from_object: Union[dict[str, Any], object],
4390
4258
  parent_object: Optional[dict[str, Any]] = None,
4391
4259
  ) -> dict[str, Any]:
@@ -4398,7 +4266,7 @@ def _ContentEmbedding_from_vertex(
4398
4266
  to_object,
4399
4267
  ['statistics'],
4400
4268
  _ContentEmbeddingStatistics_from_vertex(
4401
- api_client, getv(from_object, ['statistics']), to_object
4269
+ getv(from_object, ['statistics']), to_object
4402
4270
  ),
4403
4271
  )
4404
4272
 
@@ -4406,7 +4274,6 @@ def _ContentEmbedding_from_vertex(
4406
4274
 
4407
4275
 
4408
4276
  def _EmbedContentMetadata_from_vertex(
4409
- api_client: BaseApiClient,
4410
4277
  from_object: Union[dict[str, Any], object],
4411
4278
  parent_object: Optional[dict[str, Any]] = None,
4412
4279
  ) -> dict[str, Any]:
@@ -4422,7 +4289,6 @@ def _EmbedContentMetadata_from_vertex(
4422
4289
 
4423
4290
 
4424
4291
  def _EmbedContentResponse_from_vertex(
4425
- api_client: BaseApiClient,
4426
4292
  from_object: Union[dict[str, Any], object],
4427
4293
  parent_object: Optional[dict[str, Any]] = None,
4428
4294
  ) -> dict[str, Any]:
@@ -4432,7 +4298,7 @@ def _EmbedContentResponse_from_vertex(
4432
4298
  to_object,
4433
4299
  ['embeddings'],
4434
4300
  [
4435
- _ContentEmbedding_from_vertex(api_client, item, to_object)
4301
+ _ContentEmbedding_from_vertex(item, to_object)
4436
4302
  for item in getv(from_object, ['predictions[]', 'embeddings'])
4437
4303
  ],
4438
4304
  )
@@ -4442,7 +4308,7 @@ def _EmbedContentResponse_from_vertex(
4442
4308
  to_object,
4443
4309
  ['metadata'],
4444
4310
  _EmbedContentMetadata_from_vertex(
4445
- api_client, getv(from_object, ['metadata']), to_object
4311
+ getv(from_object, ['metadata']), to_object
4446
4312
  ),
4447
4313
  )
4448
4314
 
@@ -4450,7 +4316,6 @@ def _EmbedContentResponse_from_vertex(
4450
4316
 
4451
4317
 
4452
4318
  def _Image_from_vertex(
4453
- api_client: BaseApiClient,
4454
4319
  from_object: Union[dict[str, Any], object],
4455
4320
  parent_object: Optional[dict[str, Any]] = None,
4456
4321
  ) -> dict[str, Any]:
@@ -4462,7 +4327,7 @@ def _Image_from_vertex(
4462
4327
  setv(
4463
4328
  to_object,
4464
4329
  ['image_bytes'],
4465
- t.t_bytes(api_client, getv(from_object, ['bytesBase64Encoded'])),
4330
+ t.t_bytes(getv(from_object, ['bytesBase64Encoded'])),
4466
4331
  )
4467
4332
 
4468
4333
  if getv(from_object, ['mimeType']) is not None:
@@ -4472,7 +4337,6 @@ def _Image_from_vertex(
4472
4337
 
4473
4338
 
4474
4339
  def _SafetyAttributes_from_vertex(
4475
- api_client: BaseApiClient,
4476
4340
  from_object: Union[dict[str, Any], object],
4477
4341
  parent_object: Optional[dict[str, Any]] = None,
4478
4342
  ) -> dict[str, Any]:
@@ -4496,7 +4360,6 @@ def _SafetyAttributes_from_vertex(
4496
4360
 
4497
4361
 
4498
4362
  def _GeneratedImage_from_vertex(
4499
- api_client: BaseApiClient,
4500
4363
  from_object: Union[dict[str, Any], object],
4501
4364
  parent_object: Optional[dict[str, Any]] = None,
4502
4365
  ) -> dict[str, Any]:
@@ -4505,7 +4368,7 @@ def _GeneratedImage_from_vertex(
4505
4368
  setv(
4506
4369
  to_object,
4507
4370
  ['image'],
4508
- _Image_from_vertex(api_client, getv(from_object, ['_self']), to_object),
4371
+ _Image_from_vertex(getv(from_object, ['_self']), to_object),
4509
4372
  )
4510
4373
 
4511
4374
  if getv(from_object, ['raiFilteredReason']) is not None:
@@ -4519,9 +4382,7 @@ def _GeneratedImage_from_vertex(
4519
4382
  setv(
4520
4383
  to_object,
4521
4384
  ['safety_attributes'],
4522
- _SafetyAttributes_from_vertex(
4523
- api_client, getv(from_object, ['_self']), to_object
4524
- ),
4385
+ _SafetyAttributes_from_vertex(getv(from_object, ['_self']), to_object),
4525
4386
  )
4526
4387
 
4527
4388
  if getv(from_object, ['prompt']) is not None:
@@ -4531,7 +4392,6 @@ def _GeneratedImage_from_vertex(
4531
4392
 
4532
4393
 
4533
4394
  def _GenerateImagesResponse_from_vertex(
4534
- api_client: BaseApiClient,
4535
4395
  from_object: Union[dict[str, Any], object],
4536
4396
  parent_object: Optional[dict[str, Any]] = None,
4537
4397
  ) -> dict[str, Any]:
@@ -4541,7 +4401,7 @@ def _GenerateImagesResponse_from_vertex(
4541
4401
  to_object,
4542
4402
  ['generated_images'],
4543
4403
  [
4544
- _GeneratedImage_from_vertex(api_client, item, to_object)
4404
+ _GeneratedImage_from_vertex(item, to_object)
4545
4405
  for item in getv(from_object, ['predictions'])
4546
4406
  ],
4547
4407
  )
@@ -4551,9 +4411,7 @@ def _GenerateImagesResponse_from_vertex(
4551
4411
  to_object,
4552
4412
  ['positive_prompt_safety_attributes'],
4553
4413
  _SafetyAttributes_from_vertex(
4554
- api_client,
4555
- getv(from_object, ['positivePromptSafetyAttributes']),
4556
- to_object,
4414
+ getv(from_object, ['positivePromptSafetyAttributes']), to_object
4557
4415
  ),
4558
4416
  )
4559
4417
 
@@ -4561,7 +4419,6 @@ def _GenerateImagesResponse_from_vertex(
4561
4419
 
4562
4420
 
4563
4421
  def _EditImageResponse_from_vertex(
4564
- api_client: BaseApiClient,
4565
4422
  from_object: Union[dict[str, Any], object],
4566
4423
  parent_object: Optional[dict[str, Any]] = None,
4567
4424
  ) -> dict[str, Any]:
@@ -4571,7 +4428,7 @@ def _EditImageResponse_from_vertex(
4571
4428
  to_object,
4572
4429
  ['generated_images'],
4573
4430
  [
4574
- _GeneratedImage_from_vertex(api_client, item, to_object)
4431
+ _GeneratedImage_from_vertex(item, to_object)
4575
4432
  for item in getv(from_object, ['predictions'])
4576
4433
  ],
4577
4434
  )
@@ -4580,7 +4437,6 @@ def _EditImageResponse_from_vertex(
4580
4437
 
4581
4438
 
4582
4439
  def _UpscaleImageResponse_from_vertex(
4583
- api_client: BaseApiClient,
4584
4440
  from_object: Union[dict[str, Any], object],
4585
4441
  parent_object: Optional[dict[str, Any]] = None,
4586
4442
  ) -> dict[str, Any]:
@@ -4590,7 +4446,7 @@ def _UpscaleImageResponse_from_vertex(
4590
4446
  to_object,
4591
4447
  ['generated_images'],
4592
4448
  [
4593
- _GeneratedImage_from_vertex(api_client, item, to_object)
4449
+ _GeneratedImage_from_vertex(item, to_object)
4594
4450
  for item in getv(from_object, ['predictions'])
4595
4451
  ],
4596
4452
  )
@@ -4599,7 +4455,6 @@ def _UpscaleImageResponse_from_vertex(
4599
4455
 
4600
4456
 
4601
4457
  def _Endpoint_from_vertex(
4602
- api_client: BaseApiClient,
4603
4458
  from_object: Union[dict[str, Any], object],
4604
4459
  parent_object: Optional[dict[str, Any]] = None,
4605
4460
  ) -> dict[str, Any]:
@@ -4616,7 +4471,6 @@ def _Endpoint_from_vertex(
4616
4471
 
4617
4472
 
4618
4473
  def _TunedModelInfo_from_vertex(
4619
- api_client: BaseApiClient,
4620
4474
  from_object: Union[dict[str, Any], object],
4621
4475
  parent_object: Optional[dict[str, Any]] = None,
4622
4476
  ) -> dict[str, Any]:
@@ -4641,7 +4495,6 @@ def _TunedModelInfo_from_vertex(
4641
4495
 
4642
4496
 
4643
4497
  def _Checkpoint_from_vertex(
4644
- api_client: BaseApiClient,
4645
4498
  from_object: Union[dict[str, Any], object],
4646
4499
  parent_object: Optional[dict[str, Any]] = None,
4647
4500
  ) -> dict[str, Any]:
@@ -4659,7 +4512,6 @@ def _Checkpoint_from_vertex(
4659
4512
 
4660
4513
 
4661
4514
  def _Model_from_vertex(
4662
- api_client: BaseApiClient,
4663
4515
  from_object: Union[dict[str, Any], object],
4664
4516
  parent_object: Optional[dict[str, Any]] = None,
4665
4517
  ) -> dict[str, Any]:
@@ -4681,7 +4533,7 @@ def _Model_from_vertex(
4681
4533
  to_object,
4682
4534
  ['endpoints'],
4683
4535
  [
4684
- _Endpoint_from_vertex(api_client, item, to_object)
4536
+ _Endpoint_from_vertex(item, to_object)
4685
4537
  for item in getv(from_object, ['deployedModels'])
4686
4538
  ],
4687
4539
  )
@@ -4693,9 +4545,7 @@ def _Model_from_vertex(
4693
4545
  setv(
4694
4546
  to_object,
4695
4547
  ['tuned_model_info'],
4696
- _TunedModelInfo_from_vertex(
4697
- api_client, getv(from_object, ['_self']), to_object
4698
- ),
4548
+ _TunedModelInfo_from_vertex(getv(from_object, ['_self']), to_object),
4699
4549
  )
4700
4550
 
4701
4551
  if getv(from_object, ['defaultCheckpointId']) is not None:
@@ -4710,7 +4560,7 @@ def _Model_from_vertex(
4710
4560
  to_object,
4711
4561
  ['checkpoints'],
4712
4562
  [
4713
- _Checkpoint_from_vertex(api_client, item, to_object)
4563
+ _Checkpoint_from_vertex(item, to_object)
4714
4564
  for item in getv(from_object, ['checkpoints'])
4715
4565
  ],
4716
4566
  )
@@ -4719,7 +4569,6 @@ def _Model_from_vertex(
4719
4569
 
4720
4570
 
4721
4571
  def _ListModelsResponse_from_vertex(
4722
- api_client: BaseApiClient,
4723
4572
  from_object: Union[dict[str, Any], object],
4724
4573
  parent_object: Optional[dict[str, Any]] = None,
4725
4574
  ) -> dict[str, Any]:
@@ -4732,10 +4581,8 @@ def _ListModelsResponse_from_vertex(
4732
4581
  to_object,
4733
4582
  ['models'],
4734
4583
  [
4735
- _Model_from_vertex(api_client, item, to_object)
4736
- for item in t.t_extract_models(
4737
- api_client, getv(from_object, ['_self'])
4738
- )
4584
+ _Model_from_vertex(item, to_object)
4585
+ for item in t.t_extract_models(getv(from_object, ['_self']))
4739
4586
  ],
4740
4587
  )
4741
4588
 
@@ -4743,7 +4590,6 @@ def _ListModelsResponse_from_vertex(
4743
4590
 
4744
4591
 
4745
4592
  def _DeleteModelResponse_from_vertex(
4746
- api_client: BaseApiClient,
4747
4593
  from_object: Union[dict[str, Any], object],
4748
4594
  parent_object: Optional[dict[str, Any]] = None,
4749
4595
  ) -> dict[str, Any]:
@@ -4753,7 +4599,6 @@ def _DeleteModelResponse_from_vertex(
4753
4599
 
4754
4600
 
4755
4601
  def _CountTokensResponse_from_vertex(
4756
- api_client: BaseApiClient,
4757
4602
  from_object: Union[dict[str, Any], object],
4758
4603
  parent_object: Optional[dict[str, Any]] = None,
4759
4604
  ) -> dict[str, Any]:
@@ -4765,7 +4610,6 @@ def _CountTokensResponse_from_vertex(
4765
4610
 
4766
4611
 
4767
4612
  def _ComputeTokensResponse_from_vertex(
4768
- api_client: BaseApiClient,
4769
4613
  from_object: Union[dict[str, Any], object],
4770
4614
  parent_object: Optional[dict[str, Any]] = None,
4771
4615
  ) -> dict[str, Any]:
@@ -4777,7 +4621,6 @@ def _ComputeTokensResponse_from_vertex(
4777
4621
 
4778
4622
 
4779
4623
  def _Video_from_vertex(
4780
- api_client: BaseApiClient,
4781
4624
  from_object: Union[dict[str, Any], object],
4782
4625
  parent_object: Optional[dict[str, Any]] = None,
4783
4626
  ) -> dict[str, Any]:
@@ -4789,7 +4632,7 @@ def _Video_from_vertex(
4789
4632
  setv(
4790
4633
  to_object,
4791
4634
  ['video_bytes'],
4792
- t.t_bytes(api_client, getv(from_object, ['bytesBase64Encoded'])),
4635
+ t.t_bytes(getv(from_object, ['bytesBase64Encoded'])),
4793
4636
  )
4794
4637
 
4795
4638
  if getv(from_object, ['mimeType']) is not None:
@@ -4799,7 +4642,6 @@ def _Video_from_vertex(
4799
4642
 
4800
4643
 
4801
4644
  def _GeneratedVideo_from_vertex(
4802
- api_client: BaseApiClient,
4803
4645
  from_object: Union[dict[str, Any], object],
4804
4646
  parent_object: Optional[dict[str, Any]] = None,
4805
4647
  ) -> dict[str, Any]:
@@ -4808,14 +4650,13 @@ def _GeneratedVideo_from_vertex(
4808
4650
  setv(
4809
4651
  to_object,
4810
4652
  ['video'],
4811
- _Video_from_vertex(api_client, getv(from_object, ['_self']), to_object),
4653
+ _Video_from_vertex(getv(from_object, ['_self']), to_object),
4812
4654
  )
4813
4655
 
4814
4656
  return to_object
4815
4657
 
4816
4658
 
4817
4659
  def _GenerateVideosResponse_from_vertex(
4818
- api_client: BaseApiClient,
4819
4660
  from_object: Union[dict[str, Any], object],
4820
4661
  parent_object: Optional[dict[str, Any]] = None,
4821
4662
  ) -> dict[str, Any]:
@@ -4825,7 +4666,7 @@ def _GenerateVideosResponse_from_vertex(
4825
4666
  to_object,
4826
4667
  ['generated_videos'],
4827
4668
  [
4828
- _GeneratedVideo_from_vertex(api_client, item, to_object)
4669
+ _GeneratedVideo_from_vertex(item, to_object)
4829
4670
  for item in getv(from_object, ['videos'])
4830
4671
  ],
4831
4672
  )
@@ -4848,7 +4689,6 @@ def _GenerateVideosResponse_from_vertex(
4848
4689
 
4849
4690
 
4850
4691
  def _GenerateVideosOperation_from_vertex(
4851
- api_client: BaseApiClient,
4852
4692
  from_object: Union[dict[str, Any], object],
4853
4693
  parent_object: Optional[dict[str, Any]] = None,
4854
4694
  ) -> dict[str, Any]:
@@ -4870,7 +4710,7 @@ def _GenerateVideosOperation_from_vertex(
4870
4710
  to_object,
4871
4711
  ['response'],
4872
4712
  _GenerateVideosResponse_from_vertex(
4873
- api_client, getv(from_object, ['response']), to_object
4713
+ getv(from_object, ['response']), to_object
4874
4714
  ),
4875
4715
  )
4876
4716
 
@@ -4879,7 +4719,7 @@ def _GenerateVideosOperation_from_vertex(
4879
4719
  to_object,
4880
4720
  ['result'],
4881
4721
  _GenerateVideosResponse_from_vertex(
4882
- api_client, getv(from_object, ['response']), to_object
4722
+ getv(from_object, ['response']), to_object
4883
4723
  ),
4884
4724
  )
4885
4725
 
@@ -4937,19 +4777,17 @@ class Models(_api_module.BaseModule):
4937
4777
  request_dict = _common.convert_to_dict(request_dict)
4938
4778
  request_dict = _common.encode_unserializable_types(request_dict)
4939
4779
 
4940
- response_dict = self._api_client.request(
4780
+ response = self._api_client.request(
4941
4781
  'post', path, request_dict, http_options
4942
4782
  )
4943
4783
 
4784
+ response_dict = '' if not response.body else json.loads(response.body)
4785
+
4944
4786
  if self._api_client.vertexai:
4945
- response_dict = _GenerateContentResponse_from_vertex(
4946
- self._api_client, response_dict
4947
- )
4787
+ response_dict = _GenerateContentResponse_from_vertex(response_dict)
4948
4788
 
4949
4789
  else:
4950
- response_dict = _GenerateContentResponse_from_mldev(
4951
- self._api_client, response_dict
4952
- )
4790
+ response_dict = _GenerateContentResponse_from_mldev(response_dict)
4953
4791
 
4954
4792
  return_value = types.GenerateContentResponse._from_response(
4955
4793
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -5010,19 +4848,23 @@ class Models(_api_module.BaseModule):
5010
4848
  request_dict = _common.convert_to_dict(request_dict)
5011
4849
  request_dict = _common.encode_unserializable_types(request_dict)
5012
4850
 
4851
+ if config is not None and getattr(
4852
+ config, 'should_return_http_response', None
4853
+ ):
4854
+ raise ValueError(
4855
+ 'Accessing the raw HTTP response is not supported in streaming'
4856
+ ' methods.'
4857
+ )
4858
+
5013
4859
  for response_dict in self._api_client.request_streamed(
5014
4860
  'post', path, request_dict, http_options
5015
4861
  ):
5016
4862
 
5017
4863
  if self._api_client.vertexai:
5018
- response_dict = _GenerateContentResponse_from_vertex(
5019
- self._api_client, response_dict
5020
- )
4864
+ response_dict = _GenerateContentResponse_from_vertex(response_dict)
5021
4865
 
5022
4866
  else:
5023
- response_dict = _GenerateContentResponse_from_mldev(
5024
- self._api_client, response_dict
5025
- )
4867
+ response_dict = _GenerateContentResponse_from_mldev(response_dict)
5026
4868
 
5027
4869
  return_value = types.GenerateContentResponse._from_response(
5028
4870
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -5102,19 +4944,17 @@ class Models(_api_module.BaseModule):
5102
4944
  request_dict = _common.convert_to_dict(request_dict)
5103
4945
  request_dict = _common.encode_unserializable_types(request_dict)
5104
4946
 
5105
- response_dict = self._api_client.request(
4947
+ response = self._api_client.request(
5106
4948
  'post', path, request_dict, http_options
5107
4949
  )
5108
4950
 
4951
+ response_dict = '' if not response.body else json.loads(response.body)
4952
+
5109
4953
  if self._api_client.vertexai:
5110
- response_dict = _EmbedContentResponse_from_vertex(
5111
- self._api_client, response_dict
5112
- )
4954
+ response_dict = _EmbedContentResponse_from_vertex(response_dict)
5113
4955
 
5114
4956
  else:
5115
- response_dict = _EmbedContentResponse_from_mldev(
5116
- self._api_client, response_dict
5117
- )
4957
+ response_dict = _EmbedContentResponse_from_mldev(response_dict)
5118
4958
 
5119
4959
  return_value = types.EmbedContentResponse._from_response(
5120
4960
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -5179,19 +5019,17 @@ class Models(_api_module.BaseModule):
5179
5019
  request_dict = _common.convert_to_dict(request_dict)
5180
5020
  request_dict = _common.encode_unserializable_types(request_dict)
5181
5021
 
5182
- response_dict = self._api_client.request(
5022
+ response = self._api_client.request(
5183
5023
  'post', path, request_dict, http_options
5184
5024
  )
5185
5025
 
5026
+ response_dict = '' if not response.body else json.loads(response.body)
5027
+
5186
5028
  if self._api_client.vertexai:
5187
- response_dict = _GenerateImagesResponse_from_vertex(
5188
- self._api_client, response_dict
5189
- )
5029
+ response_dict = _GenerateImagesResponse_from_vertex(response_dict)
5190
5030
 
5191
5031
  else:
5192
- response_dict = _GenerateImagesResponse_from_mldev(
5193
- self._api_client, response_dict
5194
- )
5032
+ response_dict = _GenerateImagesResponse_from_mldev(response_dict)
5195
5033
 
5196
5034
  return_value = types.GenerateImagesResponse._from_response(
5197
5035
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -5285,14 +5123,14 @@ class Models(_api_module.BaseModule):
5285
5123
  request_dict = _common.convert_to_dict(request_dict)
5286
5124
  request_dict = _common.encode_unserializable_types(request_dict)
5287
5125
 
5288
- response_dict = self._api_client.request(
5126
+ response = self._api_client.request(
5289
5127
  'post', path, request_dict, http_options
5290
5128
  )
5291
5129
 
5130
+ response_dict = '' if not response.body else json.loads(response.body)
5131
+
5292
5132
  if self._api_client.vertexai:
5293
- response_dict = _EditImageResponse_from_vertex(
5294
- self._api_client, response_dict
5295
- )
5133
+ response_dict = _EditImageResponse_from_vertex(response_dict)
5296
5134
 
5297
5135
  return_value = types.EditImageResponse._from_response(
5298
5136
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -5353,14 +5191,14 @@ class Models(_api_module.BaseModule):
5353
5191
  request_dict = _common.convert_to_dict(request_dict)
5354
5192
  request_dict = _common.encode_unserializable_types(request_dict)
5355
5193
 
5356
- response_dict = self._api_client.request(
5194
+ response = self._api_client.request(
5357
5195
  'post', path, request_dict, http_options
5358
5196
  )
5359
5197
 
5198
+ response_dict = '' if not response.body else json.loads(response.body)
5199
+
5360
5200
  if self._api_client.vertexai:
5361
- response_dict = _UpscaleImageResponse_from_vertex(
5362
- self._api_client, response_dict
5363
- )
5201
+ response_dict = _UpscaleImageResponse_from_vertex(response_dict)
5364
5202
 
5365
5203
  return_value = types.UpscaleImageResponse._from_response(
5366
5204
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -5412,15 +5250,15 @@ class Models(_api_module.BaseModule):
5412
5250
  request_dict = _common.convert_to_dict(request_dict)
5413
5251
  request_dict = _common.encode_unserializable_types(request_dict)
5414
5252
 
5415
- response_dict = self._api_client.request(
5416
- 'get', path, request_dict, http_options
5417
- )
5253
+ response = self._api_client.request('get', path, request_dict, http_options)
5254
+
5255
+ response_dict = '' if not response.body else json.loads(response.body)
5418
5256
 
5419
5257
  if self._api_client.vertexai:
5420
- response_dict = _Model_from_vertex(self._api_client, response_dict)
5258
+ response_dict = _Model_from_vertex(response_dict)
5421
5259
 
5422
5260
  else:
5423
- response_dict = _Model_from_mldev(self._api_client, response_dict)
5261
+ response_dict = _Model_from_mldev(response_dict)
5424
5262
 
5425
5263
  return_value = types.Model._from_response(
5426
5264
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -5471,19 +5309,15 @@ class Models(_api_module.BaseModule):
5471
5309
  request_dict = _common.convert_to_dict(request_dict)
5472
5310
  request_dict = _common.encode_unserializable_types(request_dict)
5473
5311
 
5474
- response_dict = self._api_client.request(
5475
- 'get', path, request_dict, http_options
5476
- )
5312
+ response = self._api_client.request('get', path, request_dict, http_options)
5313
+
5314
+ response_dict = '' if not response.body else json.loads(response.body)
5477
5315
 
5478
5316
  if self._api_client.vertexai:
5479
- response_dict = _ListModelsResponse_from_vertex(
5480
- self._api_client, response_dict
5481
- )
5317
+ response_dict = _ListModelsResponse_from_vertex(response_dict)
5482
5318
 
5483
5319
  else:
5484
- response_dict = _ListModelsResponse_from_mldev(
5485
- self._api_client, response_dict
5486
- )
5320
+ response_dict = _ListModelsResponse_from_mldev(response_dict)
5487
5321
 
5488
5322
  return_value = types.ListModelsResponse._from_response(
5489
5323
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -5538,15 +5372,17 @@ class Models(_api_module.BaseModule):
5538
5372
  request_dict = _common.convert_to_dict(request_dict)
5539
5373
  request_dict = _common.encode_unserializable_types(request_dict)
5540
5374
 
5541
- response_dict = self._api_client.request(
5375
+ response = self._api_client.request(
5542
5376
  'patch', path, request_dict, http_options
5543
5377
  )
5544
5378
 
5379
+ response_dict = '' if not response.body else json.loads(response.body)
5380
+
5545
5381
  if self._api_client.vertexai:
5546
- response_dict = _Model_from_vertex(self._api_client, response_dict)
5382
+ response_dict = _Model_from_vertex(response_dict)
5547
5383
 
5548
5384
  else:
5549
- response_dict = _Model_from_mldev(self._api_client, response_dict)
5385
+ response_dict = _Model_from_mldev(response_dict)
5550
5386
 
5551
5387
  return_value = types.Model._from_response(
5552
5388
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -5601,19 +5437,17 @@ class Models(_api_module.BaseModule):
5601
5437
  request_dict = _common.convert_to_dict(request_dict)
5602
5438
  request_dict = _common.encode_unserializable_types(request_dict)
5603
5439
 
5604
- response_dict = self._api_client.request(
5440
+ response = self._api_client.request(
5605
5441
  'delete', path, request_dict, http_options
5606
5442
  )
5607
5443
 
5444
+ response_dict = '' if not response.body else json.loads(response.body)
5445
+
5608
5446
  if self._api_client.vertexai:
5609
- response_dict = _DeleteModelResponse_from_vertex(
5610
- self._api_client, response_dict
5611
- )
5447
+ response_dict = _DeleteModelResponse_from_vertex(response_dict)
5612
5448
 
5613
5449
  else:
5614
- response_dict = _DeleteModelResponse_from_mldev(
5615
- self._api_client, response_dict
5616
- )
5450
+ response_dict = _DeleteModelResponse_from_mldev(response_dict)
5617
5451
 
5618
5452
  return_value = types.DeleteModelResponse._from_response(
5619
5453
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -5691,19 +5525,17 @@ class Models(_api_module.BaseModule):
5691
5525
  request_dict = _common.convert_to_dict(request_dict)
5692
5526
  request_dict = _common.encode_unserializable_types(request_dict)
5693
5527
 
5694
- response_dict = self._api_client.request(
5528
+ response = self._api_client.request(
5695
5529
  'post', path, request_dict, http_options
5696
5530
  )
5697
5531
 
5532
+ response_dict = '' if not response.body else json.loads(response.body)
5533
+
5698
5534
  if self._api_client.vertexai:
5699
- response_dict = _CountTokensResponse_from_vertex(
5700
- self._api_client, response_dict
5701
- )
5535
+ response_dict = _CountTokensResponse_from_vertex(response_dict)
5702
5536
 
5703
5537
  else:
5704
- response_dict = _CountTokensResponse_from_mldev(
5705
- self._api_client, response_dict
5706
- )
5538
+ response_dict = _CountTokensResponse_from_mldev(response_dict)
5707
5539
 
5708
5540
  return_value = types.CountTokensResponse._from_response(
5709
5541
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -5776,14 +5608,14 @@ class Models(_api_module.BaseModule):
5776
5608
  request_dict = _common.convert_to_dict(request_dict)
5777
5609
  request_dict = _common.encode_unserializable_types(request_dict)
5778
5610
 
5779
- response_dict = self._api_client.request(
5611
+ response = self._api_client.request(
5780
5612
  'post', path, request_dict, http_options
5781
5613
  )
5782
5614
 
5615
+ response_dict = '' if not response.body else json.loads(response.body)
5616
+
5783
5617
  if self._api_client.vertexai:
5784
- response_dict = _ComputeTokensResponse_from_vertex(
5785
- self._api_client, response_dict
5786
- )
5618
+ response_dict = _ComputeTokensResponse_from_vertex(response_dict)
5787
5619
 
5788
5620
  return_value = types.ComputeTokensResponse._from_response(
5789
5621
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -5797,13 +5629,26 @@ class Models(_api_module.BaseModule):
5797
5629
  model: str,
5798
5630
  prompt: Optional[str] = None,
5799
5631
  image: Optional[types.ImageOrDict] = None,
5632
+ video: Optional[types.VideoOrDict] = None,
5800
5633
  config: Optional[types.GenerateVideosConfigOrDict] = None,
5801
5634
  ) -> types.GenerateVideosOperation:
5802
- """Generates videos based on a text description and configuration.
5635
+ """Generates videos based on an input (text, image, or video) and configuration.
5636
+
5637
+ The following use cases are supported:
5638
+ 1. Text to video generation.
5639
+ 2a. Image to video generation (additional text prompt is optional).
5640
+ 2b. Image to video generation with frame interpolation (specify last_frame
5641
+ in config).
5642
+ 3. Video extension (additional text prompt is optional)
5803
5643
 
5804
5644
  Args:
5805
5645
  model: The model to use.
5806
- instances: A list of prompts, images and videos to generate videos from.
5646
+ prompt: The text prompt for generating the videos. Optional for image to
5647
+ video use cases.
5648
+ image: The input image for generating the videos. Optional if prompt is
5649
+ provided.
5650
+ video: The input video for video extension use cases. Optional if prompt
5651
+ or image is provided.
5807
5652
  config: Configuration for generation.
5808
5653
 
5809
5654
  Usage:
@@ -5825,6 +5670,7 @@ class Models(_api_module.BaseModule):
5825
5670
  model=model,
5826
5671
  prompt=prompt,
5827
5672
  image=image,
5673
+ video=video,
5828
5674
  config=config,
5829
5675
  )
5830
5676
 
@@ -5864,19 +5710,17 @@ class Models(_api_module.BaseModule):
5864
5710
  request_dict = _common.convert_to_dict(request_dict)
5865
5711
  request_dict = _common.encode_unserializable_types(request_dict)
5866
5712
 
5867
- response_dict = self._api_client.request(
5713
+ response = self._api_client.request(
5868
5714
  'post', path, request_dict, http_options
5869
5715
  )
5870
5716
 
5717
+ response_dict = '' if not response.body else json.loads(response.body)
5718
+
5871
5719
  if self._api_client.vertexai:
5872
- response_dict = _GenerateVideosOperation_from_vertex(
5873
- self._api_client, response_dict
5874
- )
5720
+ response_dict = _GenerateVideosOperation_from_vertex(response_dict)
5875
5721
 
5876
5722
  else:
5877
- response_dict = _GenerateVideosOperation_from_mldev(
5878
- self._api_client, response_dict
5879
- )
5723
+ response_dict = _GenerateVideosOperation_from_mldev(response_dict)
5880
5724
 
5881
5725
  return_value = types.GenerateVideosOperation._from_response(
5882
5726
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -6003,7 +5847,7 @@ class Models(_api_module.BaseModule):
6003
5847
  role='user',
6004
5848
  parts=func_response_parts,
6005
5849
  )
6006
- contents = t.t_contents(self._api_client, contents) # type: ignore[assignment]
5850
+ contents = t.t_contents(contents) # type: ignore[assignment]
6007
5851
  if not automatic_function_calling_history:
6008
5852
  automatic_function_calling_history.extend(contents) # type: ignore[arg-type]
6009
5853
  if isinstance(contents, list):
@@ -6174,7 +6018,7 @@ class Models(_api_module.BaseModule):
6174
6018
  role='user',
6175
6019
  parts=func_response_parts,
6176
6020
  )
6177
- contents = t.t_contents(self._api_client, contents) # type: ignore[assignment]
6021
+ contents = t.t_contents(contents) # type: ignore[assignment]
6178
6022
  if not automatic_function_calling_history:
6179
6023
  automatic_function_calling_history.extend(contents) # type: ignore[arg-type]
6180
6024
  if isinstance(contents, list) and func_call_content is not None:
@@ -6463,19 +6307,17 @@ class AsyncModels(_api_module.BaseModule):
6463
6307
  request_dict = _common.convert_to_dict(request_dict)
6464
6308
  request_dict = _common.encode_unserializable_types(request_dict)
6465
6309
 
6466
- response_dict = await self._api_client.async_request(
6310
+ response = await self._api_client.async_request(
6467
6311
  'post', path, request_dict, http_options
6468
6312
  )
6469
6313
 
6314
+ response_dict = '' if not response.body else json.loads(response.body)
6315
+
6470
6316
  if self._api_client.vertexai:
6471
- response_dict = _GenerateContentResponse_from_vertex(
6472
- self._api_client, response_dict
6473
- )
6317
+ response_dict = _GenerateContentResponse_from_vertex(response_dict)
6474
6318
 
6475
6319
  else:
6476
- response_dict = _GenerateContentResponse_from_mldev(
6477
- self._api_client, response_dict
6478
- )
6320
+ response_dict = _GenerateContentResponse_from_mldev(response_dict)
6479
6321
 
6480
6322
  return_value = types.GenerateContentResponse._from_response(
6481
6323
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -6536,6 +6378,14 @@ class AsyncModels(_api_module.BaseModule):
6536
6378
  request_dict = _common.convert_to_dict(request_dict)
6537
6379
  request_dict = _common.encode_unserializable_types(request_dict)
6538
6380
 
6381
+ if config is not None and getattr(
6382
+ config, 'should_return_http_response', None
6383
+ ):
6384
+ raise ValueError(
6385
+ 'Accessing the raw HTTP response is not supported in streaming'
6386
+ ' methods.'
6387
+ )
6388
+
6539
6389
  response_stream = await self._api_client.async_request_streamed(
6540
6390
  'post', path, request_dict, http_options
6541
6391
  )
@@ -6544,14 +6394,10 @@ class AsyncModels(_api_module.BaseModule):
6544
6394
  async for response_dict in response_stream:
6545
6395
 
6546
6396
  if self._api_client.vertexai:
6547
- response_dict = _GenerateContentResponse_from_vertex(
6548
- self._api_client, response_dict
6549
- )
6397
+ response_dict = _GenerateContentResponse_from_vertex(response_dict)
6550
6398
 
6551
6399
  else:
6552
- response_dict = _GenerateContentResponse_from_mldev(
6553
- self._api_client, response_dict
6554
- )
6400
+ response_dict = _GenerateContentResponse_from_mldev(response_dict)
6555
6401
 
6556
6402
  return_value = types.GenerateContentResponse._from_response(
6557
6403
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -6633,19 +6479,17 @@ class AsyncModels(_api_module.BaseModule):
6633
6479
  request_dict = _common.convert_to_dict(request_dict)
6634
6480
  request_dict = _common.encode_unserializable_types(request_dict)
6635
6481
 
6636
- response_dict = await self._api_client.async_request(
6482
+ response = await self._api_client.async_request(
6637
6483
  'post', path, request_dict, http_options
6638
6484
  )
6639
6485
 
6486
+ response_dict = '' if not response.body else json.loads(response.body)
6487
+
6640
6488
  if self._api_client.vertexai:
6641
- response_dict = _EmbedContentResponse_from_vertex(
6642
- self._api_client, response_dict
6643
- )
6489
+ response_dict = _EmbedContentResponse_from_vertex(response_dict)
6644
6490
 
6645
6491
  else:
6646
- response_dict = _EmbedContentResponse_from_mldev(
6647
- self._api_client, response_dict
6648
- )
6492
+ response_dict = _EmbedContentResponse_from_mldev(response_dict)
6649
6493
 
6650
6494
  return_value = types.EmbedContentResponse._from_response(
6651
6495
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -6710,19 +6554,17 @@ class AsyncModels(_api_module.BaseModule):
6710
6554
  request_dict = _common.convert_to_dict(request_dict)
6711
6555
  request_dict = _common.encode_unserializable_types(request_dict)
6712
6556
 
6713
- response_dict = await self._api_client.async_request(
6557
+ response = await self._api_client.async_request(
6714
6558
  'post', path, request_dict, http_options
6715
6559
  )
6716
6560
 
6561
+ response_dict = '' if not response.body else json.loads(response.body)
6562
+
6717
6563
  if self._api_client.vertexai:
6718
- response_dict = _GenerateImagesResponse_from_vertex(
6719
- self._api_client, response_dict
6720
- )
6564
+ response_dict = _GenerateImagesResponse_from_vertex(response_dict)
6721
6565
 
6722
6566
  else:
6723
- response_dict = _GenerateImagesResponse_from_mldev(
6724
- self._api_client, response_dict
6725
- )
6567
+ response_dict = _GenerateImagesResponse_from_mldev(response_dict)
6726
6568
 
6727
6569
  return_value = types.GenerateImagesResponse._from_response(
6728
6570
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -6816,14 +6658,14 @@ class AsyncModels(_api_module.BaseModule):
6816
6658
  request_dict = _common.convert_to_dict(request_dict)
6817
6659
  request_dict = _common.encode_unserializable_types(request_dict)
6818
6660
 
6819
- response_dict = await self._api_client.async_request(
6661
+ response = await self._api_client.async_request(
6820
6662
  'post', path, request_dict, http_options
6821
6663
  )
6822
6664
 
6665
+ response_dict = '' if not response.body else json.loads(response.body)
6666
+
6823
6667
  if self._api_client.vertexai:
6824
- response_dict = _EditImageResponse_from_vertex(
6825
- self._api_client, response_dict
6826
- )
6668
+ response_dict = _EditImageResponse_from_vertex(response_dict)
6827
6669
 
6828
6670
  return_value = types.EditImageResponse._from_response(
6829
6671
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -6884,14 +6726,14 @@ class AsyncModels(_api_module.BaseModule):
6884
6726
  request_dict = _common.convert_to_dict(request_dict)
6885
6727
  request_dict = _common.encode_unserializable_types(request_dict)
6886
6728
 
6887
- response_dict = await self._api_client.async_request(
6729
+ response = await self._api_client.async_request(
6888
6730
  'post', path, request_dict, http_options
6889
6731
  )
6890
6732
 
6733
+ response_dict = '' if not response.body else json.loads(response.body)
6734
+
6891
6735
  if self._api_client.vertexai:
6892
- response_dict = _UpscaleImageResponse_from_vertex(
6893
- self._api_client, response_dict
6894
- )
6736
+ response_dict = _UpscaleImageResponse_from_vertex(response_dict)
6895
6737
 
6896
6738
  return_value = types.UpscaleImageResponse._from_response(
6897
6739
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -6943,15 +6785,17 @@ class AsyncModels(_api_module.BaseModule):
6943
6785
  request_dict = _common.convert_to_dict(request_dict)
6944
6786
  request_dict = _common.encode_unserializable_types(request_dict)
6945
6787
 
6946
- response_dict = await self._api_client.async_request(
6788
+ response = await self._api_client.async_request(
6947
6789
  'get', path, request_dict, http_options
6948
6790
  )
6949
6791
 
6792
+ response_dict = '' if not response.body else json.loads(response.body)
6793
+
6950
6794
  if self._api_client.vertexai:
6951
- response_dict = _Model_from_vertex(self._api_client, response_dict)
6795
+ response_dict = _Model_from_vertex(response_dict)
6952
6796
 
6953
6797
  else:
6954
- response_dict = _Model_from_mldev(self._api_client, response_dict)
6798
+ response_dict = _Model_from_mldev(response_dict)
6955
6799
 
6956
6800
  return_value = types.Model._from_response(
6957
6801
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -7002,19 +6846,17 @@ class AsyncModels(_api_module.BaseModule):
7002
6846
  request_dict = _common.convert_to_dict(request_dict)
7003
6847
  request_dict = _common.encode_unserializable_types(request_dict)
7004
6848
 
7005
- response_dict = await self._api_client.async_request(
6849
+ response = await self._api_client.async_request(
7006
6850
  'get', path, request_dict, http_options
7007
6851
  )
7008
6852
 
6853
+ response_dict = '' if not response.body else json.loads(response.body)
6854
+
7009
6855
  if self._api_client.vertexai:
7010
- response_dict = _ListModelsResponse_from_vertex(
7011
- self._api_client, response_dict
7012
- )
6856
+ response_dict = _ListModelsResponse_from_vertex(response_dict)
7013
6857
 
7014
6858
  else:
7015
- response_dict = _ListModelsResponse_from_mldev(
7016
- self._api_client, response_dict
7017
- )
6859
+ response_dict = _ListModelsResponse_from_mldev(response_dict)
7018
6860
 
7019
6861
  return_value = types.ListModelsResponse._from_response(
7020
6862
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -7069,15 +6911,17 @@ class AsyncModels(_api_module.BaseModule):
7069
6911
  request_dict = _common.convert_to_dict(request_dict)
7070
6912
  request_dict = _common.encode_unserializable_types(request_dict)
7071
6913
 
7072
- response_dict = await self._api_client.async_request(
6914
+ response = await self._api_client.async_request(
7073
6915
  'patch', path, request_dict, http_options
7074
6916
  )
7075
6917
 
6918
+ response_dict = '' if not response.body else json.loads(response.body)
6919
+
7076
6920
  if self._api_client.vertexai:
7077
- response_dict = _Model_from_vertex(self._api_client, response_dict)
6921
+ response_dict = _Model_from_vertex(response_dict)
7078
6922
 
7079
6923
  else:
7080
- response_dict = _Model_from_mldev(self._api_client, response_dict)
6924
+ response_dict = _Model_from_mldev(response_dict)
7081
6925
 
7082
6926
  return_value = types.Model._from_response(
7083
6927
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -7132,19 +6976,17 @@ class AsyncModels(_api_module.BaseModule):
7132
6976
  request_dict = _common.convert_to_dict(request_dict)
7133
6977
  request_dict = _common.encode_unserializable_types(request_dict)
7134
6978
 
7135
- response_dict = await self._api_client.async_request(
6979
+ response = await self._api_client.async_request(
7136
6980
  'delete', path, request_dict, http_options
7137
6981
  )
7138
6982
 
6983
+ response_dict = '' if not response.body else json.loads(response.body)
6984
+
7139
6985
  if self._api_client.vertexai:
7140
- response_dict = _DeleteModelResponse_from_vertex(
7141
- self._api_client, response_dict
7142
- )
6986
+ response_dict = _DeleteModelResponse_from_vertex(response_dict)
7143
6987
 
7144
6988
  else:
7145
- response_dict = _DeleteModelResponse_from_mldev(
7146
- self._api_client, response_dict
7147
- )
6989
+ response_dict = _DeleteModelResponse_from_mldev(response_dict)
7148
6990
 
7149
6991
  return_value = types.DeleteModelResponse._from_response(
7150
6992
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -7222,19 +7064,17 @@ class AsyncModels(_api_module.BaseModule):
7222
7064
  request_dict = _common.convert_to_dict(request_dict)
7223
7065
  request_dict = _common.encode_unserializable_types(request_dict)
7224
7066
 
7225
- response_dict = await self._api_client.async_request(
7067
+ response = await self._api_client.async_request(
7226
7068
  'post', path, request_dict, http_options
7227
7069
  )
7228
7070
 
7071
+ response_dict = '' if not response.body else json.loads(response.body)
7072
+
7229
7073
  if self._api_client.vertexai:
7230
- response_dict = _CountTokensResponse_from_vertex(
7231
- self._api_client, response_dict
7232
- )
7074
+ response_dict = _CountTokensResponse_from_vertex(response_dict)
7233
7075
 
7234
7076
  else:
7235
- response_dict = _CountTokensResponse_from_mldev(
7236
- self._api_client, response_dict
7237
- )
7077
+ response_dict = _CountTokensResponse_from_mldev(response_dict)
7238
7078
 
7239
7079
  return_value = types.CountTokensResponse._from_response(
7240
7080
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -7306,14 +7146,14 @@ class AsyncModels(_api_module.BaseModule):
7306
7146
  request_dict = _common.convert_to_dict(request_dict)
7307
7147
  request_dict = _common.encode_unserializable_types(request_dict)
7308
7148
 
7309
- response_dict = await self._api_client.async_request(
7149
+ response = await self._api_client.async_request(
7310
7150
  'post', path, request_dict, http_options
7311
7151
  )
7312
7152
 
7153
+ response_dict = '' if not response.body else json.loads(response.body)
7154
+
7313
7155
  if self._api_client.vertexai:
7314
- response_dict = _ComputeTokensResponse_from_vertex(
7315
- self._api_client, response_dict
7316
- )
7156
+ response_dict = _ComputeTokensResponse_from_vertex(response_dict)
7317
7157
 
7318
7158
  return_value = types.ComputeTokensResponse._from_response(
7319
7159
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -7327,13 +7167,26 @@ class AsyncModels(_api_module.BaseModule):
7327
7167
  model: str,
7328
7168
  prompt: Optional[str] = None,
7329
7169
  image: Optional[types.ImageOrDict] = None,
7170
+ video: Optional[types.VideoOrDict] = None,
7330
7171
  config: Optional[types.GenerateVideosConfigOrDict] = None,
7331
7172
  ) -> types.GenerateVideosOperation:
7332
- """Generates videos based on a text description and configuration.
7173
+ """Generates videos based on an input (text, image, or video) and configuration.
7174
+
7175
+ The following use cases are supported:
7176
+ 1. Text to video generation.
7177
+ 2a. Image to video generation (additional text prompt is optional).
7178
+ 2b. Image to video generation with frame interpolation (specify last_frame
7179
+ in config).
7180
+ 3. Video extension (additional text prompt is optional)
7333
7181
 
7334
7182
  Args:
7335
7183
  model: The model to use.
7336
- instances: A list of prompts, images and videos to generate videos from.
7184
+ prompt: The text prompt for generating the videos. Optional for image to
7185
+ video use cases.
7186
+ image: The input image for generating the videos. Optional if prompt is
7187
+ provided.
7188
+ video: The input video for video extension use cases. Optional if prompt
7189
+ or image is provided.
7337
7190
  config: Configuration for generation.
7338
7191
 
7339
7192
  Usage:
@@ -7355,6 +7208,7 @@ class AsyncModels(_api_module.BaseModule):
7355
7208
  model=model,
7356
7209
  prompt=prompt,
7357
7210
  image=image,
7211
+ video=video,
7358
7212
  config=config,
7359
7213
  )
7360
7214
 
@@ -7394,19 +7248,17 @@ class AsyncModels(_api_module.BaseModule):
7394
7248
  request_dict = _common.convert_to_dict(request_dict)
7395
7249
  request_dict = _common.encode_unserializable_types(request_dict)
7396
7250
 
7397
- response_dict = await self._api_client.async_request(
7251
+ response = await self._api_client.async_request(
7398
7252
  'post', path, request_dict, http_options
7399
7253
  )
7400
7254
 
7255
+ response_dict = '' if not response.body else json.loads(response.body)
7256
+
7401
7257
  if self._api_client.vertexai:
7402
- response_dict = _GenerateVideosOperation_from_vertex(
7403
- self._api_client, response_dict
7404
- )
7258
+ response_dict = _GenerateVideosOperation_from_vertex(response_dict)
7405
7259
 
7406
7260
  else:
7407
- response_dict = _GenerateVideosOperation_from_mldev(
7408
- self._api_client, response_dict
7409
- )
7261
+ response_dict = _GenerateVideosOperation_from_mldev(response_dict)
7410
7262
 
7411
7263
  return_value = types.GenerateVideosOperation._from_response(
7412
7264
  response=response_dict, kwargs=parameter_model.model_dump()
@@ -7501,7 +7353,7 @@ class AsyncModels(_api_module.BaseModule):
7501
7353
  role='user',
7502
7354
  parts=func_response_parts,
7503
7355
  )
7504
- contents = t.t_contents(self._api_client, contents) # type: ignore[assignment]
7356
+ contents = t.t_contents(contents) # type: ignore[assignment]
7505
7357
  if not automatic_function_calling_history:
7506
7358
  automatic_function_calling_history.extend(contents) # type: ignore[arg-type]
7507
7359
  if isinstance(contents, list):
@@ -7663,8 +7515,10 @@ class AsyncModels(_api_module.BaseModule):
7663
7515
  or not chunk.candidates[0].content.parts
7664
7516
  ):
7665
7517
  break
7666
- func_response_parts = _extra_utils.get_function_response_parts(
7667
- chunk, function_map
7518
+ func_response_parts = (
7519
+ await _extra_utils.get_function_response_parts_async(
7520
+ chunk, function_map
7521
+ )
7668
7522
  )
7669
7523
  if not function_map:
7670
7524
  break
@@ -7680,7 +7534,7 @@ class AsyncModels(_api_module.BaseModule):
7680
7534
  role='user',
7681
7535
  parts=func_response_parts,
7682
7536
  )
7683
- contents = t.t_contents(self._api_client, contents)
7537
+ contents = t.t_contents(contents)
7684
7538
  if not automatic_function_calling_history:
7685
7539
  automatic_function_calling_history.extend(contents)
7686
7540
  if isinstance(contents, list) and func_call_content is not None: