Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
feat: Support output transcript to GCS for LongRunningRecognize.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 362934100

Source-Author: Google APIs <noreply@google.com>
Source-Date: Mon Mar 15 07:18:03 2021 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 72326861be446be27d53af95c87e6e313367c371
Source-Link: googleapis/googleapis@7232686
  • Loading branch information
yoshi-automation committed Mar 18, 2021
1 parent aea3ce7 commit 888d3a0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
4 changes: 2 additions & 2 deletions google/cloud/speech_v1p1beta1/__init__.py
Expand Up @@ -60,7 +60,6 @@ class SpeechClient(SpeechHelpers, SpeechClient):


__all__ = (
"AdaptationClient",
"CreateCustomClassRequest",
"CreatePhraseSetRequest",
"CustomClass",
Expand All @@ -83,6 +82,7 @@ class SpeechClient(SpeechHelpers, SpeechClient):
"RecognizeResponse",
"SpeakerDiarizationConfig",
"SpeechAdaptation",
"SpeechClient",
"SpeechContext",
"SpeechRecognitionAlternative",
"SpeechRecognitionResult",
Expand All @@ -94,5 +94,5 @@ class SpeechClient(SpeechHelpers, SpeechClient):
"UpdateCustomClassRequest",
"UpdatePhraseSetRequest",
"WordInfo",
"SpeechClient",
"AdaptationClient",
)
9 changes: 9 additions & 0 deletions google/cloud/speech_v1p1beta1/proto/cloud_speech.proto
Expand Up @@ -638,6 +638,12 @@ message LongRunningRecognizeResponse {
// Sequential list of transcription results corresponding to
// sequential portions of audio.
repeated SpeechRecognitionResult results = 2;

// Original output config if present in the request.
TranscriptOutputConfig output_config = 6;

// If the transcript output fails this field contains the relevant error.
google.rpc.Status output_error = 7;
}

// Describes the progress of a long-running `LongRunningRecognize` call. It is
Expand All @@ -657,6 +663,9 @@ message LongRunningRecognizeMetadata {
// Output only. The URI of the audio file being transcribed. Empty if the audio was sent
// as byte content.
string uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. A copy of the TranscriptOutputConfig if it was set in the request.
TranscriptOutputConfig output_config = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// `StreamingRecognizeResponse` is the only message returned to the client by
Expand Down
20 changes: 20 additions & 0 deletions google/cloud/speech_v1p1beta1/types/cloud_speech.py
Expand Up @@ -683,12 +683,24 @@ class LongRunningRecognizeResponse(proto.Message):
results (Sequence[google.cloud.speech_v1p1beta1.types.SpeechRecognitionResult]):
Sequential list of transcription results
corresponding to sequential portions of audio.
output_config (google.cloud.speech_v1p1beta1.types.TranscriptOutputConfig):
Original output config if present in the
request.
output_error (google.rpc.status_pb2.Status):
If the transcript output fails this field
contains the relevant error.
"""

results = proto.RepeatedField(
proto.MESSAGE, number=2, message="SpeechRecognitionResult",
)

output_config = proto.Field(
proto.MESSAGE, number=6, message="TranscriptOutputConfig",
)

output_error = proto.Field(proto.MESSAGE, number=7, message=status.Status,)


class LongRunningRecognizeMetadata(proto.Message):
r"""Describes the progress of a long-running ``LongRunningRecognize``
Expand All @@ -709,6 +721,10 @@ class LongRunningRecognizeMetadata(proto.Message):
Output only. The URI of the audio file being
transcribed. Empty if the audio was sent as byte
content.
output_config (google.cloud.speech_v1p1beta1.types.TranscriptOutputConfig):
Output only. A copy of the
TranscriptOutputConfig if it was set in the
request.
"""

progress_percent = proto.Field(proto.INT32, number=1)
Expand All @@ -721,6 +737,10 @@ class LongRunningRecognizeMetadata(proto.Message):

uri = proto.Field(proto.STRING, number=4)

output_config = proto.Field(
proto.MESSAGE, number=5, message="TranscriptOutputConfig",
)


class StreamingRecognizeResponse(proto.Message):
r"""``StreamingRecognizeResponse`` is the only message returned to the
Expand Down
4 changes: 2 additions & 2 deletions synth.metadata
Expand Up @@ -11,8 +11,8 @@
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "b6ebac16c3aecb798d4f25443d96df2f42a965ca",
"internalRef": "362294447"
"sha": "72326861be446be27d53af95c87e6e313367c371",
"internalRef": "362934100"
}
},
{
Expand Down

0 comments on commit 888d3a0

Please sign in to comment.