From 856259c0bc5ff5ed444c83ab35862f2da944e1b4 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 20 Sep 2021 12:38:12 -0600 Subject: [PATCH] feat: add output_config request field (#252) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add output_config request field Committer: @cherba PiperOrigin-RevId: 397621106 Source-Link: https://github.com/googleapis/googleapis/commit/1872f4583526cd30a6481726d78a31896a58dc80 Source-Link: https://github.com/googleapis/googleapis-gen/commit/fd4bb9f3fcc6b7bf498808c443eae9bf0d4447df Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZmQ0YmI5ZjNmY2M2YjdiZjQ5ODgwOGM0NDNlYWU5YmYwZDQ0NDdkZiJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../google/cloud/speech/__init__.py | 2 ++ .../google/cloud/speech_v1/__init__.py | 2 ++ .../google/cloud/speech_v1/types/__init__.py | 2 ++ .../cloud/speech_v1/types/cloud_speech.py | 22 +++++++++++++++++++ .../scripts/fixup_speech_v1_keywords.py | 2 +- 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-python-speech/google/cloud/speech/__init__.py b/packages/google-cloud-python-speech/google/cloud/speech/__init__.py index 129e45b74753..4b7178005987 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech/__init__.py +++ b/packages/google-cloud-python-speech/google/cloud/speech/__init__.py @@ -33,6 +33,7 @@ from google.cloud.speech_v1.types.cloud_speech import StreamingRecognitionResult from google.cloud.speech_v1.types.cloud_speech import StreamingRecognizeRequest from google.cloud.speech_v1.types.cloud_speech import StreamingRecognizeResponse +from google.cloud.speech_v1.types.cloud_speech import TranscriptOutputConfig from google.cloud.speech_v1.types.cloud_speech import WordInfo __all__ = ( @@ -54,5 +55,6 @@ "StreamingRecognitionResult", "StreamingRecognizeRequest", "StreamingRecognizeResponse", + "TranscriptOutputConfig", "WordInfo", ) diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1/__init__.py b/packages/google-cloud-python-speech/google/cloud/speech_v1/__init__.py index e4b1e2ea86b0..5a9e4a6ab232 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1/__init__.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1/__init__.py @@ -33,6 +33,7 @@ from .types.cloud_speech import StreamingRecognitionResult from .types.cloud_speech import StreamingRecognizeRequest from .types.cloud_speech import StreamingRecognizeResponse +from .types.cloud_speech import TranscriptOutputConfig from .types.cloud_speech import WordInfo from google.cloud.speech_v1.helpers import SpeechHelpers @@ -61,5 +62,6 @@ class SpeechClient(SpeechHelpers, SpeechClient): "StreamingRecognitionResult", "StreamingRecognizeRequest", "StreamingRecognizeResponse", + "TranscriptOutputConfig", "WordInfo", ) diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1/types/__init__.py b/packages/google-cloud-python-speech/google/cloud/speech_v1/types/__init__.py index 31843103e921..858051afd543 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1/types/__init__.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1/types/__init__.py @@ -30,6 +30,7 @@ StreamingRecognitionResult, StreamingRecognizeRequest, StreamingRecognizeResponse, + TranscriptOutputConfig, WordInfo, ) @@ -50,5 +51,6 @@ "StreamingRecognitionResult", "StreamingRecognizeRequest", "StreamingRecognizeResponse", + "TranscriptOutputConfig", "WordInfo", ) diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1/types/cloud_speech.py b/packages/google-cloud-python-speech/google/cloud/speech_v1/types/cloud_speech.py index 51cbdd63a6c0..2fae477b1051 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1/types/cloud_speech.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1/types/cloud_speech.py @@ -25,6 +25,7 @@ manifest={ "RecognizeRequest", "LongRunningRecognizeRequest", + "TranscriptOutputConfig", "StreamingRecognizeRequest", "StreamingRecognitionConfig", "RecognitionConfig", @@ -72,10 +73,31 @@ class LongRunningRecognizeRequest(proto.Message): request. audio (google.cloud.speech_v1.types.RecognitionAudio): Required. The audio data to be recognized. + output_config (google.cloud.speech_v1.types.TranscriptOutputConfig): + Optional. Specifies an optional destination + for the recognition results. """ config = proto.Field(proto.MESSAGE, number=1, message="RecognitionConfig",) audio = proto.Field(proto.MESSAGE, number=2, message="RecognitionAudio",) + output_config = proto.Field( + proto.MESSAGE, number=4, message="TranscriptOutputConfig", + ) + + +class TranscriptOutputConfig(proto.Message): + r"""Specifies an optional destination for the recognition + results. + + Attributes: + gcs_uri (str): + Specifies a Cloud Storage URI for the recognition results. + Must be specified in the format: + ``gs://bucket_name/object_name``, and the bucket must + already exist. + """ + + gcs_uri = proto.Field(proto.STRING, number=1, oneof="output_type",) class StreamingRecognizeRequest(proto.Message): diff --git a/packages/google-cloud-python-speech/scripts/fixup_speech_v1_keywords.py b/packages/google-cloud-python-speech/scripts/fixup_speech_v1_keywords.py index 385dac85761b..0ffcae108706 100644 --- a/packages/google-cloud-python-speech/scripts/fixup_speech_v1_keywords.py +++ b/packages/google-cloud-python-speech/scripts/fixup_speech_v1_keywords.py @@ -39,7 +39,7 @@ def partition( class speechCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'long_running_recognize': ('config', 'audio', ), + 'long_running_recognize': ('config', 'audio', 'output_config', ), 'recognize': ('config', 'audio', ), 'streaming_recognize': ('streaming_config', 'audio_content', ), }