From 4bb9fc85e977475e5e1c4081abd1b0c6479255b2 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 16 Mar 2021 13:18:24 -0700 Subject: [PATCH] feat: Support output transcript to GCS for LongRunningRecognize. (#708) PiperOrigin-RevId: 362934100 Source-Author: Google APIs Source-Date: Mon Mar 15 07:18:03 2021 -0700 Source-Repo: googleapis/googleapis Source-Sha: 72326861be446be27d53af95c87e6e313367c371 Source-Link: https://github.com/googleapis/googleapis/commit/72326861be446be27d53af95c87e6e313367c371 --- .../cloud/speech/v1p1beta1/cloud_speech.proto | 9 ++ .../google-cloud-speech/protos/protos.d.ts | 18 ++++ packages/google-cloud-speech/protos/protos.js | 83 +++++++++++++++++++ .../google-cloud-speech/protos/protos.json | 15 ++++ packages/google-cloud-speech/synth.metadata | 6 +- 5 files changed, 128 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-speech/protos/google/cloud/speech/v1p1beta1/cloud_speech.proto b/packages/google-cloud-speech/protos/google/cloud/speech/v1p1beta1/cloud_speech.proto index 0fcea916bd7..9a8e256f09c 100644 --- a/packages/google-cloud-speech/protos/google/cloud/speech/v1p1beta1/cloud_speech.proto +++ b/packages/google-cloud-speech/protos/google/cloud/speech/v1p1beta1/cloud_speech.proto @@ -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 @@ -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 diff --git a/packages/google-cloud-speech/protos/protos.d.ts b/packages/google-cloud-speech/protos/protos.d.ts index 7a5999e7de4..d3758e59e83 100644 --- a/packages/google-cloud-speech/protos/protos.d.ts +++ b/packages/google-cloud-speech/protos/protos.d.ts @@ -3354,6 +3354,12 @@ export namespace google { /** LongRunningRecognizeResponse results */ results?: (google.cloud.speech.v1p1beta1.ISpeechRecognitionResult[]|null); + + /** LongRunningRecognizeResponse outputConfig */ + outputConfig?: (google.cloud.speech.v1p1beta1.ITranscriptOutputConfig|null); + + /** LongRunningRecognizeResponse outputError */ + outputError?: (google.rpc.IStatus|null); } /** Represents a LongRunningRecognizeResponse. */ @@ -3368,6 +3374,12 @@ export namespace google { /** LongRunningRecognizeResponse results. */ public results: google.cloud.speech.v1p1beta1.ISpeechRecognitionResult[]; + /** LongRunningRecognizeResponse outputConfig. */ + public outputConfig?: (google.cloud.speech.v1p1beta1.ITranscriptOutputConfig|null); + + /** LongRunningRecognizeResponse outputError. */ + public outputError?: (google.rpc.IStatus|null); + /** * Creates a new LongRunningRecognizeResponse instance using the specified properties. * @param [properties] Properties to set @@ -3453,6 +3465,9 @@ export namespace google { /** LongRunningRecognizeMetadata uri */ uri?: (string|null); + + /** LongRunningRecognizeMetadata outputConfig */ + outputConfig?: (google.cloud.speech.v1p1beta1.ITranscriptOutputConfig|null); } /** Represents a LongRunningRecognizeMetadata. */ @@ -3476,6 +3491,9 @@ export namespace google { /** LongRunningRecognizeMetadata uri. */ public uri: string; + /** LongRunningRecognizeMetadata outputConfig. */ + public outputConfig?: (google.cloud.speech.v1p1beta1.ITranscriptOutputConfig|null); + /** * Creates a new LongRunningRecognizeMetadata instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-speech/protos/protos.js b/packages/google-cloud-speech/protos/protos.js index afa867cc086..59c47d667c5 100644 --- a/packages/google-cloud-speech/protos/protos.js +++ b/packages/google-cloud-speech/protos/protos.js @@ -8493,6 +8493,8 @@ * @memberof google.cloud.speech.v1p1beta1 * @interface ILongRunningRecognizeResponse * @property {Array.|null} [results] LongRunningRecognizeResponse results + * @property {google.cloud.speech.v1p1beta1.ITranscriptOutputConfig|null} [outputConfig] LongRunningRecognizeResponse outputConfig + * @property {google.rpc.IStatus|null} [outputError] LongRunningRecognizeResponse outputError */ /** @@ -8519,6 +8521,22 @@ */ LongRunningRecognizeResponse.prototype.results = $util.emptyArray; + /** + * LongRunningRecognizeResponse outputConfig. + * @member {google.cloud.speech.v1p1beta1.ITranscriptOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.speech.v1p1beta1.LongRunningRecognizeResponse + * @instance + */ + LongRunningRecognizeResponse.prototype.outputConfig = null; + + /** + * LongRunningRecognizeResponse outputError. + * @member {google.rpc.IStatus|null|undefined} outputError + * @memberof google.cloud.speech.v1p1beta1.LongRunningRecognizeResponse + * @instance + */ + LongRunningRecognizeResponse.prototype.outputError = null; + /** * Creates a new LongRunningRecognizeResponse instance using the specified properties. * @function create @@ -8546,6 +8564,10 @@ if (message.results != null && message.results.length) for (var i = 0; i < message.results.length; ++i) $root.google.cloud.speech.v1p1beta1.SpeechRecognitionResult.encode(message.results[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) + $root.google.cloud.speech.v1p1beta1.TranscriptOutputConfig.encode(message.outputConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.outputError != null && Object.hasOwnProperty.call(message, "outputError")) + $root.google.rpc.Status.encode(message.outputError, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); return writer; }; @@ -8585,6 +8607,12 @@ message.results = []; message.results.push($root.google.cloud.speech.v1p1beta1.SpeechRecognitionResult.decode(reader, reader.uint32())); break; + case 6: + message.outputConfig = $root.google.cloud.speech.v1p1beta1.TranscriptOutputConfig.decode(reader, reader.uint32()); + break; + case 7: + message.outputError = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -8629,6 +8657,16 @@ return "results." + error; } } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.speech.v1p1beta1.TranscriptOutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } + if (message.outputError != null && message.hasOwnProperty("outputError")) { + var error = $root.google.rpc.Status.verify(message.outputError); + if (error) + return "outputError." + error; + } return null; }; @@ -8654,6 +8692,16 @@ message.results[i] = $root.google.cloud.speech.v1p1beta1.SpeechRecognitionResult.fromObject(object.results[i]); } } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.speech.v1p1beta1.LongRunningRecognizeResponse.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.speech.v1p1beta1.TranscriptOutputConfig.fromObject(object.outputConfig); + } + if (object.outputError != null) { + if (typeof object.outputError !== "object") + throw TypeError(".google.cloud.speech.v1p1beta1.LongRunningRecognizeResponse.outputError: object expected"); + message.outputError = $root.google.rpc.Status.fromObject(object.outputError); + } return message; }; @@ -8672,11 +8720,19 @@ var object = {}; if (options.arrays || options.defaults) object.results = []; + if (options.defaults) { + object.outputConfig = null; + object.outputError = null; + } if (message.results && message.results.length) { object.results = []; for (var j = 0; j < message.results.length; ++j) object.results[j] = $root.google.cloud.speech.v1p1beta1.SpeechRecognitionResult.toObject(message.results[j], options); } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.speech.v1p1beta1.TranscriptOutputConfig.toObject(message.outputConfig, options); + if (message.outputError != null && message.hasOwnProperty("outputError")) + object.outputError = $root.google.rpc.Status.toObject(message.outputError, options); return object; }; @@ -8704,6 +8760,7 @@ * @property {google.protobuf.ITimestamp|null} [startTime] LongRunningRecognizeMetadata startTime * @property {google.protobuf.ITimestamp|null} [lastUpdateTime] LongRunningRecognizeMetadata lastUpdateTime * @property {string|null} [uri] LongRunningRecognizeMetadata uri + * @property {google.cloud.speech.v1p1beta1.ITranscriptOutputConfig|null} [outputConfig] LongRunningRecognizeMetadata outputConfig */ /** @@ -8753,6 +8810,14 @@ */ LongRunningRecognizeMetadata.prototype.uri = ""; + /** + * LongRunningRecognizeMetadata outputConfig. + * @member {google.cloud.speech.v1p1beta1.ITranscriptOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.speech.v1p1beta1.LongRunningRecognizeMetadata + * @instance + */ + LongRunningRecognizeMetadata.prototype.outputConfig = null; + /** * Creates a new LongRunningRecognizeMetadata instance using the specified properties. * @function create @@ -8785,6 +8850,8 @@ $root.google.protobuf.Timestamp.encode(message.lastUpdateTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.uri); + if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) + $root.google.cloud.speech.v1p1beta1.TranscriptOutputConfig.encode(message.outputConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -8831,6 +8898,9 @@ case 4: message.uri = reader.string(); break; + case 5: + message.outputConfig = $root.google.cloud.speech.v1p1beta1.TranscriptOutputConfig.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -8882,6 +8952,11 @@ if (message.uri != null && message.hasOwnProperty("uri")) if (!$util.isString(message.uri)) return "uri: string expected"; + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.speech.v1p1beta1.TranscriptOutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } return null; }; @@ -8911,6 +8986,11 @@ } if (object.uri != null) message.uri = String(object.uri); + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.speech.v1p1beta1.LongRunningRecognizeMetadata.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.speech.v1p1beta1.TranscriptOutputConfig.fromObject(object.outputConfig); + } return message; }; @@ -8932,6 +9012,7 @@ object.startTime = null; object.lastUpdateTime = null; object.uri = ""; + object.outputConfig = null; } if (message.progressPercent != null && message.hasOwnProperty("progressPercent")) object.progressPercent = message.progressPercent; @@ -8941,6 +9022,8 @@ object.lastUpdateTime = $root.google.protobuf.Timestamp.toObject(message.lastUpdateTime, options); if (message.uri != null && message.hasOwnProperty("uri")) object.uri = message.uri; + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.speech.v1p1beta1.TranscriptOutputConfig.toObject(message.outputConfig, options); return object; }; diff --git a/packages/google-cloud-speech/protos/protos.json b/packages/google-cloud-speech/protos/protos.json index f974f2387d6..1bdeed07bdf 100644 --- a/packages/google-cloud-speech/protos/protos.json +++ b/packages/google-cloud-speech/protos/protos.json @@ -938,6 +938,14 @@ "rule": "repeated", "type": "SpeechRecognitionResult", "id": 2 + }, + "outputConfig": { + "type": "TranscriptOutputConfig", + "id": 6 + }, + "outputError": { + "type": "google.rpc.Status", + "id": 7 } } }, @@ -961,6 +969,13 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "outputConfig": { + "type": "TranscriptOutputConfig", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } } }, diff --git a/packages/google-cloud-speech/synth.metadata b/packages/google-cloud-speech/synth.metadata index f6b480d9a6c..9ee068c841c 100644 --- a/packages/google-cloud-speech/synth.metadata +++ b/packages/google-cloud-speech/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-speech.git", - "sha": "fbcc04bb6fc8e8ecbd90b3559bf2e85210947a37" + "sha": "6abc5ec4c42344161eeefb3d52a249adead407c4" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "b6ebac16c3aecb798d4f25443d96df2f42a965ca", - "internalRef": "362294447" + "sha": "72326861be446be27d53af95c87e6e313367c371", + "internalRef": "362934100" } }, {