diff --git a/google/genai/_live_converters.py b/google/genai/_live_converters.py index d0241225a..f5067f26f 100644 --- a/google/genai/_live_converters.py +++ b/google/genai/_live_converters.py @@ -47,6 +47,12 @@ def _AudioTranscriptionConfig_to_mldev( getv(from_object, ['adaptation_phrases']), ) + if getv(from_object, ['word_timestamp']) is not None: + setv(to_object, ['wordTimestamp'], getv(from_object, ['word_timestamp'])) + + if getv(from_object, ['diarization']) is not None: + setv(to_object, ['diarization'], getv(from_object, ['diarization'])) + return to_object @@ -409,6 +415,13 @@ def _GenerationConfig_to_vertex( ' mode, not in Gemini Enterprise Agent Platform mode.' ) + if getv(from_object, ['audio_transcription_config']) is not None: + setv( + to_object, + ['audioTranscriptionConfig'], + getv(from_object, ['audio_transcription_config']), + ) + return to_object @@ -1689,6 +1702,13 @@ def _Part_to_mldev( if getv(from_object, ['part_metadata']) is not None: setv(to_object, ['partMetadata'], getv(from_object, ['part_metadata'])) + if getv(from_object, ['audio_transcription']) is not None: + setv( + to_object, + ['audioTranscription'], + getv(from_object, ['audio_transcription']), + ) + return to_object @@ -1770,6 +1790,13 @@ def _Part_to_vertex( ' mode, not in Gemini Enterprise Agent Platform mode.' ) + if getv(from_object, ['audio_transcription']) is not None: + setv( + to_object, + ['audioTranscription'], + getv(from_object, ['audio_transcription']), + ) + return to_object diff --git a/google/genai/_tokens_converters.py b/google/genai/_tokens_converters.py index 3abec3e53..cabbb800c 100644 --- a/google/genai/_tokens_converters.py +++ b/google/genai/_tokens_converters.py @@ -47,6 +47,12 @@ def _AudioTranscriptionConfig_to_mldev( getv(from_object, ['adaptation_phrases']), ) + if getv(from_object, ['word_timestamp']) is not None: + setv(to_object, ['wordTimestamp'], getv(from_object, ['word_timestamp'])) + + if getv(from_object, ['diarization']) is not None: + setv(to_object, ['diarization'], getv(from_object, ['diarization'])) + return to_object @@ -595,6 +601,13 @@ def _Part_to_mldev( if getv(from_object, ['part_metadata']) is not None: setv(to_object, ['partMetadata'], getv(from_object, ['part_metadata'])) + if getv(from_object, ['audio_transcription']) is not None: + setv( + to_object, + ['audioTranscription'], + getv(from_object, ['audio_transcription']), + ) + return to_object diff --git a/google/genai/batches.py b/google/genai/batches.py index aa4dd36ee..dd905604b 100644 --- a/google/genai/batches.py +++ b/google/genai/batches.py @@ -34,6 +34,39 @@ logger = logging.getLogger('google_genai.batches') +def _AudioTranscriptionConfig_to_mldev( + from_object: Union[dict[str, Any], object], + parent_object: Optional[dict[str, Any]] = None, +) -> dict[str, Any]: + to_object: dict[str, Any] = {} + if getv(from_object, ['language_codes']) is not None: + raise ValueError( + 'language_codes parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) + + if getv(from_object, ['language_auto']) is not None: + setv(to_object, ['languageAuto'], getv(from_object, ['language_auto'])) + + if getv(from_object, ['language_hints']) is not None: + setv(to_object, ['languageHints'], getv(from_object, ['language_hints'])) + + if getv(from_object, ['adaptation_phrases']) is not None: + setv( + to_object, + ['adaptationPhrases'], + getv(from_object, ['adaptation_phrases']), + ) + + if getv(from_object, ['word_timestamp']) is not None: + setv(to_object, ['wordTimestamp'], getv(from_object, ['word_timestamp'])) + + if getv(from_object, ['diarization']) is not None: + setv(to_object, ['diarization'], getv(from_object, ['diarization'])) + + return to_object + + def _AuthConfig_to_mldev( from_object: Union[dict[str, Any], object], parent_object: Optional[dict[str, Any]] = None, @@ -1182,6 +1215,15 @@ def _GenerateContentConfig_to_mldev( if getv(from_object, ['service_tier']) is not None: setv(parent_object, ['serviceTier'], getv(from_object, ['service_tier'])) + if getv(from_object, ['audio_transcription_config']) is not None: + setv( + to_object, + ['audioTranscriptionConfig'], + _AudioTranscriptionConfig_to_mldev( + getv(from_object, ['audio_transcription_config']), to_object + ), + ) + return to_object @@ -1606,6 +1648,13 @@ def _Part_to_mldev( if getv(from_object, ['part_metadata']) is not None: setv(to_object, ['partMetadata'], getv(from_object, ['part_metadata'])) + if getv(from_object, ['audio_transcription']) is not None: + setv( + to_object, + ['audioTranscription'], + getv(from_object, ['audio_transcription']), + ) + return to_object diff --git a/google/genai/caches.py b/google/genai/caches.py index 9c441447e..d10fc2e27 100644 --- a/google/genai/caches.py +++ b/google/genai/caches.py @@ -789,6 +789,13 @@ def _Part_to_mldev( if getv(from_object, ['part_metadata']) is not None: setv(to_object, ['partMetadata'], getv(from_object, ['part_metadata'])) + if getv(from_object, ['audio_transcription']) is not None: + setv( + to_object, + ['audioTranscription'], + getv(from_object, ['audio_transcription']), + ) + return to_object @@ -870,6 +877,13 @@ def _Part_to_vertex( ' mode, not in Gemini Enterprise Agent Platform mode.' ) + if getv(from_object, ['audio_transcription']) is not None: + setv( + to_object, + ['audioTranscription'], + getv(from_object, ['audio_transcription']), + ) + return to_object diff --git a/google/genai/models.py b/google/genai/models.py index 69151333a..cd02f27d2 100644 --- a/google/genai/models.py +++ b/google/genai/models.py @@ -64,6 +64,40 @@ def _VideoGenerationReferenceType_to_mldev_enum_validate( ) +def _AudioTranscriptionConfig_to_mldev( + from_object: Union[dict[str, Any], object], + parent_object: Optional[dict[str, Any]] = None, + root_object: Optional[Union[dict[str, Any], object]] = None, +) -> dict[str, Any]: + to_object: dict[str, Any] = {} + if getv(from_object, ['language_codes']) is not None: + raise ValueError( + 'language_codes parameter is only supported in Gemini Enterprise Agent' + ' Platform mode, not in Gemini Developer API mode.' + ) + + if getv(from_object, ['language_auto']) is not None: + setv(to_object, ['languageAuto'], getv(from_object, ['language_auto'])) + + if getv(from_object, ['language_hints']) is not None: + setv(to_object, ['languageHints'], getv(from_object, ['language_hints'])) + + if getv(from_object, ['adaptation_phrases']) is not None: + setv( + to_object, + ['adaptationPhrases'], + getv(from_object, ['adaptation_phrases']), + ) + + if getv(from_object, ['word_timestamp']) is not None: + setv(to_object, ['wordTimestamp'], getv(from_object, ['word_timestamp'])) + + if getv(from_object, ['diarization']) is not None: + setv(to_object, ['diarization'], getv(from_object, ['diarization'])) + + return to_object + + def _AuthConfig_to_mldev( from_object: Union[dict[str, Any], object], parent_object: Optional[dict[str, Any]] = None, @@ -1453,6 +1487,17 @@ def _GenerateContentConfig_to_mldev( if getv(from_object, ['service_tier']) is not None: setv(parent_object, ['serviceTier'], getv(from_object, ['service_tier'])) + if getv(from_object, ['audio_transcription_config']) is not None: + setv( + to_object, + ['audioTranscriptionConfig'], + _AudioTranscriptionConfig_to_mldev( + getv(from_object, ['audio_transcription_config']), + to_object, + root_object, + ), + ) + return to_object @@ -1643,6 +1688,13 @@ def _GenerateContentConfig_to_vertex( if getv(from_object, ['service_tier']) is not None: setv(parent_object, ['serviceTier'], getv(from_object, ['service_tier'])) + if getv(from_object, ['audio_transcription_config']) is not None: + setv( + to_object, + ['audioTranscriptionConfig'], + getv(from_object, ['audio_transcription_config']), + ) + return to_object @@ -2990,6 +3042,13 @@ def _GenerationConfig_to_vertex( ' mode, not in Gemini Enterprise Agent Platform mode.' ) + if getv(from_object, ['audio_transcription_config']) is not None: + setv( + to_object, + ['audioTranscriptionConfig'], + getv(from_object, ['audio_transcription_config']), + ) + return to_object @@ -3664,6 +3723,13 @@ def _Part_to_mldev( if getv(from_object, ['part_metadata']) is not None: setv(to_object, ['partMetadata'], getv(from_object, ['part_metadata'])) + if getv(from_object, ['audio_transcription']) is not None: + setv( + to_object, + ['audioTranscription'], + getv(from_object, ['audio_transcription']), + ) + return to_object @@ -3746,6 +3812,13 @@ def _Part_to_vertex( ' mode, not in Gemini Enterprise Agent Platform mode.' ) + if getv(from_object, ['audio_transcription']) is not None: + setv( + to_object, + ['audioTranscription'], + getv(from_object, ['audio_transcription']), + ) + return to_object diff --git a/google/genai/tests/models/test_generate_content.py b/google/genai/tests/models/test_generate_content.py index fcf8aed5b..16c7dc70a 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( diff --git a/google/genai/tunings.py b/google/genai/tunings.py index 8709df040..f41b89e17 100644 --- a/google/genai/tunings.py +++ b/google/genai/tunings.py @@ -1242,6 +1242,13 @@ def _GenerationConfig_from_vertex( [item for item in getv(from_object, ['responseFormat'])], ) + if getv(from_object, ['audioTranscriptionConfig']) is not None: + setv( + to_object, + ['audio_transcription_config'], + getv(from_object, ['audioTranscriptionConfig']), + ) + return to_object @@ -1376,6 +1383,13 @@ def _GenerationConfig_to_vertex( ' mode, not in Gemini Enterprise Agent Platform mode.' ) + if getv(from_object, ['audio_transcription_config']) is not None: + setv( + to_object, + ['audioTranscriptionConfig'], + getv(from_object, ['audio_transcription_config']), + ) + return to_object @@ -1567,6 +1581,13 @@ def _Part_to_vertex( ' mode, not in Gemini Enterprise Agent Platform mode.' ) + if getv(from_object, ['audio_transcription']) is not None: + setv( + to_object, + ['audioTranscription'], + getv(from_object, ['audio_transcription']), + ) + return to_object diff --git a/google/genai/types.py b/google/genai/types.py index 611c82d0a..c7f70914d 100644 --- a/google/genai/types.py +++ b/google/genai/types.py @@ -2083,6 +2083,95 @@ class VideoMetadataDict(TypedDict, total=False): VideoMetadataOrDict = Union[VideoMetadata, VideoMetadataDict] +class WordInfo(_common.BaseModel): + """Information about a single recognized word.""" + + word: Optional[str] = Field( + default=None, + description="""Transcript of the word. + """, + ) + start_offset: Optional[str] = Field( + default=None, + description="""Start offset in time of the word relative to the start of the audio. + """, + ) + end_offset: Optional[str] = Field( + default=None, + description="""End offset in time of the word relative to the start of the audio. + """, + ) + + +class WordInfoDict(TypedDict, total=False): + """Information about a single recognized word.""" + + word: Optional[str] + """Transcript of the word. + """ + + start_offset: Optional[str] + """Start offset in time of the word relative to the start of the audio. + """ + + end_offset: Optional[str] + """End offset in time of the word relative to the start of the audio. + """ + + +WordInfoOrDict = Union[WordInfo, WordInfoDict] + + +class Transcription(_common.BaseModel): + """Audio transcription in Server Content.""" + + text: Optional[str] = Field( + default=None, description="""Optional. Transcription text.""" + ) + finished: Optional[bool] = Field( + default=None, + description="""Optional. The bool indicates the end of the transcription.""", + ) + language_code: Optional[str] = Field( + default=None, + description="""The BCP-47 language code of the transcription.""", + ) + speaker_label: Optional[str] = Field( + default=None, + description="""A label identifying the speaker of this audio segment (e.g. "spk_1", "spk_2"). + """, + ) + words: Optional[list[WordInfo]] = Field( + default=None, + description="""Detailed word-level transcriptions and timing details. + """, + ) + + +class TranscriptionDict(TypedDict, total=False): + """Audio transcription in Server Content.""" + + text: Optional[str] + """Optional. Transcription text.""" + + finished: Optional[bool] + """Optional. The bool indicates the end of the transcription.""" + + language_code: Optional[str] + """The BCP-47 language code of the transcription.""" + + speaker_label: Optional[str] + """A label identifying the speaker of this audio segment (e.g. "spk_1", "spk_2"). + """ + + words: Optional[list[WordInfoDict]] + """Detailed word-level transcriptions and timing details. + """ + + +TranscriptionOrDict = Union[Transcription, TranscriptionDict] + + class Part(_common.BaseModel): """A datatype containing media content. @@ -2148,6 +2237,10 @@ class Part(_common.BaseModel): default=None, description="""Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part streams. This field is not supported in Vertex AI.""", ) + audio_transcription: Optional[Transcription] = Field( + default=None, + description="""Output only. The transcription of the audio part.""", + ) def __init__( self, @@ -2379,6 +2472,9 @@ class PartDict(TypedDict, total=False): part_metadata: Optional[dict[str, Any]] """Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part streams. This field is not supported in Vertex AI.""" + audio_transcription: Optional[TranscriptionDict] + """Output only. The transcription of the audio part.""" + PartOrDict = Union[Part, PartDict] @@ -6015,6 +6111,100 @@ class ModelArmorConfigDict(TypedDict, total=False): ModelArmorConfigOrDict = Union[ModelArmorConfig, ModelArmorConfigDict] +class LanguageAuto(_common.BaseModel): + """Indicates the language of the audio should be automatically detected.""" + + pass + + +class LanguageAutoDict(TypedDict, total=False): + """Indicates the language of the audio should be automatically detected.""" + + pass + + +LanguageAutoOrDict = Union[LanguageAuto, LanguageAutoDict] + + +class LanguageHints(_common.BaseModel): + """Provides hints to the model about possible languages present in the audio.""" + + language_codes: Optional[list[str]] = Field( + default=None, + description="""BCP-47 language codes. At least one must be specified.""", + ) + + +class LanguageHintsDict(TypedDict, total=False): + """Provides hints to the model about possible languages present in the audio.""" + + language_codes: Optional[list[str]] + """BCP-47 language codes. At least one must be specified.""" + + +LanguageHintsOrDict = Union[LanguageHints, LanguageHintsDict] + + +class AudioTranscriptionConfig(_common.BaseModel): + """The audio transcription configuration in Setup.""" + + language_codes: Optional[list[str]] = Field( + default=None, + description="""Deprecated: use LanguageAuto or LanguageHints instead.""", + ) + language_auto: Optional[LanguageAuto] = Field( + default=None, + description="""The model will detect the language automatically. Do not use together with LanguageHints.""", + ) + language_hints: Optional[LanguageHints] = Field( + default=None, + description="""Specifies one or more languages in the audio. Do not use together with LanguageAuto.""", + ) + adaptation_phrases: Optional[list[str]] = Field( + default=None, + description="""A list of phrases used for speech adaptation, which biases the ASR model to improve recognition of these specific terms.""", + ) + word_timestamp: Optional[bool] = Field( + default=None, + description="""Configures word-level timestamp generation. + """, + ) + diarization: Optional[bool] = Field( + default=None, + description="""Configures speaker diarization. + """, + ) + + +class AudioTranscriptionConfigDict(TypedDict, total=False): + """The audio transcription configuration in Setup.""" + + language_codes: Optional[list[str]] + """Deprecated: use LanguageAuto or LanguageHints instead.""" + + language_auto: Optional[LanguageAutoDict] + """The model will detect the language automatically. Do not use together with LanguageHints.""" + + language_hints: Optional[LanguageHintsDict] + """Specifies one or more languages in the audio. Do not use together with LanguageAuto.""" + + adaptation_phrases: Optional[list[str]] + """A list of phrases used for speech adaptation, which biases the ASR model to improve recognition of these specific terms.""" + + word_timestamp: Optional[bool] + """Configures word-level timestamp generation. + """ + + diarization: Optional[bool] + """Configures speaker diarization. + """ + + +AudioTranscriptionConfigOrDict = Union[ + AudioTranscriptionConfig, AudioTranscriptionConfigDict +] + + class GenerateContentConfig(_common.BaseModel): """Optional model configuration parameters. @@ -6240,6 +6430,11 @@ class GenerateContentConfig(_common.BaseModel): default=None, description="""The service tier to use for the request. For example, ServiceTier.FLEX.""", ) + audio_transcription_config: Optional[AudioTranscriptionConfig] = Field( + default=None, + description="""Optional. Configuration for audio transcription (speech recognition). + """, + ) @pydantic.field_validator('response_schema', mode='before') @classmethod @@ -6457,6 +6652,10 @@ class GenerateContentConfigDict(TypedDict, total=False): service_tier: Optional[ServiceTier] """The service tier to use for the request. For example, ServiceTier.FLEX.""" + audio_transcription_config: Optional[AudioTranscriptionConfigDict] + """Optional. Configuration for audio transcription (speech recognition). + """ + GenerateContentConfigOrDict = Union[ GenerateContentConfig, GenerateContentConfigDict @@ -11073,6 +11272,11 @@ class GenerationConfig(_common.BaseModel): default=None, description="""Optional. Config for translation. This field is not supported in Vertex AI.""", ) + audio_transcription_config: Optional[AudioTranscriptionConfig] = Field( + default=None, + description="""Optional. Configuration for audio transcription (speech recognition). + """, + ) class GenerationConfigDict(TypedDict, total=False): @@ -11155,6 +11359,10 @@ class GenerationConfigDict(TypedDict, total=False): translation_config: Optional[TranslationConfigDict] """Optional. Config for translation. This field is not supported in Vertex AI.""" + audio_transcription_config: Optional[AudioTranscriptionConfigDict] + """Optional. Configuration for audio transcription (speech recognition). + """ + GenerationConfigOrDict = Union[GenerationConfig, GenerationConfigDict] @@ -19837,38 +20045,6 @@ class LiveServerSetupCompleteDict(TypedDict, total=False): ] -class Transcription(_common.BaseModel): - """Audio transcription in Server Content.""" - - text: Optional[str] = Field( - default=None, description="""Optional. Transcription text.""" - ) - finished: Optional[bool] = Field( - default=None, - description="""Optional. The bool indicates the end of the transcription.""", - ) - language_code: Optional[str] = Field( - default=None, - description="""The BCP-47 language code of the transcription.""", - ) - - -class TranscriptionDict(TypedDict, total=False): - """Audio transcription in Server Content.""" - - text: Optional[str] - """Optional. Transcription text.""" - - finished: Optional[bool] - """Optional. The bool indicates the end of the transcription.""" - - language_code: Optional[str] - """The BCP-47 language code of the transcription.""" - - -TranscriptionOrDict = Union[Transcription, TranscriptionDict] - - class LiveServerContent(_common.BaseModel): """Incremental server update generated by the model in response to client messages. @@ -20492,82 +20668,6 @@ class ContextWindowCompressionConfigDict(TypedDict, total=False): ] -class LanguageAuto(_common.BaseModel): - """Indicates the language of the audio should be automatically detected.""" - - pass - - -class LanguageAutoDict(TypedDict, total=False): - """Indicates the language of the audio should be automatically detected.""" - - pass - - -LanguageAutoOrDict = Union[LanguageAuto, LanguageAutoDict] - - -class LanguageHints(_common.BaseModel): - """Provides hints to the model about possible languages present in the audio.""" - - language_codes: Optional[list[str]] = Field( - default=None, - description="""BCP-47 language codes. At least one must be specified.""", - ) - - -class LanguageHintsDict(TypedDict, total=False): - """Provides hints to the model about possible languages present in the audio.""" - - language_codes: Optional[list[str]] - """BCP-47 language codes. At least one must be specified.""" - - -LanguageHintsOrDict = Union[LanguageHints, LanguageHintsDict] - - -class AudioTranscriptionConfig(_common.BaseModel): - """The audio transcription configuration in Setup.""" - - language_codes: Optional[list[str]] = Field( - default=None, - description="""Deprecated: use LanguageAuto or LanguageHints instead.""", - ) - language_auto: Optional[LanguageAuto] = Field( - default=None, - description="""The model will detect the language automatically. Do not use together with LanguageHints.""", - ) - language_hints: Optional[LanguageHints] = Field( - default=None, - description="""Specifies one or more languages in the audio. Do not use together with LanguageAuto.""", - ) - adaptation_phrases: Optional[list[str]] = Field( - default=None, - description="""A list of phrases used for speech adaptation, which biases the ASR model to improve recognition of these specific terms.""", - ) - - -class AudioTranscriptionConfigDict(TypedDict, total=False): - """The audio transcription configuration in Setup.""" - - language_codes: Optional[list[str]] - """Deprecated: use LanguageAuto or LanguageHints instead.""" - - language_auto: Optional[LanguageAutoDict] - """The model will detect the language automatically. Do not use together with LanguageHints.""" - - language_hints: Optional[LanguageHintsDict] - """Specifies one or more languages in the audio. Do not use together with LanguageAuto.""" - - adaptation_phrases: Optional[list[str]] - """A list of phrases used for speech adaptation, which biases the ASR model to improve recognition of these specific terms.""" - - -AudioTranscriptionConfigOrDict = Union[ - AudioTranscriptionConfig, AudioTranscriptionConfigDict -] - - class ProactivityConfig(_common.BaseModel): """Config for proactivity features."""