google-genai 1.13.0__py3-none-any.whl → 1.15.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/caches.py CHANGED
@@ -30,6 +30,24 @@ from .pagers import AsyncPager, Pager
30
30
  logger = logging.getLogger('google_genai.caches')
31
31
 
32
32
 
33
+ def _Blob_to_mldev(
34
+ api_client: BaseApiClient,
35
+ from_object: Union[dict[str, Any], object],
36
+ parent_object: Optional[dict[str, Any]] = None,
37
+ ) -> dict[str, Any]:
38
+ to_object: dict[str, Any] = {}
39
+ if getv(from_object, ['display_name']) is not None:
40
+ raise ValueError('display_name parameter is not supported in Gemini API.')
41
+
42
+ if getv(from_object, ['data']) is not None:
43
+ setv(to_object, ['data'], getv(from_object, ['data']))
44
+
45
+ if getv(from_object, ['mime_type']) is not None:
46
+ setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
47
+
48
+ return to_object
49
+
50
+
33
51
  def _Part_to_mldev(
34
52
  api_client: BaseApiClient,
35
53
  from_object: Union[dict[str, Any], object],
@@ -42,6 +60,15 @@ def _Part_to_mldev(
42
60
  if getv(from_object, ['thought']) is not None:
43
61
  setv(to_object, ['thought'], getv(from_object, ['thought']))
44
62
 
63
+ if getv(from_object, ['inline_data']) is not None:
64
+ setv(
65
+ to_object,
66
+ ['inlineData'],
67
+ _Blob_to_mldev(
68
+ api_client, getv(from_object, ['inline_data']), to_object
69
+ ),
70
+ )
71
+
45
72
  if getv(from_object, ['code_execution_result']) is not None:
46
73
  setv(
47
74
  to_object,
@@ -65,9 +92,6 @@ def _Part_to_mldev(
65
92
  getv(from_object, ['function_response']),
66
93
  )
67
94
 
68
- if getv(from_object, ['inline_data']) is not None:
69
- setv(to_object, ['inlineData'], getv(from_object, ['inline_data']))
70
-
71
95
  if getv(from_object, ['text']) is not None:
72
96
  setv(to_object, ['text'], getv(from_object, ['text']))
73
97
 
@@ -145,6 +169,75 @@ def _GoogleSearchRetrieval_to_mldev(
145
169
  return to_object
146
170
 
147
171
 
172
+ def _EnterpriseWebSearch_to_mldev(
173
+ api_client: BaseApiClient,
174
+ from_object: Union[dict[str, Any], object],
175
+ parent_object: Optional[dict[str, Any]] = None,
176
+ ) -> dict[str, Any]:
177
+ to_object: dict[str, Any] = {}
178
+
179
+ return to_object
180
+
181
+
182
+ def _ApiKeyConfig_to_mldev(
183
+ api_client: BaseApiClient,
184
+ from_object: Union[dict[str, Any], object],
185
+ parent_object: Optional[dict[str, Any]] = None,
186
+ ) -> dict[str, Any]:
187
+ to_object: dict[str, Any] = {}
188
+ if getv(from_object, ['api_key_string']) is not None:
189
+ raise ValueError('api_key_string parameter is not supported in Gemini API.')
190
+
191
+ return to_object
192
+
193
+
194
+ def _AuthConfig_to_mldev(
195
+ api_client: BaseApiClient,
196
+ from_object: Union[dict[str, Any], object],
197
+ parent_object: Optional[dict[str, Any]] = None,
198
+ ) -> dict[str, Any]:
199
+ to_object: dict[str, Any] = {}
200
+ if getv(from_object, ['api_key_config']) is not None:
201
+ raise ValueError('api_key_config parameter is not supported in Gemini API.')
202
+
203
+ if getv(from_object, ['auth_type']) is not None:
204
+ setv(to_object, ['authType'], getv(from_object, ['auth_type']))
205
+
206
+ if getv(from_object, ['google_service_account_config']) is not None:
207
+ setv(
208
+ to_object,
209
+ ['googleServiceAccountConfig'],
210
+ getv(from_object, ['google_service_account_config']),
211
+ )
212
+
213
+ if getv(from_object, ['http_basic_auth_config']) is not None:
214
+ setv(
215
+ to_object,
216
+ ['httpBasicAuthConfig'],
217
+ getv(from_object, ['http_basic_auth_config']),
218
+ )
219
+
220
+ if getv(from_object, ['oauth_config']) is not None:
221
+ setv(to_object, ['oauthConfig'], getv(from_object, ['oauth_config']))
222
+
223
+ if getv(from_object, ['oidc_config']) is not None:
224
+ setv(to_object, ['oidcConfig'], getv(from_object, ['oidc_config']))
225
+
226
+ return to_object
227
+
228
+
229
+ def _GoogleMaps_to_mldev(
230
+ api_client: BaseApiClient,
231
+ from_object: Union[dict[str, Any], object],
232
+ parent_object: Optional[dict[str, Any]] = None,
233
+ ) -> dict[str, Any]:
234
+ to_object: dict[str, Any] = {}
235
+ if getv(from_object, ['auth_config']) is not None:
236
+ raise ValueError('auth_config parameter is not supported in Gemini API.')
237
+
238
+ return to_object
239
+
240
+
148
241
  def _Tool_to_mldev(
149
242
  api_client: BaseApiClient,
150
243
  from_object: Union[dict[str, Any], object],
@@ -174,6 +267,14 @@ def _Tool_to_mldev(
174
267
  ),
175
268
  )
176
269
 
270
+ if getv(from_object, ['enterprise_web_search']) is not None:
271
+ raise ValueError(
272
+ 'enterprise_web_search parameter is not supported in Gemini API.'
273
+ )
274
+
275
+ if getv(from_object, ['google_maps']) is not None:
276
+ raise ValueError('google_maps parameter is not supported in Gemini API.')
277
+
177
278
  if getv(from_object, ['code_execution']) is not None:
178
279
  setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
179
280
 
@@ -206,6 +307,33 @@ def _FunctionCallingConfig_to_mldev(
206
307
  return to_object
207
308
 
208
309
 
310
+ def _LatLng_to_mldev(
311
+ api_client: BaseApiClient,
312
+ from_object: Union[dict[str, Any], object],
313
+ parent_object: Optional[dict[str, Any]] = None,
314
+ ) -> dict[str, Any]:
315
+ to_object: dict[str, Any] = {}
316
+ if getv(from_object, ['latitude']) is not None:
317
+ raise ValueError('latitude parameter is not supported in Gemini API.')
318
+
319
+ if getv(from_object, ['longitude']) is not None:
320
+ raise ValueError('longitude parameter is not supported in Gemini API.')
321
+
322
+ return to_object
323
+
324
+
325
+ def _RetrievalConfig_to_mldev(
326
+ api_client: BaseApiClient,
327
+ from_object: Union[dict[str, Any], object],
328
+ parent_object: Optional[dict[str, Any]] = None,
329
+ ) -> dict[str, Any]:
330
+ to_object: dict[str, Any] = {}
331
+ if getv(from_object, ['lat_lng']) is not None:
332
+ raise ValueError('lat_lng parameter is not supported in Gemini API.')
333
+
334
+ return to_object
335
+
336
+
209
337
  def _ToolConfig_to_mldev(
210
338
  api_client: BaseApiClient,
211
339
  from_object: Union[dict[str, Any], object],
@@ -223,6 +351,11 @@ def _ToolConfig_to_mldev(
223
351
  ),
224
352
  )
225
353
 
354
+ if getv(from_object, ['retrieval_config']) is not None:
355
+ raise ValueError(
356
+ 'retrieval_config parameter is not supported in Gemini API.'
357
+ )
358
+
226
359
  return to_object
227
360
 
228
361
 
@@ -431,6 +564,24 @@ def _ListCachedContentsParameters_to_mldev(
431
564
  return to_object
432
565
 
433
566
 
567
+ def _Blob_to_vertex(
568
+ api_client: BaseApiClient,
569
+ from_object: Union[dict[str, Any], object],
570
+ parent_object: Optional[dict[str, Any]] = None,
571
+ ) -> dict[str, Any]:
572
+ to_object: dict[str, Any] = {}
573
+ if getv(from_object, ['display_name']) is not None:
574
+ setv(to_object, ['displayName'], getv(from_object, ['display_name']))
575
+
576
+ if getv(from_object, ['data']) is not None:
577
+ setv(to_object, ['data'], getv(from_object, ['data']))
578
+
579
+ if getv(from_object, ['mime_type']) is not None:
580
+ setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
581
+
582
+ return to_object
583
+
584
+
434
585
  def _Part_to_vertex(
435
586
  api_client: BaseApiClient,
436
587
  from_object: Union[dict[str, Any], object],
@@ -443,6 +594,15 @@ def _Part_to_vertex(
443
594
  if getv(from_object, ['thought']) is not None:
444
595
  setv(to_object, ['thought'], getv(from_object, ['thought']))
445
596
 
597
+ if getv(from_object, ['inline_data']) is not None:
598
+ setv(
599
+ to_object,
600
+ ['inlineData'],
601
+ _Blob_to_vertex(
602
+ api_client, getv(from_object, ['inline_data']), to_object
603
+ ),
604
+ )
605
+
446
606
  if getv(from_object, ['code_execution_result']) is not None:
447
607
  setv(
448
608
  to_object,
@@ -466,9 +626,6 @@ def _Part_to_vertex(
466
626
  getv(from_object, ['function_response']),
467
627
  )
468
628
 
469
- if getv(from_object, ['inline_data']) is not None:
470
- setv(to_object, ['inlineData'], getv(from_object, ['inline_data']))
471
-
472
629
  if getv(from_object, ['text']) is not None:
473
630
  setv(to_object, ['text'], getv(from_object, ['text']))
474
631
 
@@ -546,6 +703,87 @@ def _GoogleSearchRetrieval_to_vertex(
546
703
  return to_object
547
704
 
548
705
 
706
+ def _EnterpriseWebSearch_to_vertex(
707
+ api_client: BaseApiClient,
708
+ from_object: Union[dict[str, Any], object],
709
+ parent_object: Optional[dict[str, Any]] = None,
710
+ ) -> dict[str, Any]:
711
+ to_object: dict[str, Any] = {}
712
+
713
+ return to_object
714
+
715
+
716
+ def _ApiKeyConfig_to_vertex(
717
+ api_client: BaseApiClient,
718
+ from_object: Union[dict[str, Any], object],
719
+ parent_object: Optional[dict[str, Any]] = None,
720
+ ) -> dict[str, Any]:
721
+ to_object: dict[str, Any] = {}
722
+ if getv(from_object, ['api_key_string']) is not None:
723
+ setv(to_object, ['apiKeyString'], getv(from_object, ['api_key_string']))
724
+
725
+ return to_object
726
+
727
+
728
+ def _AuthConfig_to_vertex(
729
+ api_client: BaseApiClient,
730
+ from_object: Union[dict[str, Any], object],
731
+ parent_object: Optional[dict[str, Any]] = None,
732
+ ) -> dict[str, Any]:
733
+ to_object: dict[str, Any] = {}
734
+ if getv(from_object, ['api_key_config']) is not None:
735
+ setv(
736
+ to_object,
737
+ ['apiKeyConfig'],
738
+ _ApiKeyConfig_to_vertex(
739
+ api_client, getv(from_object, ['api_key_config']), to_object
740
+ ),
741
+ )
742
+
743
+ if getv(from_object, ['auth_type']) is not None:
744
+ setv(to_object, ['authType'], getv(from_object, ['auth_type']))
745
+
746
+ if getv(from_object, ['google_service_account_config']) is not None:
747
+ setv(
748
+ to_object,
749
+ ['googleServiceAccountConfig'],
750
+ getv(from_object, ['google_service_account_config']),
751
+ )
752
+
753
+ if getv(from_object, ['http_basic_auth_config']) is not None:
754
+ setv(
755
+ to_object,
756
+ ['httpBasicAuthConfig'],
757
+ getv(from_object, ['http_basic_auth_config']),
758
+ )
759
+
760
+ if getv(from_object, ['oauth_config']) is not None:
761
+ setv(to_object, ['oauthConfig'], getv(from_object, ['oauth_config']))
762
+
763
+ if getv(from_object, ['oidc_config']) is not None:
764
+ setv(to_object, ['oidcConfig'], getv(from_object, ['oidc_config']))
765
+
766
+ return to_object
767
+
768
+
769
+ def _GoogleMaps_to_vertex(
770
+ api_client: BaseApiClient,
771
+ from_object: Union[dict[str, Any], object],
772
+ parent_object: Optional[dict[str, Any]] = None,
773
+ ) -> dict[str, Any]:
774
+ to_object: dict[str, Any] = {}
775
+ if getv(from_object, ['auth_config']) is not None:
776
+ setv(
777
+ to_object,
778
+ ['authConfig'],
779
+ _AuthConfig_to_vertex(
780
+ api_client, getv(from_object, ['auth_config']), to_object
781
+ ),
782
+ )
783
+
784
+ return to_object
785
+
786
+
549
787
  def _Tool_to_vertex(
550
788
  api_client: BaseApiClient,
551
789
  from_object: Union[dict[str, Any], object],
@@ -575,6 +813,24 @@ def _Tool_to_vertex(
575
813
  ),
576
814
  )
577
815
 
816
+ if getv(from_object, ['enterprise_web_search']) is not None:
817
+ setv(
818
+ to_object,
819
+ ['enterpriseWebSearch'],
820
+ _EnterpriseWebSearch_to_vertex(
821
+ api_client, getv(from_object, ['enterprise_web_search']), to_object
822
+ ),
823
+ )
824
+
825
+ if getv(from_object, ['google_maps']) is not None:
826
+ setv(
827
+ to_object,
828
+ ['googleMaps'],
829
+ _GoogleMaps_to_vertex(
830
+ api_client, getv(from_object, ['google_maps']), to_object
831
+ ),
832
+ )
833
+
578
834
  if getv(from_object, ['code_execution']) is not None:
579
835
  setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
580
836
 
@@ -607,6 +863,39 @@ def _FunctionCallingConfig_to_vertex(
607
863
  return to_object
608
864
 
609
865
 
866
+ def _LatLng_to_vertex(
867
+ api_client: BaseApiClient,
868
+ from_object: Union[dict[str, Any], object],
869
+ parent_object: Optional[dict[str, Any]] = None,
870
+ ) -> dict[str, Any]:
871
+ to_object: dict[str, Any] = {}
872
+ if getv(from_object, ['latitude']) is not None:
873
+ setv(to_object, ['latitude'], getv(from_object, ['latitude']))
874
+
875
+ if getv(from_object, ['longitude']) is not None:
876
+ setv(to_object, ['longitude'], getv(from_object, ['longitude']))
877
+
878
+ return to_object
879
+
880
+
881
+ def _RetrievalConfig_to_vertex(
882
+ api_client: BaseApiClient,
883
+ from_object: Union[dict[str, Any], object],
884
+ parent_object: Optional[dict[str, Any]] = None,
885
+ ) -> dict[str, Any]:
886
+ to_object: dict[str, Any] = {}
887
+ if getv(from_object, ['lat_lng']) is not None:
888
+ setv(
889
+ to_object,
890
+ ['latLng'],
891
+ _LatLng_to_vertex(
892
+ api_client, getv(from_object, ['lat_lng']), to_object
893
+ ),
894
+ )
895
+
896
+ return to_object
897
+
898
+
610
899
  def _ToolConfig_to_vertex(
611
900
  api_client: BaseApiClient,
612
901
  from_object: Union[dict[str, Any], object],
@@ -624,6 +913,15 @@ def _ToolConfig_to_vertex(
624
913
  ),
625
914
  )
626
915
 
916
+ if getv(from_object, ['retrieval_config']) is not None:
917
+ setv(
918
+ to_object,
919
+ ['retrievalConfig'],
920
+ _RetrievalConfig_to_vertex(
921
+ api_client, getv(from_object, ['retrieval_config']), to_object
922
+ ),
923
+ )
924
+
627
925
  return to_object
628
926
 
629
927