diff --git a/packages/google-cloud-speech/google/cloud/speech_v2/__init__.py b/packages/google-cloud-speech/google/cloud/speech_v2/__init__.py index 6ebac73e9b54..ca7b6fbd368f 100644 --- a/packages/google-cloud-speech/google/cloud/speech_v2/__init__.py +++ b/packages/google-cloud-speech/google/cloud/speech_v2/__init__.py @@ -73,6 +73,7 @@ StreamingRecognizeRequest, StreamingRecognizeResponse, TranscriptNormalization, + TranslationConfig, UndeleteCustomClassRequest, UndeletePhraseSetRequest, UndeleteRecognizerRequest, @@ -140,6 +141,7 @@ "StreamingRecognizeRequest", "StreamingRecognizeResponse", "TranscriptNormalization", + "TranslationConfig", "UndeleteCustomClassRequest", "UndeletePhraseSetRequest", "UndeleteRecognizerRequest", diff --git a/packages/google-cloud-speech/google/cloud/speech_v2/types/__init__.py b/packages/google-cloud-speech/google/cloud/speech_v2/types/__init__.py index 2e20c3c4e7a4..ba93109bdfd4 100644 --- a/packages/google-cloud-speech/google/cloud/speech_v2/types/__init__.py +++ b/packages/google-cloud-speech/google/cloud/speech_v2/types/__init__.py @@ -67,6 +67,7 @@ StreamingRecognizeRequest, StreamingRecognizeResponse, TranscriptNormalization, + TranslationConfig, UndeleteCustomClassRequest, UndeletePhraseSetRequest, UndeleteRecognizerRequest, @@ -132,6 +133,7 @@ "StreamingRecognizeRequest", "StreamingRecognizeResponse", "TranscriptNormalization", + "TranslationConfig", "UndeleteCustomClassRequest", "UndeletePhraseSetRequest", "UndeleteRecognizerRequest", diff --git a/packages/google-cloud-speech/google/cloud/speech_v2/types/cloud_speech.py b/packages/google-cloud-speech/google/cloud/speech_v2/types/cloud_speech.py index 1c686e93ed77..ebf5acb969b1 100644 --- a/packages/google-cloud-speech/google/cloud/speech_v2/types/cloud_speech.py +++ b/packages/google-cloud-speech/google/cloud/speech_v2/types/cloud_speech.py @@ -40,6 +40,7 @@ "SpeakerDiarizationConfig", "RecognitionFeatures", "TranscriptNormalization", + "TranslationConfig", "SpeechAdaptation", "RecognitionConfig", "RecognizeRequest", @@ -1062,6 +1063,21 @@ class Entry(proto.Message): ) +class TranslationConfig(proto.Message): + r"""Translation configuration. Use to translate the given audio + into text for the desired language. + + Attributes: + target_language (str): + Required. The language code to translate to. + """ + + target_language: str = proto.Field( + proto.STRING, + number=1, + ) + + class SpeechAdaptation(proto.Message): r"""Provides "hints" to the speech recognizer to favor specific words and phrases in the results. PhraseSets can be specified as @@ -1187,6 +1203,10 @@ class RecognitionConfig(proto.Message): StreamingRecognize, this normalization only applies to stable partial transcripts (stability > 0.8) and final transcripts. + translation_config (google.cloud.speech_v2.types.TranslationConfig): + Optional. Optional configuration used to + automatically run translation on the given audio + to the desired language for supported models. """ auto_decoding_config: "AutoDetectDecodingConfig" = proto.Field( @@ -1224,6 +1244,11 @@ class RecognitionConfig(proto.Message): number=11, message="TranscriptNormalization", ) + translation_config: "TranslationConfig" = proto.Field( + proto.MESSAGE, + number=15, + message="TranslationConfig", + ) class RecognizeRequest(proto.Message): diff --git a/packages/google-cloud-speech/tests/unit/gapic/speech_v2/test_speech.py b/packages/google-cloud-speech/tests/unit/gapic/speech_v2/test_speech.py index 2c71268aa122..b9329457d98f 100644 --- a/packages/google-cloud-speech/tests/unit/gapic/speech_v2/test_speech.py +++ b/packages/google-cloud-speech/tests/unit/gapic/speech_v2/test_speech.py @@ -8430,6 +8430,7 @@ def test_create_recognizer_rest(request_type): } ] }, + "translation_config": {"target_language": "target_language_value"}, }, "annotations": {}, "state": 2, @@ -9497,6 +9498,7 @@ def test_update_recognizer_rest(request_type): } ] }, + "translation_config": {"target_language": "target_language_value"}, }, "annotations": {}, "state": 2,