Skip to content

Commit

Permalink
feat: add output_config request field (#252)
Browse files Browse the repository at this point in the history
* feat: add output_config request field

Committer: @cherba
PiperOrigin-RevId: 397621106

Source-Link: googleapis/googleapis@1872f45

Source-Link: googleapis/googleapis-gen@fd4bb9f
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 <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Sep 20, 2021
1 parent d341e0f commit b37a911
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = (
Expand All @@ -54,5 +55,6 @@
"StreamingRecognitionResult",
"StreamingRecognizeRequest",
"StreamingRecognizeResponse",
"TranscriptOutputConfig",
"WordInfo",
)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -61,5 +62,6 @@ class SpeechClient(SpeechHelpers, SpeechClient):
"StreamingRecognitionResult",
"StreamingRecognizeRequest",
"StreamingRecognizeResponse",
"TranscriptOutputConfig",
"WordInfo",
)
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
StreamingRecognitionResult,
StreamingRecognizeRequest,
StreamingRecognizeResponse,
TranscriptOutputConfig,
WordInfo,
)

Expand All @@ -50,5 +51,6 @@
"StreamingRecognitionResult",
"StreamingRecognizeRequest",
"StreamingRecognizeResponse",
"TranscriptOutputConfig",
"WordInfo",
)
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
manifest={
"RecognizeRequest",
"LongRunningRecognizeRequest",
"TranscriptOutputConfig",
"StreamingRecognizeRequest",
"StreamingRecognitionConfig",
"RecognitionConfig",
Expand Down Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', ),
}
Expand Down

0 comments on commit b37a911

Please sign in to comment.