Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 64 additions & 8 deletions google/genai/tests/models/test_generate_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -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?'),
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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(
Expand Down Expand Up @@ -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
Loading