From f5b220388428a8161908bed824daa9f28dbd67ba Mon Sep 17 00:00:00 2001 From: liangming Date: Sun, 23 Aug 2026 14:37:12 +0800 Subject: [PATCH] Restore audio transcription mode configuration --- google/genai/tests/types/test_types.py | 8 +++++++- google/genai/types.py | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/google/genai/tests/types/test_types.py b/google/genai/tests/types/test_types.py index 50a3f9058..eae8dffdf 100644 --- a/google/genai/tests/types/test_types.py +++ b/google/genai/tests/types/test_types.py @@ -46,6 +46,13 @@ class SubFunctionResponsePart(types.FunctionResponsePart): pass +def test_audio_transcription_config_mode(): + config = types.AudioTranscriptionConfig(mode='smart') + + assert config.mode == types.AudioTranscriptionConfigMode.SMART + assert config.model_dump(by_alias=True, exclude_none=True)['mode'] == 'SMART' + + def test_factory_method_from_uri_part(): my_part = SubPart.from_uri( @@ -2969,4 +2976,3 @@ def test_computer_use_types(): assert c.enable_prompt_injection_detection is True assert len(c.disabled_safety_policies) == 2 assert types.SafetyPolicy.FINANCIAL_TRANSACTIONS in c.disabled_safety_policies - diff --git a/google/genai/types.py b/google/genai/types.py index 0cbf8f5eb..9243603a7 100644 --- a/google/genai/types.py +++ b/google/genai/types.py @@ -6338,6 +6338,15 @@ class LanguageHintsDict(TypedDict, total=False): LanguageHintsOrDict = Union[LanguageHints, LanguageHintsDict] +class AudioTranscriptionConfigMode(_common.CaseInSensitiveEnum): + """Controls the level of detail returned by audio transcription.""" + + VERBATIM = 'VERBATIM' + """Returns a verbatim transcription.""" + SMART = 'SMART' + """Returns a cleaned-up transcription.""" + + class AudioTranscriptionConfig(_common.BaseModel): """The audio transcription configuration in Setup.""" @@ -6371,6 +6380,10 @@ class AudioTranscriptionConfig(_common.BaseModel): description="""Configures speaker diarization. """, ) + mode: Optional[AudioTranscriptionConfigMode] = Field( + default=None, + description="""Controls the level of detail returned by audio transcription.""", + ) class AudioTranscriptionConfigDict(TypedDict, total=False): @@ -6399,6 +6412,9 @@ class AudioTranscriptionConfigDict(TypedDict, total=False): """Configures speaker diarization. """ + mode: Optional[AudioTranscriptionConfigMode] + """Controls the level of detail returned by audio transcription.""" + AudioTranscriptionConfigOrDict = Union[ AudioTranscriptionConfig, AudioTranscriptionConfigDict