Skip to content

Commit 1beac80

Browse files
jscudcopybara-github
authored andcommitted
chore: update error messages to clarify which APIs support a feature.
PiperOrigin-RevId: 914394015
1 parent b2ace07 commit 1beac80

53 files changed

Lines changed: 841 additions & 452 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

google/genai/_live_converters.py

Lines changed: 100 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ def _AudioTranscriptionConfig_to_mldev(
2929
) -> dict[str, Any]:
3030
to_object: dict[str, Any] = {}
3131
if getv(from_object, ['language_codes']) is not None:
32-
raise ValueError('language_codes parameter is not supported in Gemini API.')
32+
raise ValueError(
33+
'language_codes parameter is only supported in Gemini Enterprise Agent'
34+
' Platform mode, not in Gemini Developer API mode.'
35+
)
3336

3437
return to_object
3538

@@ -43,27 +46,40 @@ def _AuthConfig_to_mldev(
4346
setv(to_object, ['apiKey'], getv(from_object, ['api_key']))
4447

4548
if getv(from_object, ['api_key_config']) is not None:
46-
raise ValueError('api_key_config parameter is not supported in Gemini API.')
49+
raise ValueError(
50+
'api_key_config parameter is only supported in Gemini Enterprise Agent'
51+
' Platform mode, not in Gemini Developer API mode.'
52+
)
4753

4854
if getv(from_object, ['auth_type']) is not None:
49-
raise ValueError('auth_type parameter is not supported in Gemini API.')
55+
raise ValueError(
56+
'auth_type parameter is only supported in Gemini Enterprise Agent'
57+
' Platform mode, not in Gemini Developer API mode.'
58+
)
5059

5160
if getv(from_object, ['google_service_account_config']) is not None:
5261
raise ValueError(
53-
'google_service_account_config parameter is not supported in Gemini'
54-
' API.'
62+
'google_service_account_config parameter is only supported in Gemini'
63+
' Enterprise Agent Platform mode, not in Gemini Developer API mode.'
5564
)
5665

5766
if getv(from_object, ['http_basic_auth_config']) is not None:
5867
raise ValueError(
59-
'http_basic_auth_config parameter is not supported in Gemini API.'
68+
'http_basic_auth_config parameter is only supported in Gemini'
69+
' Enterprise Agent Platform mode, not in Gemini Developer API mode.'
6070
)
6171

6272
if getv(from_object, ['oauth_config']) is not None:
63-
raise ValueError('oauth_config parameter is not supported in Gemini API.')
73+
raise ValueError(
74+
'oauth_config parameter is only supported in Gemini Enterprise Agent'
75+
' Platform mode, not in Gemini Developer API mode.'
76+
)
6477

6578
if getv(from_object, ['oidc_config']) is not None:
66-
raise ValueError('oidc_config parameter is not supported in Gemini API.')
79+
raise ValueError(
80+
'oidc_config parameter is only supported in Gemini Enterprise Agent'
81+
' Platform mode, not in Gemini Developer API mode.'
82+
)
6783

6884
return to_object
6985

@@ -77,7 +93,10 @@ def _Blob_to_mldev(
7793
setv(to_object, ['data'], getv(from_object, ['data']))
7894

7995
if getv(from_object, ['display_name']) is not None:
80-
raise ValueError('display_name parameter is not supported in Gemini API.')
96+
raise ValueError(
97+
'display_name parameter is only supported in Gemini Enterprise Agent'
98+
' Platform mode, not in Gemini Developer API mode.'
99+
)
81100

82101
if getv(from_object, ['mime_type']) is not None:
83102
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
@@ -133,7 +152,10 @@ def _FileData_to_mldev(
133152
) -> dict[str, Any]:
134153
to_object: dict[str, Any] = {}
135154
if getv(from_object, ['display_name']) is not None:
136-
raise ValueError('display_name parameter is not supported in Gemini API.')
155+
raise ValueError(
156+
'display_name parameter is only supported in Gemini Enterprise Agent'
157+
' Platform mode, not in Gemini Developer API mode.'
158+
)
137159

138160
if getv(from_object, ['file_uri']) is not None:
139161
setv(to_object, ['fileUri'], getv(from_object, ['file_uri']))
@@ -159,10 +181,16 @@ def _FunctionCall_to_mldev(
159181
setv(to_object, ['name'], getv(from_object, ['name']))
160182

161183
if getv(from_object, ['partial_args']) is not None:
162-
raise ValueError('partial_args parameter is not supported in Gemini API.')
184+
raise ValueError(
185+
'partial_args parameter is only supported in Gemini Enterprise Agent'
186+
' Platform mode, not in Gemini Developer API mode.'
187+
)
163188

164189
if getv(from_object, ['will_continue']) is not None:
165-
raise ValueError('will_continue parameter is not supported in Gemini API.')
190+
raise ValueError(
191+
'will_continue parameter is only supported in Gemini Enterprise Agent'
192+
' Platform mode, not in Gemini Developer API mode.'
193+
)
166194

167195
return to_object
168196

@@ -280,8 +308,8 @@ def _GenerationConfig_to_vertex(
280308

281309
if getv(from_object, ['enable_enhanced_civic_answers']) is not None:
282310
raise ValueError(
283-
'enable_enhanced_civic_answers parameter is not supported in Gemini'
284-
' Enterprise Agent Platform.'
311+
'enable_enhanced_civic_answers parameter is only supported in Gemini'
312+
' Developer API mode, not in Gemini Enterprise Agent Platform mode.'
285313
)
286314

287315
return to_object
@@ -315,12 +343,14 @@ def _GoogleSearch_to_mldev(
315343

316344
if getv(from_object, ['blocking_confidence']) is not None:
317345
raise ValueError(
318-
'blocking_confidence parameter is not supported in Gemini API.'
346+
'blocking_confidence parameter is only supported in Gemini Enterprise'
347+
' Agent Platform mode, not in Gemini Developer API mode.'
319348
)
320349

321350
if getv(from_object, ['exclude_domains']) is not None:
322351
raise ValueError(
323-
'exclude_domains parameter is not supported in Gemini API.'
352+
'exclude_domains parameter is only supported in Gemini Enterprise Agent'
353+
' Platform mode, not in Gemini Developer API mode.'
324354
)
325355

326356
if getv(from_object, ['time_range_filter']) is not None:
@@ -512,8 +542,8 @@ def _LiveClientRealtimeInput_to_vertex(
512542

513543
if getv(from_object, ['audio_stream_end']) is not None:
514544
raise ValueError(
515-
'audio_stream_end parameter is not supported in Gemini Enterprise Agent'
516-
' Platform.'
545+
'audio_stream_end parameter is only supported in Gemini Developer API'
546+
' mode, not in Gemini Enterprise Agent Platform mode.'
517547
)
518548

519549
if getv(from_object, ['video']) is not None:
@@ -605,7 +635,8 @@ def _LiveClientSetup_to_mldev(
605635

606636
if getv(from_object, ['explicit_vad_signal']) is not None:
607637
raise ValueError(
608-
'explicit_vad_signal parameter is not supported in Gemini API.'
638+
'explicit_vad_signal parameter is only supported in Gemini Enterprise'
639+
' Agent Platform mode, not in Gemini Developer API mode.'
609640
)
610641

611642
if getv(from_object, ['history_config']) is not None:
@@ -704,8 +735,8 @@ def _LiveClientSetup_to_vertex(
704735

705736
if getv(from_object, ['history_config']) is not None:
706737
raise ValueError(
707-
'history_config parameter is not supported in Gemini Enterprise Agent'
708-
' Platform.'
738+
'history_config parameter is only supported in Gemini Developer API'
739+
' mode, not in Gemini Enterprise Agent Platform mode.'
709740
)
710741

711742
if getv(from_object, ['avatar_config']) is not None:
@@ -874,7 +905,8 @@ def _LiveConnectConfig_to_mldev(
874905

875906
if getv(from_object, ['explicit_vad_signal']) is not None:
876907
raise ValueError(
877-
'explicit_vad_signal parameter is not supported in Gemini API.'
908+
'explicit_vad_signal parameter is only supported in Gemini Enterprise'
909+
' Agent Platform mode, not in Gemini Developer API mode.'
878910
)
879911

880912
if getv(from_object, ['history_config']) is not None:
@@ -1063,8 +1095,8 @@ def _LiveConnectConfig_to_vertex(
10631095

10641096
if getv(from_object, ['history_config']) is not None:
10651097
raise ValueError(
1066-
'history_config parameter is not supported in Gemini Enterprise Agent'
1067-
' Platform.'
1098+
'history_config parameter is only supported in Gemini Developer API'
1099+
' mode, not in Gemini Enterprise Agent Platform mode.'
10681100
)
10691101

10701102
if getv(from_object, ['avatar_config']) is not None:
@@ -1141,25 +1173,26 @@ def _LiveMusicClientMessage_to_vertex(
11411173
to_object: dict[str, Any] = {}
11421174
if getv(from_object, ['setup']) is not None:
11431175
raise ValueError(
1144-
'setup parameter is not supported in Gemini Enterprise Agent Platform.'
1176+
'setup parameter is only supported in Gemini Developer API mode, not in'
1177+
' Gemini Enterprise Agent Platform mode.'
11451178
)
11461179

11471180
if getv(from_object, ['client_content']) is not None:
11481181
raise ValueError(
1149-
'client_content parameter is not supported in Gemini Enterprise Agent'
1150-
' Platform.'
1182+
'client_content parameter is only supported in Gemini Developer API'
1183+
' mode, not in Gemini Enterprise Agent Platform mode.'
11511184
)
11521185

11531186
if getv(from_object, ['music_generation_config']) is not None:
11541187
raise ValueError(
1155-
'music_generation_config parameter is not supported in Gemini'
1156-
' Enterprise Agent Platform.'
1188+
'music_generation_config parameter is only supported in Gemini'
1189+
' Developer API mode, not in Gemini Enterprise Agent Platform mode.'
11571190
)
11581191

11591192
if getv(from_object, ['playback_control']) is not None:
11601193
raise ValueError(
1161-
'playback_control parameter is not supported in Gemini Enterprise Agent'
1162-
' Platform.'
1194+
'playback_control parameter is only supported in Gemini Developer API'
1195+
' mode, not in Gemini Enterprise Agent Platform mode.'
11631196
)
11641197

11651198
return to_object
@@ -1183,7 +1216,8 @@ def _LiveMusicConnectParameters_to_vertex(
11831216
to_object: dict[str, Any] = {}
11841217
if getv(from_object, ['model']) is not None:
11851218
raise ValueError(
1186-
'model parameter is not supported in Gemini Enterprise Agent Platform.'
1219+
'model parameter is only supported in Gemini Developer API mode, not in'
1220+
' Gemini Enterprise Agent Platform mode.'
11871221
)
11881222

11891223
return to_object
@@ -1211,8 +1245,8 @@ def _LiveMusicSetConfigParameters_to_vertex(
12111245
to_object: dict[str, Any] = {}
12121246
if getv(from_object, ['music_generation_config']) is not None:
12131247
raise ValueError(
1214-
'music_generation_config parameter is not supported in Gemini'
1215-
' Enterprise Agent Platform.'
1248+
'music_generation_config parameter is only supported in Gemini'
1249+
' Developer API mode, not in Gemini Enterprise Agent Platform mode.'
12161250
)
12171251

12181252
return to_object
@@ -1240,8 +1274,8 @@ def _LiveMusicSetWeightedPromptsParameters_to_vertex(
12401274
to_object: dict[str, Any] = {}
12411275
if getv(from_object, ['weighted_prompts']) is not None:
12421276
raise ValueError(
1243-
'weighted_prompts parameter is not supported in Gemini Enterprise Agent'
1244-
' Platform.'
1277+
'weighted_prompts parameter is only supported in Gemini Developer API'
1278+
' mode, not in Gemini Enterprise Agent Platform mode.'
12451279
)
12461280

12471281
return to_object
@@ -1584,20 +1618,20 @@ def _Part_to_vertex(
15841618

15851619
if getv(from_object, ['tool_call']) is not None:
15861620
raise ValueError(
1587-
'tool_call parameter is not supported in Gemini Enterprise Agent'
1588-
' Platform.'
1621+
'tool_call parameter is only supported in Gemini Developer API mode,'
1622+
' not in Gemini Enterprise Agent Platform mode.'
15891623
)
15901624

15911625
if getv(from_object, ['tool_response']) is not None:
15921626
raise ValueError(
1593-
'tool_response parameter is not supported in Gemini Enterprise Agent'
1594-
' Platform.'
1627+
'tool_response parameter is only supported in Gemini Developer API'
1628+
' mode, not in Gemini Enterprise Agent Platform mode.'
15951629
)
15961630

15971631
if getv(from_object, ['part_metadata']) is not None:
15981632
raise ValueError(
1599-
'part_metadata parameter is not supported in Gemini Enterprise Agent'
1600-
' Platform.'
1633+
'part_metadata parameter is only supported in Gemini Developer API'
1634+
' mode, not in Gemini Enterprise Agent Platform mode.'
16011635
)
16021636

16031637
return to_object
@@ -1620,14 +1654,14 @@ def _ReplicatedVoiceConfig_to_vertex(
16201654

16211655
if getv(from_object, ['consent_audio']) is not None:
16221656
raise ValueError(
1623-
'consent_audio parameter is not supported in Gemini Enterprise Agent'
1624-
' Platform.'
1657+
'consent_audio parameter is only supported in Gemini Developer API'
1658+
' mode, not in Gemini Enterprise Agent Platform mode.'
16251659
)
16261660

16271661
if getv(from_object, ['voice_consent_signature']) is not None:
16281662
raise ValueError(
1629-
'voice_consent_signature parameter is not supported in Gemini'
1630-
' Enterprise Agent Platform.'
1663+
'voice_consent_signature parameter is only supported in Gemini'
1664+
' Developer API mode, not in Gemini Enterprise Agent Platform mode.'
16311665
)
16321666

16331667
return to_object
@@ -1642,7 +1676,10 @@ def _SafetySetting_to_mldev(
16421676
setv(to_object, ['category'], getv(from_object, ['category']))
16431677

16441678
if getv(from_object, ['method']) is not None:
1645-
raise ValueError('method parameter is not supported in Gemini API.')
1679+
raise ValueError(
1680+
'method parameter is only supported in Gemini Enterprise Agent Platform'
1681+
' mode, not in Gemini Developer API mode.'
1682+
)
16461683

16471684
if getv(from_object, ['threshold']) is not None:
16481685
setv(to_object, ['threshold'], getv(from_object, ['threshold']))
@@ -1659,7 +1696,10 @@ def _SessionResumptionConfig_to_mldev(
16591696
setv(to_object, ['handle'], getv(from_object, ['handle']))
16601697

16611698
if getv(from_object, ['transparent']) is not None:
1662-
raise ValueError('transparent parameter is not supported in Gemini API.')
1699+
raise ValueError(
1700+
'transparent parameter is only supported in Gemini Enterprise Agent'
1701+
' Platform mode, not in Gemini Developer API mode.'
1702+
)
16631703

16641704
return to_object
16651705

@@ -1715,7 +1755,10 @@ def _Tool_to_mldev(
17151755
) -> dict[str, Any]:
17161756
to_object: dict[str, Any] = {}
17171757
if getv(from_object, ['retrieval']) is not None:
1718-
raise ValueError('retrieval parameter is not supported in Gemini API.')
1758+
raise ValueError(
1759+
'retrieval parameter is only supported in Gemini Enterprise Agent'
1760+
' Platform mode, not in Gemini Developer API mode.'
1761+
)
17191762

17201763
if getv(from_object, ['computer_use']) is not None:
17211764
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
@@ -1742,7 +1785,8 @@ def _Tool_to_mldev(
17421785

17431786
if getv(from_object, ['enterprise_web_search']) is not None:
17441787
raise ValueError(
1745-
'enterprise_web_search parameter is not supported in Gemini API.'
1788+
'enterprise_web_search parameter is only supported in Gemini Enterprise'
1789+
' Agent Platform mode, not in Gemini Developer API mode.'
17461790
)
17471791

17481792
if getv(from_object, ['function_declarations']) is not None:
@@ -1761,7 +1805,8 @@ def _Tool_to_mldev(
17611805

17621806
if getv(from_object, ['parallel_ai_search']) is not None:
17631807
raise ValueError(
1764-
'parallel_ai_search parameter is not supported in Gemini API.'
1808+
'parallel_ai_search parameter is only supported in Gemini Enterprise'
1809+
' Agent Platform mode, not in Gemini Developer API mode.'
17651810
)
17661811

17671812
if getv(from_object, ['url_context']) is not None:
@@ -1790,8 +1835,8 @@ def _Tool_to_vertex(
17901835

17911836
if getv(from_object, ['file_search']) is not None:
17921837
raise ValueError(
1793-
'file_search parameter is not supported in Gemini Enterprise Agent'
1794-
' Platform.'
1838+
'file_search parameter is only supported in Gemini Developer API mode,'
1839+
' not in Gemini Enterprise Agent Platform mode.'
17951840
)
17961841

17971842
if getv(from_object, ['google_search']) is not None:
@@ -1836,8 +1881,8 @@ def _Tool_to_vertex(
18361881

18371882
if getv(from_object, ['mcp_servers']) is not None:
18381883
raise ValueError(
1839-
'mcp_servers parameter is not supported in Gemini Enterprise Agent'
1840-
' Platform.'
1884+
'mcp_servers parameter is only supported in Gemini Developer API mode,'
1885+
' not in Gemini Enterprise Agent Platform mode.'
18411886
)
18421887

18431888
return to_object

google/genai/_operations_converters.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,22 @@ def _FetchPredictOperationParameters_to_mldev(
2727
) -> dict[str, Any]:
2828
to_object: dict[str, Any] = {}
2929
if getv(from_object, ['operation_name']) is not None:
30-
raise ValueError('operation_name parameter is not supported in Gemini API.')
30+
raise ValueError(
31+
'operation_name parameter is only supported in Gemini Enterprise Agent'
32+
' Platform mode, not in Gemini Developer API mode.'
33+
)
3134

3235
if getv(from_object, ['resource_name']) is not None:
33-
raise ValueError('resource_name parameter is not supported in Gemini API.')
36+
raise ValueError(
37+
'resource_name parameter is only supported in Gemini Enterprise Agent'
38+
' Platform mode, not in Gemini Developer API mode.'
39+
)
3440

3541
if getv(from_object, ['config']) is not None:
36-
raise ValueError('config parameter is not supported in Gemini API.')
42+
raise ValueError(
43+
'config parameter is only supported in Gemini Enterprise Agent Platform'
44+
' mode, not in Gemini Developer API mode.'
45+
)
3746

3847
return to_object
3948

0 commit comments

Comments
 (0)