Skip to content

Commit

Permalink
feat: [google-cloud-speech] add translation_config in `RecognitionC…
Browse files Browse the repository at this point in the history
…onfig` message (#12549)

BEGIN_COMMIT_OVERRIDE
feat: add `translation_config` in `RecognitionConfig` message

Enables specifying target language to perform automatic translation to.

END_COMMIT_OVERRIDE

- [ ] Regenerate this pull request now.

Enables specifying target language to perform automatic translation to.

PiperOrigin-RevId: 621862394

Source-Link:
googleapis/googleapis@9deb78b

Source-Link:
googleapis/googleapis-gen@f109618
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNwZWVjaC8uT3dsQm90LnlhbWwiLCJoIjoiZjEwOTYxODQ2MGMzYzJhZDFjMTlmMGZmNmY1OWM0NTFjMmZjODMwZSJ9

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Apr 4, 2024
1 parent 3d35d8b commit 4ed87f1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
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

0 comments on commit 4ed87f1

Please sign in to comment.