Skip to content

Commit 56c65ed

Browse files
Google APIscopybara-github
authored andcommitted
feat: Support Model Adaptation.
PiperOrigin-RevId: 358182033
1 parent e13001b commit 56c65ed

5 files changed

Lines changed: 351 additions & 13 deletions

File tree

google/cloud/speech/v1p1beta1/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ proto_library(
1313
name = "speech_proto",
1414
srcs = [
1515
"cloud_speech.proto",
16+
"cloud_speech_adaptation.proto",
1617
"resource.proto",
1718
],
1819
deps = [
@@ -24,6 +25,8 @@ proto_library(
2425
"//google/rpc:status_proto",
2526
"@com_google_protobuf//:any_proto",
2627
"@com_google_protobuf//:duration_proto",
28+
"@com_google_protobuf//:empty_proto",
29+
"@com_google_protobuf//:field_mask_proto",
2730
"@com_google_protobuf//:timestamp_proto",
2831
],
2932
)

google/cloud/speech/v1p1beta1/cloud_speech.proto

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Google LLC
1+
// Copyright 2021 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -139,6 +139,16 @@ message StreamingRecognitionConfig {
139139
// `END_OF_SINGLE_UTTERANCE` event and cease recognition. It will return no
140140
// more than one `StreamingRecognitionResult` with the `is_final` flag set to
141141
// `true`.
142+
//
143+
// The `single_utterance` field can only be used with specified models,
144+
// otherwise an error is thrown. The `model` field in [`RecognitionConfig`][]
145+
// must be set to:
146+
//
147+
// * `command_and_search`
148+
// * `phone_call` AND additional field `useEnhanced`=`true`
149+
// * The `model` field is left undefined. In this case the API auto-selects
150+
// a model based on any other parameters that you set in
151+
// `RecognitionConfig`.
142152
bool single_utterance = 2;
143153

144154
// If `true`, interim results (tentative hypotheses) may be
@@ -218,7 +228,8 @@ message RecognitionConfig {
218228
// wideband is supported. `sample_rate_hertz` must be 16000.
219229
SPEEX_WITH_HEADER_BYTE = 7;
220230

221-
// MP3 audio. Support all standard MP3 bitrates (which range from 32-320
231+
// MP3 audio. MP3 encoding is a Beta feature and only available in
232+
// v1p1beta1. Support all standard MP3 bitrates (which range from 32-320
222233
// kbps). When using this encoding, `sample_rate_hertz` has to match the
223234
// sample rate of the file being used.
224235
MP3 = 8;
@@ -635,8 +646,8 @@ message LongRunningRecognizeMetadata {
635646
// Time of the most recent processing update.
636647
google.protobuf.Timestamp last_update_time = 3;
637648

638-
// The URI of the audio file being transcribed. Empty if the audio was sent
639-
// as byte content.
649+
// Output only. The URI of the audio file being transcribed. Empty if the
650+
// audio was sent as byte content.
640651
string uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
641652
}
642653

Lines changed: 318 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,318 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.cloud.speech.v1p1beta1;
18+
19+
import "google/api/annotations.proto";
20+
import "google/api/client.proto";
21+
import "google/api/field_behavior.proto";
22+
import "google/api/resource.proto";
23+
import "google/cloud/speech/v1p1beta1/resource.proto";
24+
import "google/protobuf/empty.proto";
25+
import "google/protobuf/field_mask.proto";
26+
27+
option cc_enable_arenas = true;
28+
option go_package = "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1;speech";
29+
option java_multiple_files = true;
30+
option java_outer_classname = "SpeechAdaptationProto";
31+
option java_package = "com.google.cloud.speech.v1p1beta1";
32+
option objc_class_prefix = "GCS";
33+
34+
// Service that implements Google Cloud Speech Adaptation API.
35+
service Adaptation {
36+
option (google.api.default_host) = "speech.googleapis.com";
37+
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
38+
39+
// Create a set of phrase hints. Each item in the set can be a single word or
40+
// a multi-word phrase. The items in the PhraseSet are favored by the
41+
// recognition model when you send a call that includes the PhraseSet.
42+
rpc CreatePhraseSet(CreatePhraseSetRequest) returns (PhraseSet) {
43+
option (google.api.http) = {
44+
post: "/v1p1beta1/{parent=projects/*/locations/*}/phraseSets"
45+
body: "*"
46+
};
47+
option (google.api.method_signature) = "parent,phrase_set,phrase_set_id";
48+
}
49+
50+
// Get a phrase set.
51+
rpc GetPhraseSet(GetPhraseSetRequest) returns (PhraseSet) {
52+
option (google.api.http) = {
53+
get: "/v1p1beta1/{name=projects/*/locations/*/phraseSets/*}"
54+
};
55+
option (google.api.method_signature) = "name";
56+
}
57+
58+
// List phrase sets.
59+
rpc ListPhraseSet(ListPhraseSetRequest) returns (ListPhraseSetResponse) {
60+
option (google.api.http) = {
61+
get: "/v1p1beta1/{parent=projects/*/locations/*}/phraseSets"
62+
};
63+
option (google.api.method_signature) = "parent";
64+
}
65+
66+
// Update a phrase set.
67+
rpc UpdatePhraseSet(UpdatePhraseSetRequest) returns (PhraseSet) {
68+
option (google.api.http) = {
69+
patch: "/v1p1beta1/{phrase_set.name=projects/*/locations/*/phraseSets/*}"
70+
body: "phrase_set"
71+
};
72+
}
73+
74+
// Delete a phrase set.
75+
rpc DeletePhraseSet(DeletePhraseSetRequest) returns (google.protobuf.Empty) {
76+
option (google.api.http) = {
77+
delete: "/v1p1beta1/{name=projects/*/locations/*/phraseSets/*}"
78+
};
79+
option (google.api.method_signature) = "name";
80+
}
81+
82+
// Create a custom class.
83+
rpc CreateCustomClass(CreateCustomClassRequest) returns (CustomClass) {
84+
option (google.api.http) = {
85+
post: "/v1p1beta1/{parent=projects/*/locations/*}/customClasses"
86+
body: "*"
87+
};
88+
option (google.api.method_signature) = "parent,custom_class,custom_class_id";
89+
}
90+
91+
// Get a custom class.
92+
rpc GetCustomClass(GetCustomClassRequest) returns (CustomClass) {
93+
option (google.api.http) = {
94+
get: "/v1p1beta1/{name=projects/*/locations/*/customClasses/*}"
95+
};
96+
option (google.api.method_signature) = "name";
97+
}
98+
99+
// List custom classes.
100+
rpc ListCustomClasses(ListCustomClassesRequest) returns (ListCustomClassesResponse) {
101+
option (google.api.http) = {
102+
get: "/v1p1beta1/{parent=projects/*/locations/*}/customClasses"
103+
};
104+
option (google.api.method_signature) = "parent";
105+
}
106+
107+
// Update a custom class.
108+
rpc UpdateCustomClass(UpdateCustomClassRequest) returns (CustomClass) {
109+
option (google.api.http) = {
110+
patch: "/v1p1beta1/{custom_class.name=projects/*/locations/*/customClasses/*}"
111+
body: "custom_class"
112+
};
113+
}
114+
115+
// Delete a custom class.
116+
rpc DeleteCustomClass(DeleteCustomClassRequest) returns (google.protobuf.Empty) {
117+
option (google.api.http) = {
118+
delete: "/v1p1beta1/{name=projects/*/locations/*/customClasses/*}"
119+
};
120+
option (google.api.method_signature) = "name";
121+
}
122+
}
123+
124+
// Message sent by the client for the `CreatePhraseSet` method.
125+
message CreatePhraseSetRequest {
126+
// Required. The parent resource where this phrase set will be created.
127+
// Format:
128+
// {api_version}/projects/{project}/locations/{location}/phraseSets
129+
string parent = 1 [
130+
(google.api.field_behavior) = REQUIRED,
131+
(google.api.resource_reference) = {
132+
child_type: "speech.googleapis.com/PhraseSet"
133+
}
134+
];
135+
136+
// The ID to use for the phrase set, which will become the final
137+
// component of the phrase set's resource name.
138+
//
139+
// This value should be 4-63 characters, and valid characters
140+
// are /[a-z][0-9]-/.
141+
string phrase_set_id = 2;
142+
143+
// Required. The phrase set to create.
144+
PhraseSet phrase_set = 3 [(google.api.field_behavior) = REQUIRED];
145+
}
146+
147+
// Message sent by the client for the `UpdatePhraseSet` method.
148+
message UpdatePhraseSetRequest {
149+
// Required. The phrase set to update.
150+
//
151+
// The phrase set's `name` field is used to identify the set to be
152+
// updated. Format:
153+
// {api_version}/projects/{project}/locations/{location}/phraseSets/{phrase_set}
154+
PhraseSet phrase_set = 1 [(google.api.field_behavior) = REQUIRED];
155+
156+
// The list of fields to be updated.
157+
google.protobuf.FieldMask update_mask = 2;
158+
}
159+
160+
// Message sent by the client for the `GetPhraseSet` method.
161+
message GetPhraseSetRequest {
162+
// Required. The name of the phrase set to retrieve.
163+
// Format:
164+
// {api_version}/projects/{project}/locations/{location}/phraseSets/{phrase_set}
165+
string name = 1 [
166+
(google.api.field_behavior) = REQUIRED,
167+
(google.api.resource_reference) = {
168+
type: "speech.googleapis.com/PhraseSet"
169+
}
170+
];
171+
}
172+
173+
// Message sent by the client for the `ListPhraseSet` method.
174+
message ListPhraseSetRequest {
175+
// Required. The parent, which owns this collection of phrase set.
176+
// Format:
177+
// projects/{project}/locations/{location}
178+
string parent = 1 [
179+
(google.api.field_behavior) = REQUIRED,
180+
(google.api.resource_reference) = {
181+
child_type: "speech.googleapis.com/PhraseSet"
182+
}
183+
];
184+
185+
// The maximum number of phrase sets to return. The service may return
186+
// fewer than this value. If unspecified, at most 50 phrase sets will be
187+
// returned. The maximum value is 1000; values above 1000 will be coerced to
188+
// 1000.
189+
int32 page_size = 2;
190+
191+
// A page token, received from a previous `ListPhraseSet` call.
192+
// Provide this to retrieve the subsequent page.
193+
//
194+
// When paginating, all other parameters provided to `ListPhraseSet` must
195+
// match the call that provided the page token.
196+
string page_token = 3;
197+
}
198+
199+
// Message returned to the client by the `ListPhraseSet` method.
200+
message ListPhraseSetResponse {
201+
// The phrase set.
202+
repeated PhraseSet phrase_sets = 1;
203+
204+
// A token, which can be sent as `page_token` to retrieve the next page.
205+
// If this field is omitted, there are no subsequent pages.
206+
string next_page_token = 2;
207+
}
208+
209+
// Message sent by the client for the `DeletePhraseSet` method.
210+
message DeletePhraseSetRequest {
211+
// Required. The name of the phrase set to delete.
212+
// Format:
213+
// {api_version}/projects/{project}/locations/{location}/phraseSets/{phrase_set}
214+
string name = 1 [
215+
(google.api.field_behavior) = REQUIRED,
216+
(google.api.resource_reference) = {
217+
type: "speech.googleapis.com/PhraseSet"
218+
}
219+
];
220+
}
221+
222+
// Message sent by the client for the `CreateCustomClass` method.
223+
message CreateCustomClassRequest {
224+
// Required. The parent resource where this custom class will be created.
225+
// Format:
226+
// {api_version}/projects/{project}/locations/{location}/customClasses
227+
string parent = 1 [
228+
(google.api.field_behavior) = REQUIRED,
229+
(google.api.resource_reference) = {
230+
child_type: "speech.googleapis.com/CustomClass"
231+
}
232+
];
233+
234+
// The ID to use for the custom class, which will become the final
235+
// component of the custom class' resource name.
236+
//
237+
// This value should be 4-63 characters, and valid characters
238+
// are /[a-z][0-9]-/.
239+
string custom_class_id = 2;
240+
241+
// Required. The custom class to create.
242+
CustomClass custom_class = 3 [(google.api.field_behavior) = REQUIRED];
243+
}
244+
245+
// Message sent by the client for the `UpdateCustomClass` method.
246+
message UpdateCustomClassRequest {
247+
// Required. The custom class to update.
248+
//
249+
// The custom class's `name` field is used to identify the custom class to be
250+
// updated. Format:
251+
// {api_version}/projects/{project}/locations/{location}/customClasses/{custom_class}
252+
CustomClass custom_class = 1 [(google.api.field_behavior) = REQUIRED];
253+
254+
// The list of fields to be updated.
255+
google.protobuf.FieldMask update_mask = 2;
256+
}
257+
258+
// Message sent by the client for the `GetCustomClass` method.
259+
message GetCustomClassRequest {
260+
// Required. The name of the custom class to retrieve.
261+
// Format:
262+
// {api_version}/projects/{project}/locations/{location}/customClasses/{custom_class}
263+
string name = 1 [
264+
(google.api.field_behavior) = REQUIRED,
265+
(google.api.resource_reference) = {
266+
type: "speech.googleapis.com/CustomClass"
267+
}
268+
];
269+
}
270+
271+
// Message sent by the client for the `ListCustomClasses` method.
272+
message ListCustomClassesRequest {
273+
// Required. The parent, which owns this collection of custom classes.
274+
// Format:
275+
// {api_version}/projects/{project}/locations/{location}/customClasses
276+
string parent = 1 [
277+
(google.api.field_behavior) = REQUIRED,
278+
(google.api.resource_reference) = {
279+
child_type: "speech.googleapis.com/CustomClass"
280+
}
281+
];
282+
283+
// The maximum number of custom classes to return. The service may return
284+
// fewer than this value. If unspecified, at most 50 custom classes will be
285+
// returned. The maximum value is 1000; values above 1000 will be coerced to
286+
// 1000.
287+
int32 page_size = 2;
288+
289+
// A page token, received from a previous `ListCustomClass` call.
290+
// Provide this to retrieve the subsequent page.
291+
//
292+
// When paginating, all other parameters provided to `ListCustomClass` must
293+
// match the call that provided the page token.
294+
string page_token = 3;
295+
}
296+
297+
// Message returned to the client by the `ListCustomClasses` method.
298+
message ListCustomClassesResponse {
299+
// The custom classes.
300+
repeated CustomClass custom_classes = 1;
301+
302+
// A token, which can be sent as `page_token` to retrieve the next page.
303+
// If this field is omitted, there are no subsequent pages.
304+
string next_page_token = 2;
305+
}
306+
307+
// Message sent by the client for the `DeleteCustomClass` method.
308+
message DeleteCustomClassRequest {
309+
// Required. The name of the custom class to delete.
310+
// Format:
311+
// {api_version}/projects/{project}/locations/{location}/customClasses/{custom_class}
312+
string name = 1 [
313+
(google.api.field_behavior) = REQUIRED,
314+
(google.api.resource_reference) = {
315+
type: "speech.googleapis.com/CustomClass"
316+
}
317+
];
318+
}

0 commit comments

Comments
 (0)