diff --git a/google/genai/tests/models/test_generate_content.py b/google/genai/tests/models/test_generate_content.py index fcf8aed5b..ae64eb89f 100644 --- a/google/genai/tests/models/test_generate_content.py +++ b/google/genai/tests/models/test_generate_content.py @@ -148,7 +148,9 @@ class InstrumentEnum(Enum): ), pytest_helper.TestTableItem( name='test_labels', - exception_if_mldev='only supported in Gemini Enterprise Agent Platform mode', + 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 +285,9 @@ class InstrumentEnum(Enum): ] ), ), - exception_if_mldev='is only supported in Gemini Enterprise Agent Platform mode', + 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 +304,9 @@ class InstrumentEnum(Enum): ] ), ), - exception_if_mldev='is only supported in Gemini Enterprise Agent Platform mode', + exception_if_mldev=( + 'is only supported in Gemini Enterprise Agent Platform mode' + ), ), pytest_helper.TestTableItem( name='test_enterprise_web_search_tool', @@ -315,7 +321,9 @@ class InstrumentEnum(Enum): ] ), ), - exception_if_mldev='is only supported in Gemini Enterprise Agent Platform mode', + 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 +340,9 @@ class InstrumentEnum(Enum): ] ), ), - exception_if_mldev='is only supported in Gemini Enterprise Agent Platform mode', + 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 +359,9 @@ class InstrumentEnum(Enum): ] ), ), - exception_if_mldev='is only supported in Gemini Enterprise Agent Platform mode', + exception_if_mldev=( + 'is only supported in Gemini Enterprise Agent Platform mode' + ), ), pytest_helper.TestTableItem( name='test_speech_with_config', @@ -478,7 +490,9 @@ class InstrumentEnum(Enum): ], config=types.GenerateContentConfig(audio_timestamp=True), ), - exception_if_mldev='is only supported in Gemini Enterprise Agent Platform mode', + exception_if_mldev=( + 'is only supported in Gemini Enterprise Agent Platform mode' + ), ), pytest_helper.TestTableItem( name='test_response_schema_with_default', @@ -556,7 +570,9 @@ class InstrumentEnum(Enum): }, }, ), - exception_if_mldev='is only supported in Gemini Enterprise Agent Platform mode', + exception_if_mldev=( + 'is only supported in Gemini Enterprise Agent Platform mode' + ), ), pytest_helper.TestTableItem( name='test_service_tier', @@ -580,6 +596,27 @@ class InstrumentEnum(Enum): ), exception_if_vertex='400', ), + pytest_helper.TestTableItem( + name='test_audio_transcription_config', + parameters=types._GenerateContentParameters( + model='gemini-2.5-flash-preview-tts', + contents=t.t_contents('Produce a speech response saying "Cheese"'), + config=types.GenerateContentConfig( + response_modalities=['audio'], + speech_config=types.SpeechConfig( + voice_config=types.VoiceConfig( + prebuilt_voice_config=types.PrebuiltVoiceConfig( + voice_name='charon' + ) + ) + ), + audio_transcription_config=types.AudioTranscriptionConfig( + diarization=True, + word_timestamp=True, + ), + ), + ), + ), ] pytestmark = pytest_helper.setup( @@ -2583,3 +2620,22 @@ def test_response_json_schema_with_one_of(client): assert resource_config['size'] == 10 assert 'tier' not in resource_config assert set(resource_config.keys()) == {'size'} + + +def test_audio_wav_input(client): + + response = client.models.generate_content( + model='gemini-2.5-flash-preview-tts', + contents=[ + 'What is this audio about?', + types.Part.from_bytes(data=audio_bytes, mime_type='audio/wav'), + ], + config=types.GenerateContentConfig( + audio_transcription_config=types.AudioTranscriptionConfig( + diarization=True, + word_timestamp=True, + language_auto={}, + ), + ), + ) + assert response.text is not None