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', ), }