google-genai 1.46.0__py3-none-any.whl → 1.47.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
@@ -59,12 +59,12 @@ def _Blob_to_mldev(
59
59
  parent_object: Optional[dict[str, Any]] = None,
60
60
  ) -> dict[str, Any]:
61
61
  to_object: dict[str, Any] = {}
62
- if getv(from_object, ['display_name']) is not None:
63
- raise ValueError('display_name parameter is not supported in Gemini API.')
64
-
65
62
  if getv(from_object, ['data']) is not None:
66
63
  setv(to_object, ['data'], getv(from_object, ['data']))
67
64
 
65
+ if getv(from_object, ['display_name']) is not None:
66
+ raise ValueError('display_name parameter is not supported in Gemini API.')
67
+
68
68
  if getv(from_object, ['mime_type']) is not None:
69
69
  setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
70
70
 
@@ -94,13 +94,6 @@ def _Candidate_from_mldev(
94
94
  if getv(from_object, ['finishReason']) is not None:
95
95
  setv(to_object, ['finish_reason'], getv(from_object, ['finishReason']))
96
96
 
97
- if getv(from_object, ['urlContextMetadata']) is not None:
98
- setv(
99
- to_object,
100
- ['url_context_metadata'],
101
- getv(from_object, ['urlContextMetadata']),
102
- )
103
-
104
97
  if getv(from_object, ['avgLogprobs']) is not None:
105
98
  setv(to_object, ['avg_logprobs'], getv(from_object, ['avgLogprobs']))
106
99
 
@@ -124,6 +117,13 @@ def _Candidate_from_mldev(
124
117
  [item for item in getv(from_object, ['safetyRatings'])],
125
118
  )
126
119
 
120
+ if getv(from_object, ['urlContextMetadata']) is not None:
121
+ setv(
122
+ to_object,
123
+ ['url_context_metadata'],
124
+ getv(from_object, ['urlContextMetadata']),
125
+ )
126
+
127
127
  return to_object
128
128
 
129
129
 
@@ -2457,16 +2457,16 @@ def _GoogleSearch_to_mldev(
2457
2457
  parent_object: Optional[dict[str, Any]] = None,
2458
2458
  ) -> dict[str, Any]:
2459
2459
  to_object: dict[str, Any] = {}
2460
- if getv(from_object, ['time_range_filter']) is not None:
2461
- setv(
2462
- to_object, ['timeRangeFilter'], getv(from_object, ['time_range_filter'])
2463
- )
2464
-
2465
2460
  if getv(from_object, ['exclude_domains']) is not None:
2466
2461
  raise ValueError(
2467
2462
  'exclude_domains parameter is not supported in Gemini API.'
2468
2463
  )
2469
2464
 
2465
+ if getv(from_object, ['time_range_filter']) is not None:
2466
+ setv(
2467
+ to_object, ['timeRangeFilter'], getv(from_object, ['time_range_filter'])
2468
+ )
2469
+
2470
2470
  return to_object
2471
2471
 
2472
2472
 
@@ -2816,19 +2816,19 @@ def _Part_to_mldev(
2816
2816
  parent_object: Optional[dict[str, Any]] = None,
2817
2817
  ) -> dict[str, Any]:
2818
2818
  to_object: dict[str, Any] = {}
2819
- if getv(from_object, ['video_metadata']) is not None:
2820
- setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
2821
-
2822
- if getv(from_object, ['thought']) is not None:
2823
- setv(to_object, ['thought'], getv(from_object, ['thought']))
2819
+ if getv(from_object, ['function_call']) is not None:
2820
+ setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
2824
2821
 
2825
- if getv(from_object, ['inline_data']) is not None:
2822
+ if getv(from_object, ['code_execution_result']) is not None:
2826
2823
  setv(
2827
2824
  to_object,
2828
- ['inlineData'],
2829
- _Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
2825
+ ['codeExecutionResult'],
2826
+ getv(from_object, ['code_execution_result']),
2830
2827
  )
2831
2828
 
2829
+ if getv(from_object, ['executable_code']) is not None:
2830
+ setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
2831
+
2832
2832
  if getv(from_object, ['file_data']) is not None:
2833
2833
  setv(
2834
2834
  to_object,
@@ -2836,35 +2836,35 @@ def _Part_to_mldev(
2836
2836
  _FileData_to_mldev(getv(from_object, ['file_data']), to_object),
2837
2837
  )
2838
2838
 
2839
- if getv(from_object, ['thought_signature']) is not None:
2839
+ if getv(from_object, ['function_response']) is not None:
2840
2840
  setv(
2841
2841
  to_object,
2842
- ['thoughtSignature'],
2843
- getv(from_object, ['thought_signature']),
2842
+ ['functionResponse'],
2843
+ getv(from_object, ['function_response']),
2844
2844
  )
2845
2845
 
2846
- if getv(from_object, ['function_call']) is not None:
2847
- setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
2848
-
2849
- if getv(from_object, ['code_execution_result']) is not None:
2846
+ if getv(from_object, ['inline_data']) is not None:
2850
2847
  setv(
2851
2848
  to_object,
2852
- ['codeExecutionResult'],
2853
- getv(from_object, ['code_execution_result']),
2849
+ ['inlineData'],
2850
+ _Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
2854
2851
  )
2855
2852
 
2856
- if getv(from_object, ['executable_code']) is not None:
2857
- setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
2853
+ if getv(from_object, ['text']) is not None:
2854
+ setv(to_object, ['text'], getv(from_object, ['text']))
2858
2855
 
2859
- if getv(from_object, ['function_response']) is not None:
2856
+ if getv(from_object, ['thought']) is not None:
2857
+ setv(to_object, ['thought'], getv(from_object, ['thought']))
2858
+
2859
+ if getv(from_object, ['thought_signature']) is not None:
2860
2860
  setv(
2861
2861
  to_object,
2862
- ['functionResponse'],
2863
- getv(from_object, ['function_response']),
2862
+ ['thoughtSignature'],
2863
+ getv(from_object, ['thought_signature']),
2864
2864
  )
2865
2865
 
2866
- if getv(from_object, ['text']) is not None:
2867
- setv(to_object, ['text'], getv(from_object, ['text']))
2866
+ if getv(from_object, ['video_metadata']) is not None:
2867
+ setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
2868
2868
 
2869
2869
  return to_object
2870
2870
 
@@ -3136,12 +3136,12 @@ def _SafetySetting_to_mldev(
3136
3136
  parent_object: Optional[dict[str, Any]] = None,
3137
3137
  ) -> dict[str, Any]:
3138
3138
  to_object: dict[str, Any] = {}
3139
- if getv(from_object, ['method']) is not None:
3140
- raise ValueError('method parameter is not supported in Gemini API.')
3141
-
3142
3139
  if getv(from_object, ['category']) is not None:
3143
3140
  setv(to_object, ['category'], getv(from_object, ['category']))
3144
3141
 
3142
+ if getv(from_object, ['method']) is not None:
3143
+ raise ValueError('method parameter is not supported in Gemini API.')
3144
+
3145
3145
  if getv(from_object, ['threshold']) is not None:
3146
3146
  setv(to_object, ['threshold'], getv(from_object, ['threshold']))
3147
3147
 
@@ -3280,6 +3280,9 @@ def _SpeechConfig_to_vertex(
3280
3280
  parent_object: Optional[dict[str, Any]] = None,
3281
3281
  ) -> dict[str, Any]:
3282
3282
  to_object: dict[str, Any] = {}
3283
+ if getv(from_object, ['language_code']) is not None:
3284
+ setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
3285
+
3283
3286
  if getv(from_object, ['voice_config']) is not None:
3284
3287
  setv(to_object, ['voiceConfig'], getv(from_object, ['voice_config']))
3285
3288
 
@@ -3288,9 +3291,6 @@ def _SpeechConfig_to_vertex(
3288
3291
  'multi_speaker_voice_config parameter is not supported in Vertex AI.'
3289
3292
  )
3290
3293
 
3291
- if getv(from_object, ['language_code']) is not None:
3292
- setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
3293
-
3294
3294
  return to_object
3295
3295
 
3296
3296
 
@@ -3309,13 +3309,6 @@ def _Tool_to_mldev(
3309
3309
  if getv(from_object, ['retrieval']) is not None:
3310
3310
  raise ValueError('retrieval parameter is not supported in Gemini API.')
3311
3311
 
3312
- if getv(from_object, ['google_search']) is not None:
3313
- setv(
3314
- to_object,
3315
- ['googleSearch'],
3316
- _GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
3317
- )
3318
-
3319
3312
  if getv(from_object, ['google_search_retrieval']) is not None:
3320
3313
  setv(
3321
3314
  to_object,
@@ -3323,11 +3316,6 @@ def _Tool_to_mldev(
3323
3316
  getv(from_object, ['google_search_retrieval']),
3324
3317
  )
3325
3318
 
3326
- if getv(from_object, ['enterprise_web_search']) is not None:
3327
- raise ValueError(
3328
- 'enterprise_web_search parameter is not supported in Gemini API.'
3329
- )
3330
-
3331
3319
  if getv(from_object, ['google_maps']) is not None:
3332
3320
  setv(
3333
3321
  to_object,
@@ -3335,15 +3323,27 @@ def _Tool_to_mldev(
3335
3323
  _GoogleMaps_to_mldev(getv(from_object, ['google_maps']), to_object),
3336
3324
  )
3337
3325
 
3338
- if getv(from_object, ['url_context']) is not None:
3339
- setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
3340
-
3341
3326
  if getv(from_object, ['computer_use']) is not None:
3342
3327
  setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
3343
3328
 
3344
3329
  if getv(from_object, ['code_execution']) is not None:
3345
3330
  setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
3346
3331
 
3332
+ if getv(from_object, ['enterprise_web_search']) is not None:
3333
+ raise ValueError(
3334
+ 'enterprise_web_search parameter is not supported in Gemini API.'
3335
+ )
3336
+
3337
+ if getv(from_object, ['google_search']) is not None:
3338
+ setv(
3339
+ to_object,
3340
+ ['googleSearch'],
3341
+ _GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
3342
+ )
3343
+
3344
+ if getv(from_object, ['url_context']) is not None:
3345
+ setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
3346
+
3347
3347
  return to_object
3348
3348
 
3349
3349
 
@@ -3365,9 +3365,6 @@ def _Tool_to_vertex(
3365
3365
  if getv(from_object, ['retrieval']) is not None:
3366
3366
  setv(to_object, ['retrieval'], getv(from_object, ['retrieval']))
3367
3367
 
3368
- if getv(from_object, ['google_search']) is not None:
3369
- setv(to_object, ['googleSearch'], getv(from_object, ['google_search']))
3370
-
3371
3368
  if getv(from_object, ['google_search_retrieval']) is not None:
3372
3369
  setv(
3373
3370
  to_object,
@@ -3375,6 +3372,15 @@ def _Tool_to_vertex(
3375
3372
  getv(from_object, ['google_search_retrieval']),
3376
3373
  )
3377
3374
 
3375
+ if getv(from_object, ['google_maps']) is not None:
3376
+ setv(to_object, ['googleMaps'], getv(from_object, ['google_maps']))
3377
+
3378
+ if getv(from_object, ['computer_use']) is not None:
3379
+ setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
3380
+
3381
+ if getv(from_object, ['code_execution']) is not None:
3382
+ setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
3383
+
3378
3384
  if getv(from_object, ['enterprise_web_search']) is not None:
3379
3385
  setv(
3380
3386
  to_object,
@@ -3382,18 +3388,12 @@ def _Tool_to_vertex(
3382
3388
  getv(from_object, ['enterprise_web_search']),
3383
3389
  )
3384
3390
 
3385
- if getv(from_object, ['google_maps']) is not None:
3386
- setv(to_object, ['googleMaps'], getv(from_object, ['google_maps']))
3391
+ if getv(from_object, ['google_search']) is not None:
3392
+ setv(to_object, ['googleSearch'], getv(from_object, ['google_search']))
3387
3393
 
3388
3394
  if getv(from_object, ['url_context']) is not None:
3389
3395
  setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
3390
3396
 
3391
- if getv(from_object, ['computer_use']) is not None:
3392
- setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
3393
-
3394
- if getv(from_object, ['code_execution']) is not None:
3395
- setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
3396
-
3397
3397
  return to_object
3398
3398
 
3399
3399
 
@@ -3516,6 +3516,20 @@ def _UpscaleImageAPIConfig_to_vertex(
3516
3516
  getv(from_object, ['output_gcs_uri']),
3517
3517
  )
3518
3518
 
3519
+ if getv(from_object, ['safety_filter_level']) is not None:
3520
+ setv(
3521
+ parent_object,
3522
+ ['parameters', 'safetySetting'],
3523
+ getv(from_object, ['safety_filter_level']),
3524
+ )
3525
+
3526
+ if getv(from_object, ['person_generation']) is not None:
3527
+ setv(
3528
+ parent_object,
3529
+ ['parameters', 'personGeneration'],
3530
+ getv(from_object, ['person_generation']),
3531
+ )
3532
+
3519
3533
  if getv(from_object, ['include_rai_reason']) is not None:
3520
3534
  setv(
3521
3535
  parent_object,
@@ -5376,6 +5390,8 @@ class Models(_api_module.BaseModule):
5376
5390
  api_config = types._UpscaleImageAPIConfigDict(
5377
5391
  http_options=config_dct.get('http_options', None),
5378
5392
  output_gcs_uri=config_dct.get('output_gcs_uri', None),
5393
+ safety_filter_level=config_dct.get('safety_filter_level', None),
5394
+ person_generation=config_dct.get('person_generation', None),
5379
5395
  include_rai_reason=config_dct.get('include_rai_reason', None),
5380
5396
  output_mime_type=config_dct.get('output_mime_type', None),
5381
5397
  output_compression_quality=config_dct.get(
@@ -7200,6 +7216,8 @@ class AsyncModels(_api_module.BaseModule):
7200
7216
  api_config = types._UpscaleImageAPIConfigDict(
7201
7217
  http_options=config_dct.get('http_options', None),
7202
7218
  output_gcs_uri=config_dct.get('output_gcs_uri', None),
7219
+ safety_filter_level=config_dct.get('safety_filter_level', None),
7220
+ person_generation=config_dct.get('person_generation', None),
7203
7221
  include_rai_reason=config_dct.get('include_rai_reason', None),
7204
7222
  output_mime_type=config_dct.get('output_mime_type', None),
7205
7223
  output_compression_quality=config_dct.get(