Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [google-cloud-speech] add translation_config in RecognitionConfig message #12549

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
StreamingRecognizeRequest,
StreamingRecognizeResponse,
TranscriptNormalization,
TranslationConfig,
UndeleteCustomClassRequest,
UndeletePhraseSetRequest,
UndeleteRecognizerRequest,
Expand Down Expand Up @@ -140,6 +141,7 @@
"StreamingRecognizeRequest",
"StreamingRecognizeResponse",
"TranscriptNormalization",
"TranslationConfig",
"UndeleteCustomClassRequest",
"UndeletePhraseSetRequest",
"UndeleteRecognizerRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
StreamingRecognizeRequest,
StreamingRecognizeResponse,
TranscriptNormalization,
TranslationConfig,
UndeleteCustomClassRequest,
UndeletePhraseSetRequest,
UndeleteRecognizerRequest,
Expand Down Expand Up @@ -132,6 +133,7 @@
"StreamingRecognizeRequest",
"StreamingRecognizeResponse",
"TranscriptNormalization",
"TranslationConfig",
"UndeleteCustomClassRequest",
"UndeletePhraseSetRequest",
"UndeleteRecognizerRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"SpeakerDiarizationConfig",
"RecognitionFeatures",
"TranscriptNormalization",
"TranslationConfig",
"SpeechAdaptation",
"RecognitionConfig",
"RecognizeRequest",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8430,6 +8430,7 @@ def test_create_recognizer_rest(request_type):
}
]
},
"translation_config": {"target_language": "target_language_value"},
},
"annotations": {},
"state": 2,
Expand Down Expand Up @@ -9497,6 +9498,7 @@ def test_update_recognizer_rest(request_type):
}
]
},
"translation_config": {"target_language": "target_language_value"},
},
"annotations": {},
"state": 2,
Expand Down
Loading