diff --git a/google/genai/_live_converters.py b/google/genai/_live_converters.py index 3fd9d6a17..b91c298b7 100644 --- a/google/genai/_live_converters.py +++ b/google/genai/_live_converters.py @@ -29,7 +29,10 @@ def _AudioTranscriptionConfig_to_mldev( ) -> dict[str, Any]: to_object: dict[str, Any] = {} if getv(from_object, ['language_codes']) is not None: - raise ValueError('language_codes parameter is not supported in Gemini API.') + raise ValueError( + 'language_codes parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -43,27 +46,40 @@ def _AuthConfig_to_mldev( setv(to_object, ['apiKey'], getv(from_object, ['api_key'])) if getv(from_object, ['api_key_config']) is not None: - raise ValueError('api_key_config parameter is not supported in Gemini API.') + raise ValueError( + 'api_key_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['auth_type']) is not None: - raise ValueError('auth_type parameter is not supported in Gemini API.') + raise ValueError( + 'auth_type parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['google_service_account_config']) is not None: raise ValueError( - 'google_service_account_config parameter is not supported in Gemini' - ' API.' + 'google_service_account_config parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['http_basic_auth_config']) is not None: raise ValueError( - 'http_basic_auth_config parameter is not supported in Gemini API.' + 'http_basic_auth_config parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['oauth_config']) is not None: - raise ValueError('oauth_config parameter is not supported in Gemini API.') + raise ValueError( + 'oauth_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['oidc_config']) is not None: - raise ValueError('oidc_config parameter is not supported in Gemini API.') + raise ValueError( + 'oidc_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -77,7 +93,10 @@ def _Blob_to_mldev( setv(to_object, ['data'], getv(from_object, ['data'])) if getv(from_object, ['display_name']) is not None: - raise ValueError('display_name parameter is not supported in Gemini API.') + raise ValueError( + 'display_name parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['mime_type']) is not None: setv(to_object, ['mimeType'], getv(from_object, ['mime_type'])) @@ -133,7 +152,10 @@ def _FileData_to_mldev( ) -> dict[str, Any]: to_object: dict[str, Any] = {} if getv(from_object, ['display_name']) is not None: - raise ValueError('display_name parameter is not supported in Gemini API.') + raise ValueError( + 'display_name parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['file_uri']) is not None: setv(to_object, ['fileUri'], getv(from_object, ['file_uri'])) @@ -159,10 +181,16 @@ def _FunctionCall_to_mldev( setv(to_object, ['name'], getv(from_object, ['name'])) if getv(from_object, ['partial_args']) is not None: - raise ValueError('partial_args parameter is not supported in Gemini API.') + raise ValueError( + 'partial_args parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['will_continue']) is not None: - raise ValueError('will_continue parameter is not supported in Gemini API.') + raise ValueError( + 'will_continue parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -200,8 +228,8 @@ def _FunctionDeclaration_to_vertex( if getv(from_object, ['behavior']) is not None: raise ValueError( - 'behavior parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'behavior parameter is only supported in Gemini Developer API mode, not' + ' in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -320,8 +348,8 @@ def _GenerationConfig_to_vertex( if getv(from_object, ['enable_enhanced_civic_answers']) is not None: raise ValueError( - 'enable_enhanced_civic_answers parameter is not supported in Gemini' - ' Enterprise Agent Platform.' + 'enable_enhanced_civic_answers parameter is only supported in Gemini' + ' Developer API mode, not in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -355,12 +383,14 @@ def _GoogleSearch_to_mldev( if getv(from_object, ['blocking_confidence']) is not None: raise ValueError( - 'blocking_confidence parameter is not supported in Gemini API.' + 'blocking_confidence parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['exclude_domains']) is not None: raise ValueError( - 'exclude_domains parameter is not supported in Gemini API.' + 'exclude_domains parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['time_range_filter']) is not None: @@ -552,8 +582,8 @@ def _LiveClientRealtimeInput_to_vertex( if getv(from_object, ['audio_stream_end']) is not None: raise ValueError( - 'audio_stream_end parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'audio_stream_end parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['video']) is not None: @@ -645,7 +675,8 @@ def _LiveClientSetup_to_mldev( if getv(from_object, ['explicit_vad_signal']) is not None: raise ValueError( - 'explicit_vad_signal parameter is not supported in Gemini API.' + 'explicit_vad_signal parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['history_config']) is not None: @@ -744,8 +775,8 @@ def _LiveClientSetup_to_vertex( if getv(from_object, ['history_config']) is not None: raise ValueError( - 'history_config parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'history_config parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['avatar_config']) is not None: @@ -914,7 +945,8 @@ def _LiveConnectConfig_to_mldev( if getv(from_object, ['explicit_vad_signal']) is not None: raise ValueError( - 'explicit_vad_signal parameter is not supported in Gemini API.' + 'explicit_vad_signal parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['history_config']) is not None: @@ -1103,8 +1135,8 @@ def _LiveConnectConfig_to_vertex( if getv(from_object, ['history_config']) is not None: raise ValueError( - 'history_config parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'history_config parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['avatar_config']) is not None: @@ -1181,25 +1213,26 @@ def _LiveMusicClientMessage_to_vertex( to_object: dict[str, Any] = {} if getv(from_object, ['setup']) is not None: raise ValueError( - 'setup parameter is not supported in Gemini Enterprise Agent Platform.' + 'setup parameter is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['client_content']) is not None: raise ValueError( - 'client_content parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'client_content parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['music_generation_config']) is not None: raise ValueError( - 'music_generation_config parameter is not supported in Gemini' - ' Enterprise Agent Platform.' + 'music_generation_config parameter is only supported in Gemini' + ' Developer API mode, not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['playback_control']) is not None: raise ValueError( - 'playback_control parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'playback_control parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -1223,7 +1256,8 @@ def _LiveMusicConnectParameters_to_vertex( to_object: dict[str, Any] = {} if getv(from_object, ['model']) is not None: raise ValueError( - 'model parameter is not supported in Gemini Enterprise Agent Platform.' + 'model parameter is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) return to_object @@ -1251,8 +1285,8 @@ def _LiveMusicSetConfigParameters_to_vertex( to_object: dict[str, Any] = {} if getv(from_object, ['music_generation_config']) is not None: raise ValueError( - 'music_generation_config parameter is not supported in Gemini' - ' Enterprise Agent Platform.' + 'music_generation_config parameter is only supported in Gemini' + ' Developer API mode, not in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -1280,8 +1314,8 @@ def _LiveMusicSetWeightedPromptsParameters_to_vertex( to_object: dict[str, Any] = {} if getv(from_object, ['weighted_prompts']) is not None: raise ValueError( - 'weighted_prompts parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'weighted_prompts parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -1624,20 +1658,20 @@ def _Part_to_vertex( if getv(from_object, ['tool_call']) is not None: raise ValueError( - 'tool_call parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'tool_call parameter is only supported in Gemini Developer API mode,' + ' not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['tool_response']) is not None: raise ValueError( - 'tool_response parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'tool_response parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['part_metadata']) is not None: raise ValueError( - 'part_metadata parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'part_metadata parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -1660,14 +1694,14 @@ def _ReplicatedVoiceConfig_to_vertex( if getv(from_object, ['consent_audio']) is not None: raise ValueError( - 'consent_audio parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'consent_audio parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['voice_consent_signature']) is not None: raise ValueError( - 'voice_consent_signature parameter is not supported in Gemini' - ' Enterprise Agent Platform.' + 'voice_consent_signature parameter is only supported in Gemini' + ' Developer API mode, not in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -1682,7 +1716,10 @@ def _SafetySetting_to_mldev( setv(to_object, ['category'], getv(from_object, ['category'])) if getv(from_object, ['method']) is not None: - raise ValueError('method parameter is not supported in Gemini API.') + raise ValueError( + 'method parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['threshold']) is not None: setv(to_object, ['threshold'], getv(from_object, ['threshold'])) @@ -1699,7 +1736,10 @@ def _SessionResumptionConfig_to_mldev( setv(to_object, ['handle'], getv(from_object, ['handle'])) if getv(from_object, ['transparent']) is not None: - raise ValueError('transparent parameter is not supported in Gemini API.') + raise ValueError( + 'transparent parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -1755,7 +1795,10 @@ def _Tool_to_mldev( ) -> dict[str, Any]: to_object: dict[str, Any] = {} if getv(from_object, ['retrieval']) is not None: - raise ValueError('retrieval parameter is not supported in Gemini API.') + raise ValueError( + 'retrieval parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['computer_use']) is not None: setv(to_object, ['computerUse'], getv(from_object, ['computer_use'])) @@ -1782,7 +1825,8 @@ def _Tool_to_mldev( if getv(from_object, ['enterprise_web_search']) is not None: raise ValueError( - 'enterprise_web_search parameter is not supported in Gemini API.' + 'enterprise_web_search parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['function_declarations']) is not None: @@ -1801,7 +1845,8 @@ def _Tool_to_mldev( if getv(from_object, ['parallel_ai_search']) is not None: raise ValueError( - 'parallel_ai_search parameter is not supported in Gemini API.' + 'parallel_ai_search parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['url_context']) is not None: @@ -1830,8 +1875,8 @@ def _Tool_to_vertex( if getv(from_object, ['file_search']) is not None: raise ValueError( - 'file_search parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'file_search parameter is only supported in Gemini Developer API mode,' + ' not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['google_search']) is not None: @@ -1879,8 +1924,8 @@ def _Tool_to_vertex( if getv(from_object, ['mcp_servers']) is not None: raise ValueError( - 'mcp_servers parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'mcp_servers parameter is only supported in Gemini Developer API mode,' + ' not in Gemini Enterprise Agent Platform mode.' ) return to_object diff --git a/google/genai/_operations_converters.py b/google/genai/_operations_converters.py index eb840baab..b48f301da 100644 --- a/google/genai/_operations_converters.py +++ b/google/genai/_operations_converters.py @@ -27,13 +27,22 @@ def _FetchPredictOperationParameters_to_mldev( ) -> dict[str, Any]: to_object: dict[str, Any] = {} if getv(from_object, ['operation_name']) is not None: - raise ValueError('operation_name parameter is not supported in Gemini API.') + raise ValueError( + 'operation_name parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['resource_name']) is not None: - raise ValueError('resource_name parameter is not supported in Gemini API.') + raise ValueError( + 'resource_name parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['config']) is not None: - raise ValueError('config parameter is not supported in Gemini API.') + raise ValueError( + 'config parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) return to_object diff --git a/google/genai/_tokens_converters.py b/google/genai/_tokens_converters.py index 1d0d4bd83..d1b8c966d 100644 --- a/google/genai/_tokens_converters.py +++ b/google/genai/_tokens_converters.py @@ -29,7 +29,10 @@ def _AudioTranscriptionConfig_to_mldev( ) -> dict[str, Any]: to_object: dict[str, Any] = {} if getv(from_object, ['language_codes']) is not None: - raise ValueError('language_codes parameter is not supported in Gemini API.') + raise ValueError( + 'language_codes parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -43,27 +46,40 @@ def _AuthConfig_to_mldev( setv(to_object, ['apiKey'], getv(from_object, ['api_key'])) if getv(from_object, ['api_key_config']) is not None: - raise ValueError('api_key_config parameter is not supported in Gemini API.') + raise ValueError( + 'api_key_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['auth_type']) is not None: - raise ValueError('auth_type parameter is not supported in Gemini API.') + raise ValueError( + 'auth_type parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['google_service_account_config']) is not None: raise ValueError( - 'google_service_account_config parameter is not supported in Gemini' - ' API.' + 'google_service_account_config parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['http_basic_auth_config']) is not None: raise ValueError( - 'http_basic_auth_config parameter is not supported in Gemini API.' + 'http_basic_auth_config parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['oauth_config']) is not None: - raise ValueError('oauth_config parameter is not supported in Gemini API.') + raise ValueError( + 'oauth_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['oidc_config']) is not None: - raise ValueError('oidc_config parameter is not supported in Gemini API.') + raise ValueError( + 'oidc_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -77,7 +93,10 @@ def _Blob_to_mldev( setv(to_object, ['data'], getv(from_object, ['data'])) if getv(from_object, ['display_name']) is not None: - raise ValueError('display_name parameter is not supported in Gemini API.') + raise ValueError( + 'display_name parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['mime_type']) is not None: setv(to_object, ['mimeType'], getv(from_object, ['mime_type'])) @@ -172,7 +191,8 @@ def _CreateAuthTokenParameters_to_vertex( to_object: dict[str, Any] = {} if getv(from_object, ['config']) is not None: raise ValueError( - 'config parameter is not supported in Gemini Enterprise Agent Platform.' + 'config parameter is only supported in Gemini Developer API mode, not' + ' in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -184,7 +204,10 @@ def _FileData_to_mldev( ) -> dict[str, Any]: to_object: dict[str, Any] = {} if getv(from_object, ['display_name']) is not None: - raise ValueError('display_name parameter is not supported in Gemini API.') + raise ValueError( + 'display_name parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['file_uri']) is not None: setv(to_object, ['fileUri'], getv(from_object, ['file_uri'])) @@ -210,10 +233,16 @@ def _FunctionCall_to_mldev( setv(to_object, ['name'], getv(from_object, ['name'])) if getv(from_object, ['partial_args']) is not None: - raise ValueError('partial_args parameter is not supported in Gemini API.') + raise ValueError( + 'partial_args parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['will_continue']) is not None: - raise ValueError('will_continue parameter is not supported in Gemini API.') + raise ValueError( + 'will_continue parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -246,12 +275,14 @@ def _GoogleSearch_to_mldev( if getv(from_object, ['blocking_confidence']) is not None: raise ValueError( - 'blocking_confidence parameter is not supported in Gemini API.' + 'blocking_confidence parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['exclude_domains']) is not None: raise ValueError( - 'exclude_domains parameter is not supported in Gemini API.' + 'exclude_domains parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['time_range_filter']) is not None: @@ -415,7 +446,8 @@ def _LiveConnectConfig_to_mldev( if getv(from_object, ['explicit_vad_signal']) is not None: raise ValueError( - 'explicit_vad_signal parameter is not supported in Gemini API.' + 'explicit_vad_signal parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['history_config']) is not None: @@ -555,7 +587,10 @@ def _SafetySetting_to_mldev( setv(to_object, ['category'], getv(from_object, ['category'])) if getv(from_object, ['method']) is not None: - raise ValueError('method parameter is not supported in Gemini API.') + raise ValueError( + 'method parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['threshold']) is not None: setv(to_object, ['threshold'], getv(from_object, ['threshold'])) @@ -572,7 +607,10 @@ def _SessionResumptionConfig_to_mldev( setv(to_object, ['handle'], getv(from_object, ['handle'])) if getv(from_object, ['transparent']) is not None: - raise ValueError('transparent parameter is not supported in Gemini API.') + raise ValueError( + 'transparent parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -583,7 +621,10 @@ def _Tool_to_mldev( ) -> dict[str, Any]: to_object: dict[str, Any] = {} if getv(from_object, ['retrieval']) is not None: - raise ValueError('retrieval parameter is not supported in Gemini API.') + raise ValueError( + 'retrieval parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['computer_use']) is not None: setv(to_object, ['computerUse'], getv(from_object, ['computer_use'])) @@ -610,7 +651,8 @@ def _Tool_to_mldev( if getv(from_object, ['enterprise_web_search']) is not None: raise ValueError( - 'enterprise_web_search parameter is not supported in Gemini API.' + 'enterprise_web_search parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['function_declarations']) is not None: @@ -629,7 +671,8 @@ def _Tool_to_mldev( if getv(from_object, ['parallel_ai_search']) is not None: raise ValueError( - 'parallel_ai_search parameter is not supported in Gemini API.' + 'parallel_ai_search parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['url_context']) is not None: diff --git a/google/genai/_transformers.py b/google/genai/_transformers.py index dc09a6ec6..c36524100 100644 --- a/google/genai/_transformers.py +++ b/google/genai/_transformers.py @@ -656,7 +656,7 @@ def _raise_for_unsupported_mldev_properties( or schema.get('additional_properties') ) ): - raise ValueError('additionalProperties is not supported in the Gemini API.') + raise ValueError('additionalProperties is only supported in Gemini Enterprise Agent Platform mode, , not in Gemini Developer API mode.') def process_schema( diff --git a/google/genai/batches.py b/google/genai/batches.py index 5d49dc6e5..82020186a 100644 --- a/google/genai/batches.py +++ b/google/genai/batches.py @@ -43,27 +43,40 @@ def _AuthConfig_to_mldev( setv(to_object, ['apiKey'], getv(from_object, ['api_key'])) if getv(from_object, ['api_key_config']) is not None: - raise ValueError('api_key_config parameter is not supported in Gemini API.') + raise ValueError( + 'api_key_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['auth_type']) is not None: - raise ValueError('auth_type parameter is not supported in Gemini API.') + raise ValueError( + 'auth_type parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['google_service_account_config']) is not None: raise ValueError( - 'google_service_account_config parameter is not supported in Gemini' - ' API.' + 'google_service_account_config parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['http_basic_auth_config']) is not None: raise ValueError( - 'http_basic_auth_config parameter is not supported in Gemini API.' + 'http_basic_auth_config parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['oauth_config']) is not None: - raise ValueError('oauth_config parameter is not supported in Gemini API.') + raise ValueError( + 'oauth_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['oidc_config']) is not None: - raise ValueError('oidc_config parameter is not supported in Gemini API.') + raise ValueError( + 'oidc_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -166,20 +179,20 @@ def _BatchJobDestination_to_vertex( if getv(from_object, ['file_name']) is not None: raise ValueError( - 'file_name parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'file_name parameter is only supported in Gemini Developer API mode,' + ' not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['inlined_responses']) is not None: raise ValueError( - 'inlined_responses parameter is not supported in Gemini Enterprise' - ' Agent Platform.' + 'inlined_responses parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['inlined_embed_content_responses']) is not None: raise ValueError( - 'inlined_embed_content_responses parameter is not supported in Gemini' - ' Enterprise Agent Platform.' + 'inlined_embed_content_responses parameter is only supported in Gemini' + ' Developer API mode, not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['vertex_dataset']) is not None: @@ -232,13 +245,22 @@ def _BatchJobSource_to_mldev( ) -> dict[str, Any]: to_object: dict[str, Any] = {} if getv(from_object, ['format']) is not None: - raise ValueError('format parameter is not supported in Gemini API.') + raise ValueError( + 'format parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['gcs_uri']) is not None: - raise ValueError('gcs_uri parameter is not supported in Gemini API.') + raise ValueError( + 'gcs_uri parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['bigquery_uri']) is not None: - raise ValueError('bigquery_uri parameter is not supported in Gemini API.') + raise ValueError( + 'bigquery_uri parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['file_name']) is not None: setv(to_object, ['fileName'], getv(from_object, ['file_name'])) @@ -255,7 +277,8 @@ def _BatchJobSource_to_mldev( if getv(from_object, ['vertex_dataset_name']) is not None: raise ValueError( - 'vertex_dataset_name parameter is not supported in Gemini API.' + 'vertex_dataset_name parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) return to_object @@ -281,14 +304,14 @@ def _BatchJobSource_to_vertex( if getv(from_object, ['file_name']) is not None: raise ValueError( - 'file_name parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'file_name parameter is only supported in Gemini Developer API mode,' + ' not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['inlined_requests']) is not None: raise ValueError( - 'inlined_requests parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'inlined_requests parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['vertex_dataset_name']) is not None: @@ -429,7 +452,10 @@ def _Blob_to_mldev( setv(to_object, ['data'], getv(from_object, ['data'])) if getv(from_object, ['display_name']) is not None: - raise ValueError('display_name parameter is not supported in Gemini API.') + raise ValueError( + 'display_name parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['mime_type']) is not None: setv(to_object, ['mimeType'], getv(from_object, ['mime_type'])) @@ -575,7 +601,10 @@ def _CreateBatchJobConfig_to_mldev( ) if getv(from_object, ['dest']) is not None: - raise ValueError('dest parameter is not supported in Gemini API.') + raise ValueError( + 'dest parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['webhook_config']) is not None: setv( @@ -607,8 +636,8 @@ def _CreateBatchJobConfig_to_vertex( if getv(from_object, ['webhook_config']) is not None: raise ValueError( - 'webhook_config parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'webhook_config parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -847,17 +876,27 @@ def _EmbedContentConfig_to_mldev( ) if getv(from_object, ['mime_type']) is not None: - raise ValueError('mime_type parameter is not supported in Gemini API.') + raise ValueError( + 'mime_type parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['auto_truncate']) is not None: - raise ValueError('auto_truncate parameter is not supported in Gemini API.') + raise ValueError( + 'auto_truncate parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['document_ocr']) is not None: - raise ValueError('document_ocr parameter is not supported in Gemini API.') + raise ValueError( + 'document_ocr parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['audio_track_extraction']) is not None: raise ValueError( - 'audio_track_extraction parameter is not supported in Gemini API.' + 'audio_track_extraction parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) return to_object @@ -890,7 +929,10 @@ def _FileData_to_mldev( ) -> dict[str, Any]: to_object: dict[str, Any] = {} if getv(from_object, ['display_name']) is not None: - raise ValueError('display_name parameter is not supported in Gemini API.') + raise ValueError( + 'display_name parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['file_uri']) is not None: setv(to_object, ['fileUri'], getv(from_object, ['file_uri'])) @@ -916,10 +958,16 @@ def _FunctionCall_to_mldev( setv(to_object, ['name'], getv(from_object, ['name'])) if getv(from_object, ['partial_args']) is not None: - raise ValueError('partial_args parameter is not supported in Gemini API.') + raise ValueError( + 'partial_args parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['will_continue']) is not None: - raise ValueError('will_continue parameter is not supported in Gemini API.') + raise ValueError( + 'will_continue parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -941,8 +989,8 @@ def _FunctionCallingConfig_to_mldev( if getv(from_object, ['stream_function_call_arguments']) is not None: raise ValueError( - 'stream_function_call_arguments parameter is not supported in Gemini' - ' API.' + 'stream_function_call_arguments parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) return to_object @@ -1031,11 +1079,15 @@ def _GenerateContentConfig_to_mldev( ) if getv(from_object, ['routing_config']) is not None: - raise ValueError('routing_config parameter is not supported in Gemini API.') + raise ValueError( + 'routing_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['model_selection_config']) is not None: raise ValueError( - 'model_selection_config parameter is not supported in Gemini API.' + 'model_selection_config parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['safety_settings']) is not None: @@ -1066,7 +1118,10 @@ def _GenerateContentConfig_to_mldev( ) if getv(from_object, ['labels']) is not None: - raise ValueError('labels parameter is not supported in Gemini API.') + raise ValueError( + 'labels parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['cached_content']) is not None: setv( @@ -1098,7 +1153,8 @@ def _GenerateContentConfig_to_mldev( if getv(from_object, ['audio_timestamp']) is not None: raise ValueError( - 'audio_timestamp parameter is not supported in Gemini API.' + 'audio_timestamp parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['thinking_config']) is not None: @@ -1120,7 +1176,8 @@ def _GenerateContentConfig_to_mldev( if getv(from_object, ['model_armor_config']) is not None: raise ValueError( - 'model_armor_config parameter is not supported in Gemini API.' + 'model_armor_config parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['service_tier']) is not None: @@ -1227,12 +1284,14 @@ def _GoogleSearch_to_mldev( if getv(from_object, ['blocking_confidence']) is not None: raise ValueError( - 'blocking_confidence parameter is not supported in Gemini API.' + 'blocking_confidence parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['exclude_domains']) is not None: raise ValueError( - 'exclude_domains parameter is not supported in Gemini API.' + 'exclude_domains parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['time_range_filter']) is not None: @@ -1256,27 +1315,32 @@ def _ImageConfig_to_mldev( if getv(from_object, ['person_generation']) is not None: raise ValueError( - 'person_generation parameter is not supported in Gemini API.' + 'person_generation parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['prominent_people']) is not None: raise ValueError( - 'prominent_people parameter is not supported in Gemini API.' + 'prominent_people parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['output_mime_type']) is not None: raise ValueError( - 'output_mime_type parameter is not supported in Gemini API.' + 'output_mime_type parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['output_compression_quality']) is not None: raise ValueError( - 'output_compression_quality parameter is not supported in Gemini API.' + 'output_compression_quality parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['image_output_options']) is not None: raise ValueError( - 'image_output_options parameter is not supported in Gemini API.' + 'image_output_options parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) return to_object @@ -1364,7 +1428,10 @@ def _ListBatchJobsConfig_to_mldev( ) if getv(from_object, ['filter']) is not None: - raise ValueError('filter parameter is not supported in Gemini API.') + raise ValueError( + 'filter parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) return to_object @@ -1552,7 +1619,10 @@ def _SafetySetting_to_mldev( setv(to_object, ['category'], getv(from_object, ['category'])) if getv(from_object, ['method']) is not None: - raise ValueError('method parameter is not supported in Gemini API.') + raise ValueError( + 'method parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['threshold']) is not None: setv(to_object, ['threshold'], getv(from_object, ['threshold'])) @@ -1595,7 +1665,10 @@ def _Tool_to_mldev( ) -> dict[str, Any]: to_object: dict[str, Any] = {} if getv(from_object, ['retrieval']) is not None: - raise ValueError('retrieval parameter is not supported in Gemini API.') + raise ValueError( + 'retrieval parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['computer_use']) is not None: setv(to_object, ['computerUse'], getv(from_object, ['computer_use'])) @@ -1622,7 +1695,8 @@ def _Tool_to_mldev( if getv(from_object, ['enterprise_web_search']) is not None: raise ValueError( - 'enterprise_web_search parameter is not supported in Gemini API.' + 'enterprise_web_search parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['function_declarations']) is not None: @@ -1641,7 +1715,8 @@ def _Tool_to_mldev( if getv(from_object, ['parallel_ai_search']) is not None: raise ValueError( - 'parallel_ai_search parameter is not supported in Gemini API.' + 'parallel_ai_search parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['url_context']) is not None: @@ -1794,7 +1869,8 @@ def _create_embeddings( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _CreateEmbeddingsBatchJobParameters_to_mldev( @@ -2417,7 +2493,8 @@ async def _create_embeddings( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _CreateEmbeddingsBatchJobParameters_to_mldev( diff --git a/google/genai/caches.py b/google/genai/caches.py index be85c95ea..ed8790afb 100644 --- a/google/genai/caches.py +++ b/google/genai/caches.py @@ -41,27 +41,40 @@ def _AuthConfig_to_mldev( setv(to_object, ['apiKey'], getv(from_object, ['api_key'])) if getv(from_object, ['api_key_config']) is not None: - raise ValueError('api_key_config parameter is not supported in Gemini API.') + raise ValueError( + 'api_key_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['auth_type']) is not None: - raise ValueError('auth_type parameter is not supported in Gemini API.') + raise ValueError( + 'auth_type parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['google_service_account_config']) is not None: raise ValueError( - 'google_service_account_config parameter is not supported in Gemini' - ' API.' + 'google_service_account_config parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['http_basic_auth_config']) is not None: raise ValueError( - 'http_basic_auth_config parameter is not supported in Gemini API.' + 'http_basic_auth_config parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['oauth_config']) is not None: - raise ValueError('oauth_config parameter is not supported in Gemini API.') + raise ValueError( + 'oauth_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['oidc_config']) is not None: - raise ValueError('oidc_config parameter is not supported in Gemini API.') + raise ValueError( + 'oidc_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -75,7 +88,10 @@ def _Blob_to_mldev( setv(to_object, ['data'], getv(from_object, ['data'])) if getv(from_object, ['display_name']) is not None: - raise ValueError('display_name parameter is not supported in Gemini API.') + raise ValueError( + 'display_name parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['mime_type']) is not None: setv(to_object, ['mimeType'], getv(from_object, ['mime_type'])) @@ -177,7 +193,10 @@ def _CreateCachedContentConfig_to_mldev( ) if getv(from_object, ['kms_key_name']) is not None: - raise ValueError('kms_key_name parameter is not supported in Gemini API.') + raise ValueError( + 'kms_key_name parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -349,7 +368,10 @@ def _FileData_to_mldev( ) -> dict[str, Any]: to_object: dict[str, Any] = {} if getv(from_object, ['display_name']) is not None: - raise ValueError('display_name parameter is not supported in Gemini API.') + raise ValueError( + 'display_name parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['file_uri']) is not None: setv(to_object, ['fileUri'], getv(from_object, ['file_uri'])) @@ -375,10 +397,16 @@ def _FunctionCall_to_mldev( setv(to_object, ['name'], getv(from_object, ['name'])) if getv(from_object, ['partial_args']) is not None: - raise ValueError('partial_args parameter is not supported in Gemini API.') + raise ValueError( + 'partial_args parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['will_continue']) is not None: - raise ValueError('will_continue parameter is not supported in Gemini API.') + raise ValueError( + 'will_continue parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -400,8 +428,8 @@ def _FunctionCallingConfig_to_mldev( if getv(from_object, ['stream_function_call_arguments']) is not None: raise ValueError( - 'stream_function_call_arguments parameter is not supported in Gemini' - ' API.' + 'stream_function_call_arguments parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) return to_object @@ -440,8 +468,8 @@ def _FunctionDeclaration_to_vertex( if getv(from_object, ['behavior']) is not None: raise ValueError( - 'behavior parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'behavior parameter is only supported in Gemini Developer API mode, not' + ' in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -507,12 +535,14 @@ def _GoogleSearch_to_mldev( if getv(from_object, ['blocking_confidence']) is not None: raise ValueError( - 'blocking_confidence parameter is not supported in Gemini API.' + 'blocking_confidence parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['exclude_domains']) is not None: raise ValueError( - 'exclude_domains parameter is not supported in Gemini API.' + 'exclude_domains parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['time_range_filter']) is not None: @@ -765,20 +795,20 @@ def _Part_to_vertex( if getv(from_object, ['tool_call']) is not None: raise ValueError( - 'tool_call parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'tool_call parameter is only supported in Gemini Developer API mode,' + ' not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['tool_response']) is not None: raise ValueError( - 'tool_response parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'tool_response parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['part_metadata']) is not None: raise ValueError( - 'part_metadata parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'part_metadata parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -832,8 +862,9 @@ def _ToolConfig_to_vertex( if getv(from_object, ['include_server_side_tool_invocations']) is not None: raise ValueError( - 'include_server_side_tool_invocations parameter is not supported in' - ' Gemini Enterprise Agent Platform.' + 'include_server_side_tool_invocations parameter is only supported in' + ' Gemini Developer API mode, not in Gemini Enterprise Agent Platform' + ' mode.' ) return to_object @@ -845,7 +876,10 @@ def _Tool_to_mldev( ) -> dict[str, Any]: to_object: dict[str, Any] = {} if getv(from_object, ['retrieval']) is not None: - raise ValueError('retrieval parameter is not supported in Gemini API.') + raise ValueError( + 'retrieval parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['computer_use']) is not None: setv(to_object, ['computerUse'], getv(from_object, ['computer_use'])) @@ -872,7 +906,8 @@ def _Tool_to_mldev( if getv(from_object, ['enterprise_web_search']) is not None: raise ValueError( - 'enterprise_web_search parameter is not supported in Gemini API.' + 'enterprise_web_search parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['function_declarations']) is not None: @@ -891,7 +926,8 @@ def _Tool_to_mldev( if getv(from_object, ['parallel_ai_search']) is not None: raise ValueError( - 'parallel_ai_search parameter is not supported in Gemini API.' + 'parallel_ai_search parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['url_context']) is not None: @@ -920,8 +956,8 @@ def _Tool_to_vertex( if getv(from_object, ['file_search']) is not None: raise ValueError( - 'file_search parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'file_search parameter is only supported in Gemini Developer API mode,' + ' not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['google_search']) is not None: @@ -969,8 +1005,8 @@ def _Tool_to_vertex( if getv(from_object, ['mcp_servers']) is not None: raise ValueError( - 'mcp_servers parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'mcp_servers parameter is only supported in Gemini Developer API mode,' + ' not in Gemini Enterprise Agent Platform mode.' ) return to_object diff --git a/google/genai/documents.py b/google/genai/documents.py index d542fea52..c58b3cdb8 100644 --- a/google/genai/documents.py +++ b/google/genai/documents.py @@ -150,7 +150,8 @@ def get( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _GetDocumentParameters_to_mldev(parameter_model) @@ -227,7 +228,8 @@ def delete( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _DeleteDocumentParameters_to_mldev(parameter_model) @@ -269,7 +271,8 @@ def _list( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _ListDocumentsParameters_to_mldev(parameter_model) @@ -378,7 +381,8 @@ async def get( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _GetDocumentParameters_to_mldev(parameter_model) @@ -457,7 +461,8 @@ async def delete( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _DeleteDocumentParameters_to_mldev(parameter_model) @@ -501,7 +506,8 @@ async def _list( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _ListDocumentsParameters_to_mldev(parameter_model) diff --git a/google/genai/file_search_stores.py b/google/genai/file_search_stores.py index b21165700..716f59de4 100644 --- a/google/genai/file_search_stores.py +++ b/google/genai/file_search_stores.py @@ -348,7 +348,8 @@ def create( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _CreateFileSearchStoreParameters_to_mldev( @@ -430,7 +431,8 @@ def get( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _GetFileSearchStoreParameters_to_mldev(parameter_model) @@ -508,7 +510,8 @@ def delete( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _DeleteFileSearchStoreParameters_to_mldev(parameter_model) @@ -546,7 +549,8 @@ def _list( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _ListFileSearchStoresParameters_to_mldev(parameter_model) @@ -615,7 +619,8 @@ def _upload_to_file_search_store( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _UploadToFileSearchStoreParameters_to_mldev( @@ -721,7 +726,8 @@ def import_file( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _ImportFileParameters_to_mldev(parameter_model) @@ -965,7 +971,8 @@ async def create( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _CreateFileSearchStoreParameters_to_mldev( @@ -1047,7 +1054,8 @@ async def get( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _GetFileSearchStoreParameters_to_mldev(parameter_model) @@ -1127,7 +1135,8 @@ async def delete( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _DeleteFileSearchStoreParameters_to_mldev(parameter_model) @@ -1167,7 +1176,8 @@ async def _list( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _ListFileSearchStoresParameters_to_mldev(parameter_model) @@ -1238,7 +1248,8 @@ async def _upload_to_file_search_store( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _UploadToFileSearchStoreParameters_to_mldev( @@ -1344,7 +1355,8 @@ async def import_file( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _ImportFileParameters_to_mldev(parameter_model) diff --git a/google/genai/files.py b/google/genai/files.py index 04d83ebe2..6057a20bd 100644 --- a/google/genai/files.py +++ b/google/genai/files.py @@ -190,7 +190,8 @@ def _list( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _ListFilesParameters_to_mldev(parameter_model) @@ -261,7 +262,8 @@ def _create( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _CreateFileParameters_to_mldev(parameter_model) @@ -353,7 +355,8 @@ def get( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _GetFileParameters_to_mldev(parameter_model) @@ -432,7 +435,8 @@ def delete( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _DeleteFileParameters_to_mldev(parameter_model) @@ -505,7 +509,8 @@ def _register_files( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _InternalRegisterFilesParameters_to_mldev(parameter_model) @@ -800,7 +805,8 @@ async def _list( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _ListFilesParameters_to_mldev(parameter_model) @@ -873,7 +879,8 @@ async def _create( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _CreateFileParameters_to_mldev(parameter_model) @@ -965,7 +972,8 @@ async def get( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _GetFileParameters_to_mldev(parameter_model) @@ -1046,7 +1054,8 @@ async def delete( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _DeleteFileParameters_to_mldev(parameter_model) @@ -1119,7 +1128,8 @@ async def _register_files( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _InternalRegisterFilesParameters_to_mldev(parameter_model) diff --git a/google/genai/models.py b/google/genai/models.py index 339248d0c..73cda11a4 100644 --- a/google/genai/models.py +++ b/google/genai/models.py @@ -38,19 +38,28 @@ def _PersonGeneration_to_mldev_enum_validate(enum_value: Any) -> None: if enum_value in set(['ALLOW_ALL']): - raise ValueError(f'{enum_value} enum value is not supported in Gemini API.') + raise ValueError( + f'{enum_value} enum value is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) def _SafetyFilterLevel_to_mldev_enum_validate(enum_value: Any) -> None: if enum_value in set(['BLOCK_NONE']): - raise ValueError(f'{enum_value} enum value is not supported in Gemini API.') + raise ValueError( + f'{enum_value} enum value is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) def _VideoGenerationReferenceType_to_mldev_enum_validate( enum_value: Any, ) -> None: if enum_value in set(['STYLE']): - raise ValueError(f'{enum_value} enum value is not supported in Gemini API.') + raise ValueError( + f'{enum_value} enum value is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) def _AuthConfig_to_mldev( @@ -63,27 +72,40 @@ def _AuthConfig_to_mldev( setv(to_object, ['apiKey'], getv(from_object, ['api_key'])) if getv(from_object, ['api_key_config']) is not None: - raise ValueError('api_key_config parameter is not supported in Gemini API.') + raise ValueError( + 'api_key_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['auth_type']) is not None: - raise ValueError('auth_type parameter is not supported in Gemini API.') + raise ValueError( + 'auth_type parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['google_service_account_config']) is not None: raise ValueError( - 'google_service_account_config parameter is not supported in Gemini' - ' API.' + 'google_service_account_config parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['http_basic_auth_config']) is not None: raise ValueError( - 'http_basic_auth_config parameter is not supported in Gemini API.' + 'http_basic_auth_config parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['oauth_config']) is not None: - raise ValueError('oauth_config parameter is not supported in Gemini API.') + raise ValueError( + 'oauth_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['oidc_config']) is not None: - raise ValueError('oidc_config parameter is not supported in Gemini API.') + raise ValueError( + 'oidc_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -98,7 +120,10 @@ def _Blob_to_mldev( setv(to_object, ['data'], getv(from_object, ['data'])) if getv(from_object, ['display_name']) is not None: - raise ValueError('display_name parameter is not supported in Gemini API.') + raise ValueError( + 'display_name parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['mime_type']) is not None: setv(to_object, ['mimeType'], getv(from_object, ['mime_type'])) @@ -335,15 +360,20 @@ def _CountTokensConfig_to_mldev( if getv(from_object, ['system_instruction']) is not None: raise ValueError( - 'system_instruction parameter is not supported in Gemini API.' + 'system_instruction parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['tools']) is not None: - raise ValueError('tools parameter is not supported in Gemini API.') + raise ValueError( + 'tools parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['generation_config']) is not None: raise ValueError( - 'generation_config parameter is not supported in Gemini API.' + 'generation_config parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) return to_object @@ -761,17 +791,27 @@ def _EmbedContentConfig_to_mldev( ) if getv(from_object, ['mime_type']) is not None: - raise ValueError('mime_type parameter is not supported in Gemini API.') + raise ValueError( + 'mime_type parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['auto_truncate']) is not None: - raise ValueError('auto_truncate parameter is not supported in Gemini API.') + raise ValueError( + 'auto_truncate parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['document_ocr']) is not None: - raise ValueError('document_ocr parameter is not supported in Gemini API.') + raise ValueError( + 'document_ocr parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['audio_track_extraction']) is not None: raise ValueError( - 'audio_track_extraction parameter is not supported in Gemini API.' + 'audio_track_extraction parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) return to_object @@ -1075,7 +1115,10 @@ def _FileData_to_mldev( ) -> dict[str, Any]: to_object: dict[str, Any] = {} if getv(from_object, ['display_name']) is not None: - raise ValueError('display_name parameter is not supported in Gemini API.') + raise ValueError( + 'display_name parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['file_uri']) is not None: setv(to_object, ['fileUri'], getv(from_object, ['file_uri'])) @@ -1102,10 +1145,16 @@ def _FunctionCall_to_mldev( setv(to_object, ['name'], getv(from_object, ['name'])) if getv(from_object, ['partial_args']) is not None: - raise ValueError('partial_args parameter is not supported in Gemini API.') + raise ValueError( + 'partial_args parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['will_continue']) is not None: - raise ValueError('will_continue parameter is not supported in Gemini API.') + raise ValueError( + 'will_continue parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -1128,8 +1177,8 @@ def _FunctionCallingConfig_to_mldev( if getv(from_object, ['stream_function_call_arguments']) is not None: raise ValueError( - 'stream_function_call_arguments parameter is not supported in Gemini' - ' API.' + 'stream_function_call_arguments parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) return to_object @@ -1169,8 +1218,8 @@ def _FunctionDeclaration_to_vertex( if getv(from_object, ['behavior']) is not None: raise ValueError( - 'behavior parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'behavior parameter is only supported in Gemini Developer API mode, not' + ' in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -1262,11 +1311,15 @@ def _GenerateContentConfig_to_mldev( ) if getv(from_object, ['routing_config']) is not None: - raise ValueError('routing_config parameter is not supported in Gemini API.') + raise ValueError( + 'routing_config parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['model_selection_config']) is not None: raise ValueError( - 'model_selection_config parameter is not supported in Gemini API.' + 'model_selection_config parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['safety_settings']) is not None: @@ -1299,7 +1352,10 @@ def _GenerateContentConfig_to_mldev( ) if getv(from_object, ['labels']) is not None: - raise ValueError('labels parameter is not supported in Gemini API.') + raise ValueError( + 'labels parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['cached_content']) is not None: setv( @@ -1331,7 +1387,8 @@ def _GenerateContentConfig_to_mldev( if getv(from_object, ['audio_timestamp']) is not None: raise ValueError( - 'audio_timestamp parameter is not supported in Gemini API.' + 'audio_timestamp parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['thinking_config']) is not None: @@ -1355,7 +1412,8 @@ def _GenerateContentConfig_to_mldev( if getv(from_object, ['model_armor_config']) is not None: raise ValueError( - 'model_armor_config parameter is not supported in Gemini API.' + 'model_armor_config parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['service_tier']) is not None: @@ -1537,8 +1595,8 @@ def _GenerateContentConfig_to_vertex( if getv(from_object, ['enable_enhanced_civic_answers']) is not None: raise ValueError( - 'enable_enhanced_civic_answers parameter is not supported in Gemini' - ' Enterprise Agent Platform.' + 'enable_enhanced_civic_answers parameter is only supported in Gemini' + ' Developer API mode, not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['model_armor_config']) is not None: @@ -1709,11 +1767,15 @@ def _GenerateImagesConfig_to_mldev( to_object: dict[str, Any] = {} if getv(from_object, ['output_gcs_uri']) is not None: - raise ValueError('output_gcs_uri parameter is not supported in Gemini API.') + raise ValueError( + 'output_gcs_uri parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['negative_prompt']) is not None: raise ValueError( - 'negative_prompt parameter is not supported in Gemini API.' + 'negative_prompt parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['number_of_images']) is not None: @@ -1738,7 +1800,10 @@ def _GenerateImagesConfig_to_mldev( ) if getv(from_object, ['seed']) is not None: - raise ValueError('seed parameter is not supported in Gemini API.') + raise ValueError( + 'seed parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['safety_filter_level']) is not None: _SafetyFilterLevel_to_mldev_enum_validate( @@ -1796,10 +1861,16 @@ def _GenerateImagesConfig_to_mldev( ) if getv(from_object, ['add_watermark']) is not None: - raise ValueError('add_watermark parameter is not supported in Gemini API.') + raise ValueError( + 'add_watermark parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['labels']) is not None: - raise ValueError('labels parameter is not supported in Gemini API.') + raise ValueError( + 'labels parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['image_size']) is not None: setv( @@ -1809,7 +1880,10 @@ def _GenerateImagesConfig_to_mldev( ) if getv(from_object, ['enhance_prompt']) is not None: - raise ValueError('enhance_prompt parameter is not supported in Gemini API.') + raise ValueError( + 'enhance_prompt parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -2070,10 +2144,16 @@ def _GenerateVideosConfig_to_mldev( ) if getv(from_object, ['output_gcs_uri']) is not None: - raise ValueError('output_gcs_uri parameter is not supported in Gemini API.') + raise ValueError( + 'output_gcs_uri parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['fps']) is not None: - raise ValueError('fps parameter is not supported in Gemini API.') + raise ValueError( + 'fps parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['duration_seconds']) is not None: setv( @@ -2083,7 +2163,10 @@ def _GenerateVideosConfig_to_mldev( ) if getv(from_object, ['seed']) is not None: - raise ValueError('seed parameter is not supported in Gemini API.') + raise ValueError( + 'seed parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['aspect_ratio']) is not None: setv( @@ -2107,7 +2190,10 @@ def _GenerateVideosConfig_to_mldev( ) if getv(from_object, ['pubsub_topic']) is not None: - raise ValueError('pubsub_topic parameter is not supported in Gemini API.') + raise ValueError( + 'pubsub_topic parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['negative_prompt']) is not None: setv( @@ -2124,7 +2210,10 @@ def _GenerateVideosConfig_to_mldev( ) if getv(from_object, ['generate_audio']) is not None: - raise ValueError('generate_audio parameter is not supported in Gemini API.') + raise ValueError( + 'generate_audio parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['last_frame']) is not None: setv( @@ -2148,15 +2237,22 @@ def _GenerateVideosConfig_to_mldev( ) if getv(from_object, ['mask']) is not None: - raise ValueError('mask parameter is not supported in Gemini API.') + raise ValueError( + 'mask parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['compression_quality']) is not None: raise ValueError( - 'compression_quality parameter is not supported in Gemini API.' + 'compression_quality parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['labels']) is not None: - raise ValueError('labels parameter is not supported in Gemini API.') + raise ValueError( + 'labels parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['webhook_config']) is not None: setv( @@ -2164,7 +2260,10 @@ def _GenerateVideosConfig_to_mldev( ) if getv(from_object, ['resize_mode']) is not None: - raise ValueError('resize_mode parameter is not supported in Gemini API.') + raise ValueError( + 'resize_mode parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) return to_object @@ -2294,8 +2393,8 @@ def _GenerateVideosConfig_to_vertex( if getv(from_object, ['webhook_config']) is not None: raise ValueError( - 'webhook_config parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'webhook_config parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['resize_mode']) is not None: @@ -2840,8 +2939,8 @@ def _GenerationConfig_to_vertex( if getv(from_object, ['enable_enhanced_civic_answers']) is not None: raise ValueError( - 'enable_enhanced_civic_answers parameter is not supported in Gemini' - ' Enterprise Agent Platform.' + 'enable_enhanced_civic_answers parameter is only supported in Gemini' + ' Developer API mode, not in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -2913,12 +3012,14 @@ def _GoogleSearch_to_mldev( if getv(from_object, ['blocking_confidence']) is not None: raise ValueError( - 'blocking_confidence parameter is not supported in Gemini API.' + 'blocking_confidence parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['exclude_domains']) is not None: raise ValueError( - 'exclude_domains parameter is not supported in Gemini API.' + 'exclude_domains parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['time_range_filter']) is not None: @@ -2943,27 +3044,32 @@ def _ImageConfig_to_mldev( if getv(from_object, ['person_generation']) is not None: raise ValueError( - 'person_generation parameter is not supported in Gemini API.' + 'person_generation parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['prominent_people']) is not None: raise ValueError( - 'prominent_people parameter is not supported in Gemini API.' + 'prominent_people parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['output_mime_type']) is not None: raise ValueError( - 'output_mime_type parameter is not supported in Gemini API.' + 'output_mime_type parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['output_compression_quality']) is not None: raise ValueError( - 'output_compression_quality parameter is not supported in Gemini API.' + 'output_compression_quality parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['image_output_options']) is not None: raise ValueError( - 'image_output_options parameter is not supported in Gemini API.' + 'image_output_options parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) return to_object @@ -3066,7 +3172,10 @@ def _Image_to_mldev( ) -> dict[str, Any]: to_object: dict[str, Any] = {} if getv(from_object, ['gcs_uri']) is not None: - raise ValueError('gcs_uri parameter is not supported in Gemini API.') + raise ValueError( + 'gcs_uri parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['image_bytes']) is not None: setv( @@ -3545,20 +3654,20 @@ def _Part_to_vertex( if getv(from_object, ['tool_call']) is not None: raise ValueError( - 'tool_call parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'tool_call parameter is only supported in Gemini Developer API mode,' + ' not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['tool_response']) is not None: raise ValueError( - 'tool_response parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'tool_response parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['part_metadata']) is not None: raise ValueError( - 'part_metadata parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'part_metadata parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -3814,14 +3923,14 @@ def _ReplicatedVoiceConfig_to_vertex( if getv(from_object, ['consent_audio']) is not None: raise ValueError( - 'consent_audio parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'consent_audio parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['voice_consent_signature']) is not None: raise ValueError( - 'voice_consent_signature parameter is not supported in Gemini' - ' Enterprise Agent Platform.' + 'voice_consent_signature parameter is only supported in Gemini' + ' Developer API mode, not in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -3885,7 +3994,10 @@ def _SafetySetting_to_mldev( setv(to_object, ['category'], getv(from_object, ['category'])) if getv(from_object, ['method']) is not None: - raise ValueError('method parameter is not supported in Gemini API.') + raise ValueError( + 'method parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['threshold']) is not None: setv(to_object, ['threshold'], getv(from_object, ['threshold'])) @@ -4134,8 +4246,9 @@ def _ToolConfig_to_vertex( if getv(from_object, ['include_server_side_tool_invocations']) is not None: raise ValueError( - 'include_server_side_tool_invocations parameter is not supported in' - ' Gemini Enterprise Agent Platform.' + 'include_server_side_tool_invocations parameter is only supported in' + ' Gemini Developer API mode, not in Gemini Enterprise Agent Platform' + ' mode.' ) return to_object @@ -4148,7 +4261,10 @@ def _Tool_to_mldev( ) -> dict[str, Any]: to_object: dict[str, Any] = {} if getv(from_object, ['retrieval']) is not None: - raise ValueError('retrieval parameter is not supported in Gemini API.') + raise ValueError( + 'retrieval parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['computer_use']) is not None: setv(to_object, ['computerUse'], getv(from_object, ['computer_use'])) @@ -4179,7 +4295,8 @@ def _Tool_to_mldev( if getv(from_object, ['enterprise_web_search']) is not None: raise ValueError( - 'enterprise_web_search parameter is not supported in Gemini API.' + 'enterprise_web_search parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['function_declarations']) is not None: @@ -4198,7 +4315,8 @@ def _Tool_to_mldev( if getv(from_object, ['parallel_ai_search']) is not None: raise ValueError( - 'parallel_ai_search parameter is not supported in Gemini API.' + 'parallel_ai_search parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['url_context']) is not None: @@ -4228,8 +4346,8 @@ def _Tool_to_vertex( if getv(from_object, ['file_search']) is not None: raise ValueError( - 'file_search parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'file_search parameter is only supported in Gemini Developer API mode,' + ' not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['google_search']) is not None: @@ -4277,8 +4395,8 @@ def _Tool_to_vertex( if getv(from_object, ['mcp_servers']) is not None: raise ValueError( - 'mcp_servers parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'mcp_servers parameter is only supported in Gemini Developer API mode,' + ' not in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -5144,8 +5262,8 @@ def _edit_image( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _EditImageParameters_to_vertex( @@ -5228,8 +5346,8 @@ def _upscale_image( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _UpscaleImageAPIParameters_to_vertex( @@ -5340,8 +5458,8 @@ def recontext_image( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _RecontextImageParameters_to_vertex( @@ -5443,8 +5561,8 @@ def segment_image( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _SegmentImageParameters_to_vertex( @@ -5984,8 +6102,8 @@ def compute_tokens( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _ComputeTokensParameters_to_vertex( @@ -7335,8 +7453,8 @@ async def _edit_image( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _EditImageParameters_to_vertex( @@ -7419,8 +7537,8 @@ async def _upscale_image( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _UpscaleImageAPIParameters_to_vertex( @@ -7531,8 +7649,8 @@ async def recontext_image( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _RecontextImageParameters_to_vertex( @@ -7637,8 +7755,8 @@ async def segment_image( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _SegmentImageParameters_to_vertex( @@ -8181,8 +8299,8 @@ async def compute_tokens( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _ComputeTokensParameters_to_vertex( diff --git a/google/genai/operations.py b/google/genai/operations.py index 8fe95b2c6..7e76430ef 100644 --- a/google/genai/operations.py +++ b/google/genai/operations.py @@ -157,8 +157,8 @@ def _fetch_predict_videos_operation( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _FetchPredictOperationParameters_to_vertex(parameter_model) @@ -208,8 +208,8 @@ def _get( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _GetProjectOperationParameters_to_vertex(parameter_model) @@ -414,8 +414,8 @@ async def _fetch_predict_videos_operation( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _FetchPredictOperationParameters_to_vertex(parameter_model) @@ -465,8 +465,8 @@ async def _get( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _GetProjectOperationParameters_to_vertex(parameter_model) diff --git a/google/genai/tests/batches/test_create.py b/google/genai/tests/batches/test_create.py index b631997d2..c633fe7a4 100644 --- a/google/genai/tests/batches/test_create.py +++ b/google/genai/tests/batches/test_create.py @@ -61,7 +61,7 @@ 'dest': 'invalid_dest', }, ), - exception_if_mldev='not supported in Gemini API', + exception_if_mldev='supported', exception_if_vertex='Unsupported destination', has_union=True, ), @@ -86,7 +86,7 @@ ), ), ), - exception_if_vertex='not supported in Gemini Enterprise Agent Platform', + exception_if_vertex='supported', ), pytest_helper.TestTableItem( name='test_create_with_webhook_config_dict', @@ -108,7 +108,7 @@ }, }, ), - exception_if_vertex='not supported in Gemini Enterprise Agent Platform', + exception_if_vertex='supported', ), ] diff --git a/google/genai/tests/batches/test_create_with_file.py b/google/genai/tests/batches/test_create_with_file.py index dd8b929d0..fc2f16f6e 100644 --- a/google/genai/tests/batches/test_create_with_file.py +++ b/google/genai/tests/batches/test_create_with_file.py @@ -39,7 +39,7 @@ 'display_name': _DISPLAY_NAME, }, ), - exception_if_vertex='not supported', + exception_if_vertex='supported', has_union=True, ), pytest_helper.TestTableItem( @@ -51,7 +51,7 @@ 'display_name': _DISPLAY_NAME, }, ), - exception_if_vertex='not supported', + exception_if_vertex='supported', ), ] diff --git a/google/genai/tests/batches/test_create_with_inlined_requests.py b/google/genai/tests/batches/test_create_with_inlined_requests.py index 0eede1b4c..e04d342a6 100644 --- a/google/genai/tests/batches/test_create_with_inlined_requests.py +++ b/google/genai/tests/batches/test_create_with_inlined_requests.py @@ -175,7 +175,7 @@ 'display_name': _DISPLAY_NAME, }, ), - exception_if_vertex='not supported in Gemini Enterprise Agent Platform', + exception_if_vertex='supported in', has_union=True, ), pytest_helper.TestTableItem( @@ -187,7 +187,7 @@ 'display_name': _DISPLAY_NAME, }, ), - exception_if_vertex='not supported', + exception_if_vertex='supported in', ), pytest_helper.TestTableItem( name='test_with_inlined_request_config', @@ -198,7 +198,7 @@ 'display_name': _DISPLAY_NAME, }, ), - exception_if_vertex='not supported', + exception_if_vertex='supported in', ), pytest_helper.TestTableItem( name='test_union_with_inlined_request_system_instruction', @@ -210,7 +210,7 @@ }, ), has_union=True, - exception_if_vertex='not supported', + exception_if_vertex='supported in', ), pytest_helper.TestTableItem( name='test_with_image_file', @@ -221,7 +221,7 @@ 'display_name': _DISPLAY_NAME, }, ), - exception_if_vertex='not supported', + exception_if_vertex='supported in', ), pytest_helper.TestTableItem( name='test_with_image_blob', @@ -232,7 +232,7 @@ 'display_name': _DISPLAY_NAME, }, ), - exception_if_vertex='not supported', + exception_if_vertex='supported in', ), pytest_helper.TestTableItem( name='test_with_video_file', @@ -243,7 +243,7 @@ 'display_name': _DISPLAY_NAME, }, ), - exception_if_vertex='not supported', + exception_if_vertex='supported in', ), ] diff --git a/google/genai/tests/batches/test_list.py b/google/genai/tests/batches/test_list.py index 2cfd66db8..af0bfc34b 100644 --- a/google/genai/tests/batches/test_list.py +++ b/google/genai/tests/batches/test_list.py @@ -41,7 +41,7 @@ page_size=5, ), ), - exception_if_mldev='filter parameter is not supported in Gemini API', + exception_if_mldev='filter parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.', ), ] diff --git a/google/genai/tests/caches/test_create.py b/google/genai/tests/caches/test_create.py index 27362b96a..314670c8a 100644 --- a/google/genai/tests/caches/test_create.py +++ b/google/genai/tests/caches/test_create.py @@ -146,7 +146,7 @@ ), pytest_helper.TestTableItem( name='test_caches_create_with_gcs_uri_cmek', - exception_if_mldev='not supported', + exception_if_mldev='only supported in Gemini Enterprise Agent Platform mode', exception_if_vertex='INVALID_ARGUMENT', # The key is invalid. parameters=_CREATE_CACHED_CONTENT_PARAMETERS_GCS_URI_CMEK, ), diff --git a/google/genai/tests/documents/test_delete.py b/google/genai/tests/documents/test_delete.py index 589e4df00..d5426305a 100644 --- a/google/genai/tests/documents/test_delete.py +++ b/google/genai/tests/documents/test_delete.py @@ -30,7 +30,7 @@ ), config=types.DeleteDocumentConfig(force=True), ), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", ), ] diff --git a/google/genai/tests/documents/test_get.py b/google/genai/tests/documents/test_get.py index 8f1ebb44a..3b9f8ceb3 100644 --- a/google/genai/tests/documents/test_get.py +++ b/google/genai/tests/documents/test_get.py @@ -35,27 +35,27 @@ pytest_helper.TestTableItem( name="test_get_success", parameters=types._GetDocumentParameters(name=_EXISTING_DOCUMENT_NAME), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", ), pytest_helper.TestTableItem( name="test_get_not_found", parameters=types._GetDocumentParameters( name=_NON_EXISTENT_DOCUMENT_NAME ), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", exception_if_mldev="Documents does not exist", ), pytest_helper.TestTableItem( name="test_get_invalid_name", parameters=types._GetDocumentParameters(name=_INVALID_DOCUMENT_NAME), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", # Validation should catch this before the API call exception_if_mldev="INVALID_ARGUMENT", ), pytest_helper.TestTableItem( name="test_get_not_a_document_name", parameters=types._GetDocumentParameters(name=_NOT_A_DOCUMENT_NAME), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", exception_if_mldev="Not Found", ), ] diff --git a/google/genai/tests/documents/test_list.py b/google/genai/tests/documents/test_list.py index 5caf12020..638f72880 100644 --- a/google/genai/tests/documents/test_list.py +++ b/google/genai/tests/documents/test_list.py @@ -29,7 +29,7 @@ parameters=types._ListDocumentsParameters( parent=_FILE_SEARCH_STORE_NAME ), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", ), pytest_helper.TestTableItem( name="test_list_with_page_size", @@ -39,7 +39,7 @@ page_size=2, ), ), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", ), ] diff --git a/google/genai/tests/file_search_stores/test_create.py b/google/genai/tests/file_search_stores/test_create.py index 940f62a82..3f9bf7a4c 100644 --- a/google/genai/tests/file_search_stores/test_create.py +++ b/google/genai/tests/file_search_stores/test_create.py @@ -30,12 +30,12 @@ display_name="My File Search Store" ) ), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", ), pytest_helper.TestTableItem( name="test_basic", parameters=types._CreateFileSearchStoreParameters(), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", ), ] diff --git a/google/genai/tests/file_search_stores/test_delete.py b/google/genai/tests/file_search_stores/test_delete.py index 97487c831..726dbec0b 100644 --- a/google/genai/tests/file_search_stores/test_delete.py +++ b/google/genai/tests/file_search_stores/test_delete.py @@ -27,7 +27,7 @@ parameters=types._DeleteFileSearchStoreParameters( name="fileSearchStores/acxjj7m366ln-aw6xyp94icll", ), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", ), pytest_helper.TestTableItem( name="test_delete_with_name_and_force", @@ -35,7 +35,7 @@ name="fileSearchStores/7igesc9r2zw9-0mpxpsqubv7s", config=types.DeleteFileSearchStoreConfig(force=True), ), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", ), ] diff --git a/google/genai/tests/file_search_stores/test_get.py b/google/genai/tests/file_search_stores/test_get.py index 897c7381a..4bcc28a5d 100644 --- a/google/genai/tests/file_search_stores/test_get.py +++ b/google/genai/tests/file_search_stores/test_get.py @@ -39,14 +39,14 @@ parameters=types._GetFileSearchStoreParameters( name=_EXISTING_FILE_SEARCH_STORE_NAME ), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", ), pytest_helper.TestTableItem( name="test_get_not_found", parameters=types._GetFileSearchStoreParameters( name=_NON_EXISTENT_FILE_SEARCH_STORE_NAME ), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", # Expect an exception to be raised by the mock exception_if_mldev="PERMISSION_DENIED", ), @@ -55,7 +55,7 @@ parameters=types._GetFileSearchStoreParameters( name=_INVALID_FILE_SEARCH_STORE_NAME ), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", # Validation should catch this before the API call exception_if_mldev="INVALID_ARGUMENT", ), @@ -64,7 +64,7 @@ parameters=types._GetFileSearchStoreParameters( name=_NOT_A_FILE_SEARCH_STORE_NAME ), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", exception_if_mldev="Not Found", ), ] diff --git a/google/genai/tests/file_search_stores/test_list.py b/google/genai/tests/file_search_stores/test_list.py index 7b2607131..2cb99213d 100644 --- a/google/genai/tests/file_search_stores/test_list.py +++ b/google/genai/tests/file_search_stores/test_list.py @@ -25,7 +25,7 @@ pytest_helper.TestTableItem( name="test_list_default", parameters=types._ListFileSearchStoresParameters(), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", ), pytest_helper.TestTableItem( name="test_list_with_page_size", @@ -34,7 +34,7 @@ page_size=5, ), ), - exception_if_vertex="only supported in the Gemini Developer client", + exception_if_vertex="only supported in Gemini Developer API mode", ), ] diff --git a/google/genai/tests/files/test_delete.py b/google/genai/tests/files/test_delete.py index d3c3113b0..0a8d72326 100644 --- a/google/genai/tests/files/test_delete.py +++ b/google/genai/tests/files/test_delete.py @@ -24,7 +24,7 @@ pytest_helper.TestTableItem( name='test_delete', parameters=types._DeleteFileParameters(name='files/1g583ke2xdsn'), - exception_if_vertex='only supported in the Gemini Developer client', + exception_if_vertex='only supported in Gemini Developer API mode', skip_in_api_mode=( 'The files have a TTL, they cannot be reliably retrieved for a long' ' time.' diff --git a/google/genai/tests/files/test_get.py b/google/genai/tests/files/test_get.py index 7de4172db..a1c564306 100644 --- a/google/genai/tests/files/test_get.py +++ b/google/genai/tests/files/test_get.py @@ -24,7 +24,7 @@ pytest_helper.TestTableItem( name='test_get', parameters=types._GetFileParameters(name='files/vjvu9fwk2qj8'), - exception_if_vertex='only supported in the Gemini Developer client', + exception_if_vertex='only supported in Gemini Developer API mode', skip_in_api_mode=( 'The files have a TTL, they cannot be reliably retrieved for a long' ' time.' diff --git a/google/genai/tests/files/test_list.py b/google/genai/tests/files/test_list.py index e90c307a1..2ee83408d 100644 --- a/google/genai/tests/files/test_list.py +++ b/google/genai/tests/files/test_list.py @@ -24,7 +24,7 @@ test_table: list[pytest_helper.TestTableItem] = [ pytest_helper.TestTableItem( name='test_not_empty', - exception_if_vertex='only supported in the Gemini Developer client', + exception_if_vertex='only supported in Gemini Developer API mode', parameters=types._ListFilesParameters( config=types.ListFilesConfig( page_size=2, diff --git a/google/genai/tests/files/test_register_table.py b/google/genai/tests/files/test_register_table.py index 5a8e43ae4..336a174cf 100644 --- a/google/genai/tests/files/test_register_table.py +++ b/google/genai/tests/files/test_register_table.py @@ -43,7 +43,7 @@ def get_headers(): pytest_helper.TestTableItem( name='test_register', parameters=types._InternalRegisterFilesParameters(uris=['gs://unified-genai-dev/image.jpg']), - exception_if_vertex='only supported in the Gemini Developer client', + exception_if_vertex='only supported in Gemini Developer API mode', skip_in_api_mode=( 'The files have a TTL, they cannot be reliably retrieved for a long' ' time.' diff --git a/google/genai/tests/local_tokenizer/test_local_tokenizer.py b/google/genai/tests/local_tokenizer/test_local_tokenizer.py index ca337b5e8..f50dfaaa5 100644 --- a/google/genai/tests/local_tokenizer/test_local_tokenizer.py +++ b/google/genai/tests/local_tokenizer/test_local_tokenizer.py @@ -233,7 +233,7 @@ def test_count_tokens_with_unsupported_fields_logs_warning(self): role='user', parts=[ types.Part(text='hello'), - # executable_code is not supported by _TextsAccumulator + # executable_code is test_count_tokens_with_system_instruction by _TextsAccumulator types.Part( executable_code=types.ExecutableCode( language='PYTHON', code='print(1)' diff --git a/google/genai/tests/models/test_count_tokens.py b/google/genai/tests/models/test_count_tokens.py index 6589bc470..48470f932 100644 --- a/google/genai/tests/models/test_count_tokens.py +++ b/google/genai/tests/models/test_count_tokens.py @@ -75,17 +75,17 @@ ), pytest_helper.TestTableItem( name='test_count_tokens_with_system_instruction', - exception_if_mldev='not supported', + exception_if_mldev='only supported in Gemini Enterprise Agent Platform mode', parameters=_COUNT_TOKENS_PARAMS_WITH_SYSTEM_INSTRUCTION, ), pytest_helper.TestTableItem( name='test_count_tokens_with_tools', - exception_if_mldev='not supported', + exception_if_mldev='only supported in Gemini Enterprise Agent Platform mode', parameters=_COUNT_TOKENS_PARAMS_WITH_TOOLS, ), pytest_helper.TestTableItem( name='test_count_tokens_with_generation_config', - exception_if_mldev='not supported', + exception_if_mldev='only supported in Gemini Enterprise Agent Platform mode', parameters=_COUNT_TOKENS_PARAMS_WITH_GENERATION_CONFIG, ), ] diff --git a/google/genai/tests/models/test_edit_image.py b/google/genai/tests/models/test_edit_image.py index 0e7eaa10e..f255f225c 100644 --- a/google/genai/tests/models/test_edit_image.py +++ b/google/genai/tests/models/test_edit_image.py @@ -108,7 +108,7 @@ pytest_helper.TestTableItem( name='test_edit_mask_inpaint_insert', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types._EditImageParameters( model=CAPABILITY_MODEL_NAME, @@ -136,7 +136,7 @@ pytest_helper.TestTableItem( name='test_edit_mask_inpaint_insert_user_provided', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types._EditImageParameters( model=CAPABILITY_MODEL_NAME, @@ -153,7 +153,7 @@ pytest_helper.TestTableItem( name='test_edit_control_user_provided', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types._EditImageParameters( model=CAPABILITY_MODEL_NAME, @@ -169,7 +169,7 @@ pytest_helper.TestTableItem( name='test_edit_style_reference_image_customization', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types._EditImageParameters( model=CAPABILITY_MODEL_NAME, @@ -188,7 +188,7 @@ pytest_helper.TestTableItem( name='test_edit_subject_image_customization', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types._EditImageParameters( model=CAPABILITY_MODEL_NAME, @@ -207,7 +207,7 @@ pytest_helper.TestTableItem( name='test_edit_content_image_ingredients', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types._EditImageParameters( model='imagen-4.0-ingredients-preview', diff --git a/google/genai/tests/models/test_embed_content.py b/google/genai/tests/models/test_embed_content.py index 3b1864600..02cc81f71 100644 --- a/google/genai/tests/models/test_embed_content.py +++ b/google/genai/tests/models/test_embed_content.py @@ -61,7 +61,7 @@ def _get_bytes_from_file(relative_path: str) -> bytes: 'mime_type': 'text/plain', }, ), - exception_if_mldev='parameter is not supported', + exception_if_mldev='only supported in Gemini Enterprise Agent Platform mode', ), pytest_helper.TestTableItem( name='test_single_text_with_auto_truncate_not_supported_in_mldev', @@ -73,7 +73,7 @@ def _get_bytes_from_file(relative_path: str) -> bytes: 'auto_truncate': True, }, ), - exception_if_mldev='parameter is not supported', + exception_if_mldev='only supported in Gemini Enterprise Agent Platform mode', ), pytest_helper.TestTableItem( name='test_vertex_new_api_text_only_with_config', @@ -91,7 +91,7 @@ def _get_bytes_from_file(relative_path: str) -> bytes: }, ), # auto_truncate not supported on MLDev. - exception_if_mldev='parameter is not supported', + exception_if_mldev='only supported in Gemini Enterprise Agent Platform mode', ), pytest_helper.TestTableItem( name='test_new_api_text_only', @@ -194,7 +194,7 @@ def _get_bytes_from_file(relative_path: str) -> bytes: 'document_ocr': True, }, ), - exception_if_mldev='not supported in Gemini API', + exception_if_mldev='only supported in Gemini Enterprise Agent Platform mode', ), pytest_helper.TestTableItem( name='test_vertex_inline_video_audio_track_extraction', @@ -215,7 +215,7 @@ def _get_bytes_from_file(relative_path: str) -> bytes: 'audio_track_extraction': True, }, ), - exception_if_mldev='not supported in Gemini API', + exception_if_mldev='only supported in Gemini Enterprise Agent Platform mode', ), ] diff --git a/google/genai/tests/models/test_generate_content.py b/google/genai/tests/models/test_generate_content.py index dd4ab4d57..8b20d8c66 100644 --- a/google/genai/tests/models/test_generate_content.py +++ b/google/genai/tests/models/test_generate_content.py @@ -148,7 +148,7 @@ class InstrumentEnum(Enum): ), pytest_helper.TestTableItem( name='test_labels', - exception_if_mldev='not supported', + exception_if_mldev='only supported in Gemini Enterprise Agent Platform mode', parameters=types._GenerateContentParameters( model=GEMINI_FLASH_LATEST, contents=t.t_contents('What is your name?'), @@ -283,7 +283,7 @@ class InstrumentEnum(Enum): ] ), ), - exception_if_mldev='not supported in', + exception_if_mldev='is only supported in Gemini Enterprise Agent Platform mode', ), pytest_helper.TestTableItem( name='test_google_search_tool_with_blocking_confidence', @@ -300,7 +300,7 @@ class InstrumentEnum(Enum): ] ), ), - exception_if_mldev='not supported in', + exception_if_mldev='is only supported in Gemini Enterprise Agent Platform mode', ), pytest_helper.TestTableItem( name='test_enterprise_web_search_tool', @@ -315,7 +315,7 @@ class InstrumentEnum(Enum): ] ), ), - exception_if_mldev='not supported in', + exception_if_mldev='is only supported in Gemini Enterprise Agent Platform mode', ), pytest_helper.TestTableItem( name='test_enterprise_web_search_tool_with_exclude_domains', @@ -332,7 +332,7 @@ class InstrumentEnum(Enum): ] ), ), - exception_if_mldev='not supported in', + exception_if_mldev='is only supported in Gemini Enterprise Agent Platform mode', ), pytest_helper.TestTableItem( name='test_enterprise_web_search_tool_with_blocking_confidence', @@ -349,7 +349,7 @@ class InstrumentEnum(Enum): ] ), ), - exception_if_mldev='not supported in', + exception_if_mldev='is only supported in Gemini Enterprise Agent Platform mode', ), pytest_helper.TestTableItem( name='test_speech_with_config', @@ -478,7 +478,7 @@ class InstrumentEnum(Enum): ], config=types.GenerateContentConfig(audio_timestamp=True), ), - exception_if_mldev='not supported', + exception_if_mldev='is only supported in Gemini Enterprise Agent Platform mode', ), pytest_helper.TestTableItem( name='test_response_schema_with_default', @@ -540,7 +540,7 @@ class InstrumentEnum(Enum): 'enable_enhanced_civic_answers': True, }, ), - exception_if_vertex='not supported', + exception_if_vertex='is only supported in Gemini Developer API mode', ), pytest_helper.TestTableItem( name='test_model_armor_config', @@ -556,7 +556,7 @@ class InstrumentEnum(Enum): }, }, ), - exception_if_mldev='not supported', + exception_if_mldev='is only supported in Gemini Enterprise Agent Platform mode', ), pytest_helper.TestTableItem( name='test_service_tier', @@ -2153,7 +2153,10 @@ class Foo(BaseModel): response_schema=Foo, ), ) - assert 'additionalProperties is not supported in the Gemini API.' in str(e) + assert ( + 'additionalProperties is only supported in Gemini Enterprise Agent' + ' Platform mode' in str(e) + ) def test_function(client): diff --git a/google/genai/tests/models/test_generate_content_image_generation.py b/google/genai/tests/models/test_generate_content_image_generation.py index 9a9288018..5e943d18d 100644 --- a/google/genai/tests/models/test_generate_content_image_generation.py +++ b/google/genai/tests/models/test_generate_content_image_generation.py @@ -39,7 +39,7 @@ ), pytest_helper.TestTableItem( name='test_image_generation_config_output_mime_type', - exception_if_mldev='not supported in Gemini API', + exception_if_mldev='only supported in Gemini Enterprise Agent Platform mode', parameters=types._GenerateContentParameters( model='gemini-2.5-flash-image', contents=t.t_contents('A photorealistic red apple on a table.'), @@ -54,7 +54,7 @@ ), pytest_helper.TestTableItem( name='test_image_generation_config_output_compression_quality', - exception_if_mldev='not supported in Gemini API', + exception_if_mldev='only supported in Gemini Enterprise Agent Platform mode', parameters=types._GenerateContentParameters( model='gemini-2.5-flash-image', contents=t.t_contents('A photorealistic red apple on a table.'), diff --git a/google/genai/tests/models/test_generate_content_tools.py b/google/genai/tests/models/test_generate_content_tools.py index eb9c5c190..0693ad621 100644 --- a/google/genai/tests/models/test_generate_content_tools.py +++ b/google/genai/tests/models/test_generate_content_tools.py @@ -310,7 +310,7 @@ def divide_floats(a: float, b: float) -> float: }, ), exception_if_vertex=( - 'is not supported in Gemini Enterprise Agent Platform' + 'is only supported in Gemini Developer API mode' ), ), pytest_helper.TestTableItem( @@ -334,7 +334,7 @@ def divide_floats(a: float, b: float) -> float: ), exception_if_mldev='not exist', exception_if_vertex=( - 'is not supported in Gemini Enterprise Agent Platform' + 'is only supported in Gemini Developer API mode' ), ), pytest_helper.TestTableItem( @@ -358,7 +358,7 @@ def divide_floats(a: float, b: float) -> float: }, ), exception_if_vertex=( - 'is not supported in Gemini Enterprise Agent Platform' + 'is only supported in Gemini Developer API mode' ), ), pytest_helper.TestTableItem( @@ -383,7 +383,7 @@ def divide_floats(a: float, b: float) -> float: }, ), exception_if_vertex=( - 'is not supported in Gemini Enterprise Agent Platform' + 'is only supported in Gemini Developer API mode' ), ), pytest_helper.TestTableItem( @@ -628,7 +628,7 @@ def divide_floats(a: float, b: float) -> float: ), ), ), - exception_if_vertex='parameter is not supported', + exception_if_vertex='parameter is only supported in Gemini Developer API mode', ), pytest_helper.TestTableItem( name='test_include_server_side_tool_invocations_with_tool_call_echo', @@ -688,7 +688,7 @@ def divide_floats(a: float, b: float) -> float: ), ), ), - exception_if_vertex='parameter is not supported', + exception_if_vertex='parameter is only supported in Gemini Developer API mode', ), ] diff --git a/google/genai/tests/models/test_generate_images.py b/google/genai/tests/models/test_generate_images.py index 24e4cbc73..96a49fddb 100644 --- a/google/genai/tests/models/test_generate_images.py +++ b/google/genai/tests/models/test_generate_images.py @@ -37,7 +37,7 @@ ), pytest_helper.TestTableItem( name='test_all_vertexai_config_parameters', - exception_if_mldev='not supported in Gemini API', + exception_if_mldev='only supported in Gemini Enterprise Agent Platform mode', parameters=types._GenerateImagesParameters( model=IMAGEN_MODEL_LATEST, prompt='Red skateboard', @@ -64,7 +64,7 @@ ), pytest_helper.TestTableItem( name='test_all_vertexai_config_person_generation_enum_parameters', - exception_if_mldev='enum value is not supported', + exception_if_mldev='enum value is only supported in Gemini Enterprise Agent Platform mode', parameters=types._GenerateImagesParameters( model=IMAGEN_MODEL_LATEST, prompt='Robot holding a red skateboard', @@ -77,7 +77,7 @@ ), pytest_helper.TestTableItem( name='test_all_vertexai_config_person_generation_enum_parameters_2', - exception_if_mldev='enum value is not supported', + exception_if_mldev='enum value is only supported in Gemini Enterprise Agent Platform mode', parameters=types._GenerateImagesParameters( model=IMAGEN_MODEL_LATEST, prompt='Robot holding a red skateboard', @@ -90,7 +90,7 @@ ), pytest_helper.TestTableItem( name='test_all_vertexai_config_person_generation_enum_parameters_3', - exception_if_mldev='enum value is not supported', + exception_if_mldev='enum value is only supported in Gemini Enterprise Agent Platform mode', parameters=types._GenerateImagesParameters( model=IMAGEN_MODEL_LATEST, prompt='Robot holding a red skateboard', diff --git a/google/genai/tests/models/test_generate_videos.py b/google/genai/tests/models/test_generate_videos.py index 963029154..aa8a9b647 100644 --- a/google/genai/tests/models/test_generate_videos.py +++ b/google/genai/tests/models/test_generate_videos.py @@ -104,7 +104,7 @@ labels={"veo_label_key": "generate_videos"}, ), ), - exception_if_mldev="not supported in Gemini API", + exception_if_mldev="only supported in Gemini Enterprise Agent Platform mode", ), pytest_helper.TestTableItem( name="test_from_text_source", @@ -157,7 +157,7 @@ ), ), exception_if_mldev=( - "output_gcs_uri parameter is not supported in Gemini API" + "parameter is only supported in Gemini Enterprise Agent Platform mode" ), ), pytest_helper.TestTableItem( @@ -177,7 +177,7 @@ ), ), exception_if_mldev=( - "output_gcs_uri parameter is not supported in Gemini API" + "parameter is only supported in Gemini Enterprise Agent Platform mode" ), ), pytest_helper.TestTableItem( @@ -200,7 +200,7 @@ ), ), ), - exception_if_mldev="not supported in Gemini API", + exception_if_mldev="only supported in Gemini Enterprise Agent Platform mode", ), pytest_helper.TestTableItem( name="test_all_parameters_mldev", @@ -246,7 +246,7 @@ ), ), exception_if_mldev=( - "output_gcs_uri parameter is not supported in Gemini API" + "only supported in Gemini Enterprise Agent Platform mode" ), ), pytest_helper.TestTableItem( @@ -263,8 +263,7 @@ ), ), exception_if_vertex=( - "webhook_config parameter is not supported in Gemini Enterprise" - " Agent Platform" + "parameter is only supported in Gemini Developer API mode" ), ), pytest_helper.TestTableItem( @@ -280,8 +279,7 @@ }, ), exception_if_vertex=( - "webhook_config parameter is not supported in Gemini Enterprise" - " Agent Platform" + "parameter is only supported in Gemini Developer API mode" ), ), ] diff --git a/google/genai/tests/models/test_recontext_image.py b/google/genai/tests/models/test_recontext_image.py index c80c440c4..ac7d75897 100644 --- a/google/genai/tests/models/test_recontext_image.py +++ b/google/genai/tests/models/test_recontext_image.py @@ -35,7 +35,7 @@ pytest_helper.TestTableItem( name='test_virtual_try_on', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types._RecontextImageParameters( model=VIRTUAL_TRY_ON_IMAGE_MODEL_LATEST, @@ -52,7 +52,7 @@ pytest_helper.TestTableItem( name='test_virtual_try_on_all_config', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types._RecontextImageParameters( model=VIRTUAL_TRY_ON_IMAGE_MODEL_LATEST, diff --git a/google/genai/tests/models/test_segment_image.py b/google/genai/tests/models/test_segment_image.py index eccff1055..f061090c4 100644 --- a/google/genai/tests/models/test_segment_image.py +++ b/google/genai/tests/models/test_segment_image.py @@ -47,7 +47,7 @@ pytest_helper.TestTableItem( name='test_segment_foreground', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types._SegmentImageParameters( model=SEGMENT_IMAGE_MODEL_LATEST, @@ -67,7 +67,7 @@ pytest_helper.TestTableItem( name='test_segment_background', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types._SegmentImageParameters( model=SEGMENT_IMAGE_MODEL_LATEST, @@ -82,7 +82,7 @@ pytest_helper.TestTableItem( name='test_segment_prompt', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types._SegmentImageParameters( model=SEGMENT_IMAGE_MODEL_LATEST, @@ -98,7 +98,7 @@ pytest_helper.TestTableItem( name='test_segment_semantic', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types._SegmentImageParameters( model=SEGMENT_IMAGE_MODEL_LATEST, @@ -114,7 +114,7 @@ pytest_helper.TestTableItem( name='test_segment_interactive', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types._SegmentImageParameters( model=SEGMENT_IMAGE_MODEL_LATEST, diff --git a/google/genai/tests/models/test_upscale_image.py b/google/genai/tests/models/test_upscale_image.py index fde2329e1..cf9c9e4b7 100644 --- a/google/genai/tests/models/test_upscale_image.py +++ b/google/genai/tests/models/test_upscale_image.py @@ -34,7 +34,7 @@ pytest_helper.TestTableItem( name='test_upscale_no_config', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types.UpscaleImageParameters( model=IMAGEN_MODEL_LATEST, @@ -45,7 +45,7 @@ pytest_helper.TestTableItem( name='test_upscale', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types.UpscaleImageParameters( model=IMAGEN_MODEL_LATEST, @@ -66,7 +66,7 @@ pytest_helper.TestTableItem( name='test_upscale_gcs', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types.UpscaleImageParameters( model=IMAGEN_MODEL_LATEST, diff --git a/google/genai/tests/shared/batches/test_create_get_cancel.py b/google/genai/tests/shared/batches/test_create_get_cancel.py index 68e49bdd1..a7fcfee9c 100644 --- a/google/genai/tests/shared/batches/test_create_get_cancel.py +++ b/google/genai/tests/shared/batches/test_create_get_cancel.py @@ -42,7 +42,7 @@ def create_get_cancel(client, parameters): }] }], ), - exception_if_vertex="not supported in Gemini Enterprise Agent Platform", + exception_if_vertex="Exactly one of ", ), ] diff --git a/google/genai/tests/shared/files/test_list.py b/google/genai/tests/shared/files/test_list.py index 9fbcb9b97..18bbfedf2 100644 --- a/google/genai/tests/shared/files/test_list.py +++ b/google/genai/tests/shared/files/test_list.py @@ -27,7 +27,7 @@ page_size=2, ), ), - exception_if_vertex='only supported in the Gemini Developer client', + exception_if_vertex='only supported in Gemini Developer API mode', ), ] diff --git a/google/genai/tests/shared/models/test_compute_tokens.py b/google/genai/tests/shared/models/test_compute_tokens.py index 3338824ab..dcfd61d94 100644 --- a/google/genai/tests/shared/models/test_compute_tokens.py +++ b/google/genai/tests/shared/models/test_compute_tokens.py @@ -28,7 +28,7 @@ contents='The quick brown fox jumps over the lazy dog.', ), exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), ), ] diff --git a/google/genai/tests/shared/models/test_edit_image.py b/google/genai/tests/shared/models/test_edit_image.py index b454f379b..8d6db5e60 100644 --- a/google/genai/tests/shared/models/test_edit_image.py +++ b/google/genai/tests/shared/models/test_edit_image.py @@ -48,7 +48,7 @@ pytest_helper.TestTableItem( name='test_edit_mask_inpaint_insert', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types._EditImageParameters( model=CAPABILITY_MODEL_NAME, diff --git a/google/genai/tests/shared/models/test_recontext_image.py b/google/genai/tests/shared/models/test_recontext_image.py index 79c049b04..556f3fcfa 100644 --- a/google/genai/tests/shared/models/test_recontext_image.py +++ b/google/genai/tests/shared/models/test_recontext_image.py @@ -33,7 +33,7 @@ pytest_helper.TestTableItem( name='test_virtual_try_on', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types._RecontextImageParameters( model=VIRTUAL_TRY_ON_IMAGE_MODEL_LATEST, diff --git a/google/genai/tests/shared/models/test_segment_image.py b/google/genai/tests/shared/models/test_segment_image.py index 7266089b3..1d0245484 100644 --- a/google/genai/tests/shared/models/test_segment_image.py +++ b/google/genai/tests/shared/models/test_segment_image.py @@ -33,7 +33,7 @@ pytest_helper.TestTableItem( name='test_segment_background', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types._SegmentImageParameters( model=SEGMENT_IMAGE_MODEL_LATEST, diff --git a/google/genai/tests/shared/models/test_upscale_image.py b/google/genai/tests/shared/models/test_upscale_image.py index 647541bcf..676254d4e 100644 --- a/google/genai/tests/shared/models/test_upscale_image.py +++ b/google/genai/tests/shared/models/test_upscale_image.py @@ -30,7 +30,7 @@ pytest_helper.TestTableItem( name='test_upscale', exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), parameters=types.UpscaleImageParameters( model=IMAGEN_MODEL_LATEST, diff --git a/google/genai/tests/shared/tunings/test_create.py b/google/genai/tests/shared/tunings/test_create.py index 15ff32c2c..40320eb58 100644 --- a/google/genai/tests/shared/tunings/test_create.py +++ b/google/genai/tests/shared/tunings/test_create.py @@ -32,7 +32,7 @@ epoch_count=1, ), ), - exception_if_mldev='not supported in Gemini API.', + exception_if_mldev='only supported in Gemini Enterprise Agent Platform mode', ), ] diff --git a/google/genai/tests/shared/tunings/test_create_get_cancel.py b/google/genai/tests/shared/tunings/test_create_get_cancel.py index 7915505fe..399c26893 100644 --- a/google/genai/tests/shared/tunings/test_create_get_cancel.py +++ b/google/genai/tests/shared/tunings/test_create_get_cancel.py @@ -42,7 +42,7 @@ def create_get_cancel(client, parameters): epoch_count=1, ), ), - exception_if_mldev="not supported in Gemini API.", + exception_if_mldev="only supported in Gemini Enterprise Agent Platform mode", ), ] diff --git a/google/genai/tests/shared/tunings/test_list.py b/google/genai/tests/shared/tunings/test_list.py index 4c60ba740..0d5449524 100644 --- a/google/genai/tests/shared/tunings/test_list.py +++ b/google/genai/tests/shared/tunings/test_list.py @@ -27,7 +27,7 @@ config=genai_types.ListTuningJobsConfig(page_size=1) ), exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), ), ] diff --git a/google/genai/tests/transformers/test_schema.py b/google/genai/tests/transformers/test_schema.py index 8655a01cc..202bb679b 100644 --- a/google/genai/tests/transformers/test_schema.py +++ b/google/genai/tests/transformers/test_schema.py @@ -559,7 +559,7 @@ def test_process_schema_order_properties_propagates_into_additional_properties( _transformers.process_schema( schema, client, order_properties=order_properties ) - assert 'additionalProperties is not supported in the Gemini API.' in str(e) + assert 'additionalProperties is only supported in Gemini Enterprise Agent Platform mode' in str(e) @pytest.mark.parametrize( diff --git a/google/genai/tests/tunings/test_list.py b/google/genai/tests/tunings/test_list.py index f00d47088..71c8dd1a5 100644 --- a/google/genai/tests/tunings/test_list.py +++ b/google/genai/tests/tunings/test_list.py @@ -27,7 +27,7 @@ name='test_default', parameters=genai_types._ListTuningJobsParameters(), exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), ), pytest_helper.TestTableItem( @@ -36,7 +36,7 @@ config=genai_types.ListTuningJobsConfig(page_size=2) ), exception_if_mldev=( - 'only supported in the Gemini Enterprise Agent Platform' + 'only supported in Gemini Enterprise Agent Platform' ), ), ] diff --git a/google/genai/tests/tunings/test_tune.py b/google/genai/tests/tunings/test_tune.py index bede40986..b99d1a068 100755 --- a/google/genai/tests/tunings/test_tune.py +++ b/google/genai/tests/tunings/test_tune.py @@ -46,7 +46,7 @@ gcs_uri="gs://cloud-samples-data/ai-platform/generative_ai/gemini-1_5/text/sft_train_data.jsonl", ), ), - exception_if_mldev="gcs_uri parameter is not supported in Gemini API.", + exception_if_mldev="parameter is only supported in Gemini Enterprise Agent Platform mode", ), pytest_helper.TestTableItem( name="test_tune_pretuned_model", @@ -56,7 +56,7 @@ gcs_uri="gs://cloud-samples-data/ai-platform/generative_ai/gemini-2_0/text/sft_train_data.jsonl", ), ), - exception_if_mldev="is not supported in Gemini API", + exception_if_mldev="parameter is only supported in Gemini Enterprise Agent Platform mode", ), pytest_helper.TestTableItem( name="test_tune_pretuned_model_with_checkpoint_id", @@ -69,7 +69,7 @@ pre_tuned_model_checkpoint_id="3", ), ), - exception_if_mldev="is not supported in Gemini API", + exception_if_mldev="parameter is only supported in Gemini Enterprise Agent Platform mode", ), pytest_helper.TestTableItem( name="test_tune_simple_dpo", @@ -84,7 +84,7 @@ method="PREFERENCE_TUNING", ), ), - exception_if_mldev="parameter is not supported in Gemini API.", + exception_if_mldev="parameter is only supported in Gemini Enterprise Agent Platform mode", ), pytest_helper.TestTableItem( name="test_tune_dpo_with_beta", @@ -100,7 +100,7 @@ beta=0.5, ), ), - exception_if_mldev="parameter is not supported in Gemini API.", + exception_if_mldev="parameter is only supported in Gemini Enterprise Agent Platform mode", ), pytest_helper.TestTableItem( name="test_non_pretuned_model_with_checkpoint_id", @@ -113,7 +113,7 @@ pre_tuned_model_checkpoint_id="3", ), ), - exception_if_mldev="is not supported in Gemini API.", + exception_if_mldev="parameter is only supported in Gemini Enterprise Agent Platform mode", ), pytest_helper.TestTableItem( name="test_dataset_gcs_uri_all_parameters", @@ -132,7 +132,7 @@ ), ), ), - exception_if_mldev="gcs_uri parameter is not supported in Gemini API.", + exception_if_mldev="parameter is only supported in Gemini Enterprise Agent Platform mode", ), pytest_helper.TestTableItem( name="test_dataset_vertex_dataset_resource", @@ -142,7 +142,7 @@ vertex_dataset_resource="projects/801452371447/locations/us-central1/datasets/5779918772206829568", ), ), - exception_if_mldev="vertex_dataset_resource parameter is not supported in Gemini API.", + exception_if_mldev="parameter is only supported in Gemini Enterprise Agent Platform mode", ), pytest_helper.TestTableItem( name="test_dataset_dataset_resource_all_parameters", @@ -162,7 +162,7 @@ labels={"testlabelkey": "testlabelvalue"}, ), ), - exception_if_mldev="vertex_dataset_resource parameter is not supported in Gemini API.", + exception_if_mldev="parameter is only supported in Gemini Enterprise Agent Platform mode", ), pytest_helper.TestTableItem( name="test_tune_distillation", @@ -182,7 +182,7 @@ http_options=VERTEX_HTTP_OPTIONS, ), ), - exception_if_mldev="parameter is not supported in Gemini API.", + exception_if_mldev="parameter is only supported in Gemini Enterprise Agent Platform mode", ), pytest_helper.TestTableItem( name="test_tune_oss_sft", @@ -201,7 +201,7 @@ http_options=VERTEX_HTTP_OPTIONS, ), ), - exception_if_mldev="not supported in Gemini API", + exception_if_mldev="parameter is only supported in Gemini Enterprise Agent Platform mode", ), pytest_helper.TestTableItem( name="test_tune_oss_sft_hyperparams", @@ -222,7 +222,7 @@ http_options=VERTEX_HTTP_OPTIONS, ), ), - exception_if_mldev="not supported in Gemini API", + exception_if_mldev="parameter is only supported in Gemini Enterprise Agent Platform mode", ), pytest_helper.TestTableItem( name="test_tune_oss_distillation", @@ -243,7 +243,7 @@ http_options=VERTEX_HTTP_OPTIONS, ), ), - exception_if_mldev="not supported in Gemini API", + exception_if_mldev="parameter is only supported in Gemini Enterprise Agent Platform mode", ), pytest_helper.TestTableItem( name="test_tune_oss_distillation_hyperparams", @@ -262,7 +262,7 @@ http_options=VERTEX_HTTP_OPTIONS, ), ), - exception_if_mldev="not supported in Gemini API", + exception_if_mldev="parameter is only supported in Gemini Enterprise Agent Platform mode", ), pytest_helper.TestTableItem( name="test_tune_encryption_spec", @@ -277,7 +277,7 @@ ), ), ), - exception_if_mldev="not supported in Gemini API", + exception_if_mldev="parameter is only supported in Gemini Enterprise Agent Platform mode", ), ] diff --git a/google/genai/tunings.py b/google/genai/tunings.py index d72af4d00..a2838125d 100644 --- a/google/genai/tunings.py +++ b/google/genai/tunings.py @@ -146,7 +146,8 @@ def _CreateTuningJobConfig_to_mldev( if getv(from_object, ['validation_dataset']) is not None: raise ValueError( - 'validation_dataset parameter is not supported in Gemini API.' + 'validation_dataset parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['tuned_model_display_name']) is not None: @@ -157,7 +158,10 @@ def _CreateTuningJobConfig_to_mldev( ) if getv(from_object, ['description']) is not None: - raise ValueError('description parameter is not supported in Gemini API.') + raise ValueError( + 'description parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['epoch_count']) is not None: setv( @@ -175,24 +179,32 @@ def _CreateTuningJobConfig_to_mldev( if getv(from_object, ['export_last_checkpoint_only']) is not None: raise ValueError( - 'export_last_checkpoint_only parameter is not supported in Gemini API.' + 'export_last_checkpoint_only parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['pre_tuned_model_checkpoint_id']) is not None: raise ValueError( - 'pre_tuned_model_checkpoint_id parameter is not supported in Gemini' - ' API.' + 'pre_tuned_model_checkpoint_id parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['adapter_size']) is not None: - raise ValueError('adapter_size parameter is not supported in Gemini API.') + raise ValueError( + 'adapter_size parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['tuning_mode']) is not None: - raise ValueError('tuning_mode parameter is not supported in Gemini API.') + raise ValueError( + 'tuning_mode parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['custom_base_model']) is not None: raise ValueError( - 'custom_base_model parameter is not supported in Gemini API.' + 'custom_base_model parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['batch_size']) is not None: @@ -211,36 +223,50 @@ def _CreateTuningJobConfig_to_mldev( if getv(from_object, ['evaluation_config']) is not None: raise ValueError( - 'evaluation_config parameter is not supported in Gemini API.' + 'evaluation_config parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['labels']) is not None: - raise ValueError('labels parameter is not supported in Gemini API.') + raise ValueError( + 'labels parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['beta']) is not None: - raise ValueError('beta parameter is not supported in Gemini API.') + raise ValueError( + 'beta parameter is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['base_teacher_model']) is not None: raise ValueError( - 'base_teacher_model parameter is not supported in Gemini API.' + 'base_teacher_model parameter is only supported in Gemini Enterprise' + ' Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['tuned_teacher_model_source']) is not None: raise ValueError( - 'tuned_teacher_model_source parameter is not supported in Gemini API.' + 'tuned_teacher_model_source parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['sft_loss_weight_multiplier']) is not None: raise ValueError( - 'sft_loss_weight_multiplier parameter is not supported in Gemini API.' + 'sft_loss_weight_multiplier parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['output_uri']) is not None: - raise ValueError('output_uri parameter is not supported in Gemini API.') + raise ValueError( + 'output_uri parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['encryption_spec']) is not None: raise ValueError( - 'encryption_spec parameter is not supported in Gemini API.' + 'encryption_spec parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' ) return to_object @@ -877,8 +903,8 @@ def _GenerationConfig_to_vertex( if getv(from_object, ['enable_enhanced_civic_answers']) is not None: raise ValueError( - 'enable_enhanced_civic_answers parameter is not supported in Gemini' - ' Enterprise Agent Platform.' + 'enable_enhanced_civic_answers parameter is only supported in Gemini' + ' Developer API mode, not in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -1011,14 +1037,14 @@ def _ReplicatedVoiceConfig_to_vertex( if getv(from_object, ['consent_audio']) is not None: raise ValueError( - 'consent_audio parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'consent_audio parameter is only supported in Gemini Developer API' + ' mode, not in Gemini Enterprise Agent Platform mode.' ) if getv(from_object, ['voice_consent_signature']) is not None: raise ValueError( - 'voice_consent_signature parameter is not supported in Gemini' - ' Enterprise Agent Platform.' + 'voice_consent_signature parameter is only supported in Gemini' + ' Developer API mode, not in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -1099,11 +1125,15 @@ def _TuningDataset_to_mldev( ) -> dict[str, Any]: to_object: dict[str, Any] = {} if getv(from_object, ['gcs_uri']) is not None: - raise ValueError('gcs_uri parameter is not supported in Gemini API.') + raise ValueError( + 'gcs_uri parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) if getv(from_object, ['vertex_dataset_resource']) is not None: raise ValueError( - 'vertex_dataset_resource parameter is not supported in Gemini API.' + 'vertex_dataset_resource parameter is only supported in Gemini' + ' Enterprise Agent Platform mode, not in Gemini Developer API mode.' ) if getv(from_object, ['examples']) is not None: @@ -1175,8 +1205,8 @@ def _TuningDataset_to_vertex( if getv(from_object, ['examples']) is not None: raise ValueError( - 'examples parameter is not supported in Gemini Enterprise Agent' - ' Platform.' + 'examples parameter is only supported in Gemini Developer API mode, not' + ' in Gemini Enterprise Agent Platform mode.' ) return to_object @@ -1576,8 +1606,8 @@ def _list( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _ListTuningJobsParameters_to_vertex( @@ -1760,8 +1790,8 @@ def _tune( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _CreateTuningJobParametersPrivate_to_vertex( @@ -1853,7 +1883,8 @@ def _tune_mldev( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _CreateTuningJobParametersPrivate_to_mldev( @@ -2153,8 +2184,8 @@ async def _list( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _ListTuningJobsParameters_to_vertex( @@ -2339,8 +2370,8 @@ async def _tune( request_url_dict: Optional[dict[str, str]] if not self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Enterprise Agent' - ' Platform (previously known as Vertex AI) client.' + 'This method is only supported in Gemini Enterprise Agent Platform' + ' mode, not in Gemini Developer API mode.' ) else: request_dict = _CreateTuningJobParametersPrivate_to_vertex( @@ -2432,7 +2463,8 @@ async def _tune_mldev( request_url_dict: Optional[dict[str, str]] if self._api_client.vertexai: raise ValueError( - 'This method is only supported in the Gemini Developer client.' + 'This method is only supported in Gemini Developer API mode, not in' + ' Gemini Enterprise Agent Platform mode.' ) else: request_dict = _CreateTuningJobParametersPrivate_to_mldev(