Skip to content

Commit

Permalink
feat: add API for writing BatchRecognize transcripts in SRT and VTT f…
Browse files Browse the repository at this point in the history
…ormats

docs: update field documentation based on field behavior updates

PiperOrigin-RevId: 609024258
  • Loading branch information
Google APIs authored and Copybara-Service committed Feb 21, 2024
1 parent 1608c32 commit 4d70a58
Showing 1 changed file with 75 additions and 14 deletions.
89 changes: 75 additions & 14 deletions google/cloud/speech/v2/cloud_speech.proto
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,12 @@ message Recognizer {
DELETED = 4;
}

// Output only. The resource name of the Recognizer.
// Output only. Identifier. The resource name of the Recognizer.
// Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
string name = 1 [
(google.api.field_behavior) = OUTPUT_ONLY,
(google.api.field_behavior) = IDENTIFIER
];

// Output only. System-assigned unique identifier for the Recognizer.
string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
Expand Down Expand Up @@ -1278,6 +1281,34 @@ message GcsOutputConfig {
// Output configurations for inline response.
message InlineOutputConfig {}

// Output configurations for serialized `BatchRecognizeResults` protos.
message NativeOutputFileFormatConfig {}

// Output configurations for [WebVTT](https://www.w3.org/TR/webvtt1/) formatted
// subtitle file.
message VttOutputFileFormatConfig {}

// Output configurations [SubRip
// Text](https://www.matroska.org/technical/subtitles.html#srt-subtitles)
// formatted subtitle file.
message SrtOutputFileFormatConfig {}

// Configuration for the format of the results stored to `output`.
message OutputFormatConfig {
// Configuration for the native output format. If this field is set or if no
// other output format field is set then transcripts will be written to the
// sink in the native format.
NativeOutputFileFormatConfig native = 1;

// Configuration for the vtt output format. If this field is set then
// transcripts will be written to the sink in the vtt format.
VttOutputFileFormatConfig vtt = 2;

// Configuration for the srt output format. If this field is set then
// transcripts will be written to the sink in the srt format.
SrtOutputFileFormatConfig srt = 3;
}

// Configuration options for the output(s) of recognition.
message RecognitionOutputConfig {
oneof output {
Expand All @@ -1292,6 +1323,11 @@ message RecognitionOutputConfig {
// with just one audio file.
InlineOutputConfig inline_response_config = 2;
}

// Optional. Configuration for the format of the results stored to `output`.
// If unspecified transcripts will be written in the `NATIVE` format only.
OutputFormatConfig output_format_config = 3
[(google.api.field_behavior) = OPTIONAL];
}

// Response message for
Expand Down Expand Up @@ -1321,12 +1357,28 @@ message BatchRecognizeResults {
message CloudStorageResult {
// The Cloud Storage URI to which recognition results were written.
string uri = 1;

// The Cloud Storage URI to which recognition results were written as VTT
// formatted captions. This is populated only when `VTT` output is requested.
string vtt_format_uri = 2;

// The Cloud Storage URI to which recognition results were written as SRT
// formatted captions. This is populated only when `SRT` output is requested.
string srt_format_uri = 3;
}

// Final results returned inline in the recognition response.
message InlineResult {
// The transcript for the audio file.
BatchRecognizeResults transcript = 1;

// The transcript for the audio file as VTT formatted captions. This is
// populated only when `VTT` output is requested.
string vtt_captions = 2;

// The transcript for the audio file as SRT formatted captions. This is
// populated only when `SRT` output is requested.
string srt_captions = 3;
}

// Final results for a single file.
Expand Down Expand Up @@ -1555,10 +1607,13 @@ message Config {
pattern: "projects/{project}/locations/{location}/config"
};

// Output only. The name of the config resource. There is exactly one config
// resource per project per location. The expected format is
// Output only. Identifier. The name of the config resource. There is exactly
// one config resource per project per location. The expected format is
// `projects/{project}/locations/{location}/config`.
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
string name = 1 [
(google.api.field_behavior) = OUTPUT_ONLY,
(google.api.field_behavior) = IDENTIFIER
];

// Optional. An optional [KMS key
// name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) that if
Expand Down Expand Up @@ -1632,17 +1687,20 @@ message CustomClass {
DELETED = 4;
}

// Output only. The resource name of the CustomClass.
// Output only. Identifier. The resource name of the CustomClass.
// Format:
// `projects/{project}/locations/{location}/customClasses/{custom_class}`.
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
string name = 1 [
(google.api.field_behavior) = OUTPUT_ONLY,
(google.api.field_behavior) = IDENTIFIER
];

// Output only. System-assigned unique identifier for the CustomClass.
string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

// User-settable, human-readable name for the CustomClass. Must be 63
// characters or less.
string display_name = 4;
// Optional. User-settable, human-readable name for the CustomClass. Must be
// 63 characters or less.
string display_name = 4 [(google.api.field_behavior) = OPTIONAL];

// A collection of class items.
repeated ClassItem items = 5;
Expand All @@ -1666,10 +1724,10 @@ message CustomClass {
google.protobuf.Timestamp expire_time = 9
[(google.api.field_behavior) = OUTPUT_ONLY];

// Allows users to store small amounts of arbitrary data.
// Optional. Allows users to store small amounts of arbitrary data.
// Both the key and the value must be 63 characters or less each.
// At most 100 annotations.
map<string, string> annotations = 10;
map<string, string> annotations = 10 [(google.api.field_behavior) = OPTIONAL];

// Output only. This checksum is computed by the server based on the value of
// other fields. This may be sent on update, undelete, and delete requests to
Expand Down Expand Up @@ -1751,9 +1809,12 @@ message PhraseSet {
DELETED = 4;
}

// Output only. The resource name of the PhraseSet.
// Output only. Identifier. The resource name of the PhraseSet.
// Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
string name = 1 [
(google.api.field_behavior) = OUTPUT_ONLY,
(google.api.field_behavior) = IDENTIFIER
];

// Output only. System-assigned unique identifier for the PhraseSet.
string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
Expand Down

0 comments on commit 4d70a58

Please sign in to comment.