Skip to content

Commit 17d36c4

Browse files
Google APIscopybara-github
authored andcommitted
feat: added Generator API
docs: updated doc for speech model PiperOrigin-RevId: 586288282
1 parent 8bd48a7 commit 17d36c4

File tree

5 files changed

+265
-4
lines changed

5 files changed

+265
-4
lines changed

google/cloud/dialogflow/cx/v3beta1/BUILD.bazel

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ proto_library(
3434
"fulfillment.proto",
3535
"gcs.proto",
3636
"generative_settings.proto",
37+
"generator.proto",
3738
"import_strategy.proto",
3839
"inline.proto",
3940
"intent.proto",
@@ -133,6 +134,8 @@ java_gapic_test(
133134
"com.google.cloud.dialogflow.cx.v3beta1.ExperimentsClientTest",
134135
"com.google.cloud.dialogflow.cx.v3beta1.FlowsClientHttpJsonTest",
135136
"com.google.cloud.dialogflow.cx.v3beta1.FlowsClientTest",
137+
"com.google.cloud.dialogflow.cx.v3beta1.GeneratorsClientHttpJsonTest",
138+
"com.google.cloud.dialogflow.cx.v3beta1.GeneratorsClientTest",
136139
"com.google.cloud.dialogflow.cx.v3beta1.IntentsClientHttpJsonTest",
137140
"com.google.cloud.dialogflow.cx.v3beta1.IntentsClientTest",
138141
"com.google.cloud.dialogflow.cx.v3beta1.PagesClientHttpJsonTest",
@@ -403,7 +406,6 @@ load(
403406

404407
csharp_proto_library(
405408
name = "cx_csharp_proto",
406-
extra_opts = [],
407409
deps = [":cx_proto"],
408410
)
409411

google/cloud/dialogflow/cx/v3beta1/audio_config.proto

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ message InputAudioConfig {
214214

215215
// Optional. Which Speech model to select for the given request. Select the
216216
// model best suited to your domain to get best results. If a model is not
217-
// explicitly specified, then we auto-select a model based on the parameters
218-
// in the InputAudioConfig.
217+
// explicitly specified, then Dialogflow auto-selects a model based on other
218+
// parameters in the InputAudioConfig and Agent settings.
219219
// If enhanced speech model is enabled for the agent and an enhanced
220220
// version of the specified model for the language does not exist, then the
221221
// speech is recognized using the standard version of the specified model.
@@ -228,7 +228,12 @@ message InputAudioConfig {
228228
//
229229
// - phone_call (best for Agent Assist and telephony)
230230
// - latest_short (best for Dialogflow non-telephony)
231-
// - command_and_search (best for very short utterances and commands)
231+
// - command_and_search
232+
//
233+
// Leave this field unspecified to use
234+
// [Agent Speech
235+
// settings](https://cloud.google.com/dialogflow/cx/docs/concept/agent#settings-speech)
236+
// for model selection.
232237
string model = 7;
233238

234239
// Optional. Which variant of the [Speech

google/cloud/dialogflow/cx/v3beta1/dialogflow_grpc_service_config.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
{
2727
"service": "google.cloud.dialogflow.cx.v3beta1.Fulfillments"
2828
},
29+
{
30+
"service": "google.cloud.dialogflow.cx.v3beta1.Generators"
31+
},
2932
{
3033
"service": "google.cloud.dialogflow.cx.v3beta1.Intents"
3134
},
@@ -106,6 +109,10 @@
106109
},
107110
{
108111
"name": [
112+
{
113+
"service": "google.cloud.dialogflow.cx.v3beta1.Sessions",
114+
"method": "ServerStreamingDetectIntent"
115+
},
109116
{
110117
"service": "google.cloud.dialogflow.cx.v3beta1.Sessions",
111118
"method": "StreamingDetectIntent"

google/cloud/dialogflow/cx/v3beta1/dialogflow_v3beta1.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ apis:
1111
- name: google.cloud.dialogflow.cx.v3beta1.Environments
1212
- name: google.cloud.dialogflow.cx.v3beta1.Experiments
1313
- name: google.cloud.dialogflow.cx.v3beta1.Flows
14+
- name: google.cloud.dialogflow.cx.v3beta1.Generators
1415
- name: google.cloud.dialogflow.cx.v3beta1.Intents
1516
- name: google.cloud.dialogflow.cx.v3beta1.Pages
1617
- name: google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService
@@ -140,6 +141,11 @@ authentication:
140141
canonical_scopes: |-
141142
https://www.googleapis.com/auth/cloud-platform,
142143
https://www.googleapis.com/auth/dialogflow
144+
- selector: 'google.cloud.dialogflow.cx.v3beta1.Generators.*'
145+
oauth:
146+
canonical_scopes: |-
147+
https://www.googleapis.com/auth/cloud-platform,
148+
https://www.googleapis.com/auth/dialogflow
143149
- selector: 'google.cloud.dialogflow.cx.v3beta1.Intents.*'
144150
oauth:
145151
canonical_scopes: |-
Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
// Copyright 2023 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.dialogflow.cx.v3beta1;
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/protobuf/empty.proto";
24+
import "google/protobuf/field_mask.proto";
25+
26+
option cc_enable_arenas = true;
27+
option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1";
28+
option go_package = "cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb;cxpb";
29+
option java_multiple_files = true;
30+
option java_outer_classname = "GeneratorProto";
31+
option java_package = "com.google.cloud.dialogflow.cx.v3beta1";
32+
option objc_class_prefix = "DF";
33+
34+
// Service for managing
35+
// [Generators][google.cloud.dialogflow.cx.v3beta1.Generator]
36+
service Generators {
37+
option (google.api.default_host) = "dialogflow.googleapis.com";
38+
option (google.api.oauth_scopes) =
39+
"https://www.googleapis.com/auth/cloud-platform,"
40+
"https://www.googleapis.com/auth/dialogflow";
41+
42+
// Returns the list of all generators in the specified agent.
43+
rpc ListGenerators(ListGeneratorsRequest) returns (ListGeneratorsResponse) {
44+
option (google.api.http) = {
45+
get: "/v3beta1/{parent=projects/*/locations/*/agents/*}/generators"
46+
};
47+
option (google.api.method_signature) = "parent";
48+
}
49+
50+
// Retrieves the specified generator.
51+
rpc GetGenerator(GetGeneratorRequest) returns (Generator) {
52+
option (google.api.http) = {
53+
get: "/v3beta1/{name=projects/*/locations/*/agents/*/generators/*}"
54+
};
55+
option (google.api.method_signature) = "name";
56+
}
57+
58+
// Creates a generator in the specified agent.
59+
rpc CreateGenerator(CreateGeneratorRequest) returns (Generator) {
60+
option (google.api.http) = {
61+
post: "/v3beta1/{parent=projects/*/locations/*/agents/*}/generators"
62+
body: "generator"
63+
};
64+
option (google.api.method_signature) = "parent,generator";
65+
}
66+
67+
// Update the specified generator.
68+
rpc UpdateGenerator(UpdateGeneratorRequest) returns (Generator) {
69+
option (google.api.http) = {
70+
patch: "/v3beta1/{generator.name=projects/*/locations/*/agents/*/generators/*}"
71+
body: "generator"
72+
};
73+
option (google.api.method_signature) = "generator,update_mask";
74+
}
75+
76+
// Deletes the specified generators.
77+
rpc DeleteGenerator(DeleteGeneratorRequest) returns (google.protobuf.Empty) {
78+
option (google.api.http) = {
79+
delete: "/v3beta1/{name=projects/*/locations/*/agents/*/generators/*}"
80+
};
81+
option (google.api.method_signature) = "name";
82+
}
83+
}
84+
85+
// Generators contain prompt to be sent to the LLM model to generate text. The
86+
// prompt can contain parameters which will be resolved before calling the
87+
// model. It can optionally contain banned phrases to ensure the model responses
88+
// are safe.
89+
message Generator {
90+
option (google.api.resource) = {
91+
type: "dialogflow.googleapis.com/Generator"
92+
pattern: "projects/{project}/locations/{location}/agents/{agent}/generators/{generator}"
93+
};
94+
95+
// Represents a custom placeholder in the prompt text.
96+
message Placeholder {
97+
// Unique ID used to map custom placeholder to parameters in fulfillment.
98+
string id = 1;
99+
100+
// Custom placeholder value in the prompt text.
101+
string name = 2;
102+
}
103+
104+
// The unique identifier of the generator.
105+
// Must be set for the
106+
// [Generators.UpdateGenerator][google.cloud.dialogflow.cx.v3beta1.Generators.UpdateGenerator]
107+
// method. [Generators.CreateGenerate][] populates the name automatically.
108+
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
109+
// ID>/generators/<Generator ID>`.
110+
string name = 1;
111+
112+
// Required. The human-readable name of the generator, unique within the
113+
// agent. The prompt contains pre-defined parameters such as $conversation,
114+
// $last-user-utterance, etc. populated by Dialogflow. It can also contain
115+
// custom placeholders which will be resolved during fulfillment.
116+
string display_name = 2 [(google.api.field_behavior) = REQUIRED];
117+
118+
// Required. Prompt for the LLM model.
119+
Phrase prompt_text = 3 [(google.api.field_behavior) = REQUIRED];
120+
121+
// Optional. List of custom placeholders in the prompt text.
122+
repeated Placeholder placeholders = 5
123+
[(google.api.field_behavior) = OPTIONAL];
124+
}
125+
126+
// Text input which can be used for prompt or banned phrases.
127+
message Phrase {
128+
// Required. Text input which can be used for prompt or banned phrases.
129+
string text = 1 [(google.api.field_behavior) = REQUIRED];
130+
}
131+
132+
// The request message for
133+
// [Generators.ListGenerators][google.cloud.dialogflow.cx.v3beta1.Generators.ListGenerators].
134+
message ListGeneratorsRequest {
135+
// Required. The agent to list all generators for.
136+
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
137+
string parent = 1 [
138+
(google.api.field_behavior) = REQUIRED,
139+
(google.api.resource_reference) = {
140+
child_type: "dialogflow.googleapis.com/Generator"
141+
}
142+
];
143+
144+
// The language to list generators for.
145+
string language_code = 2;
146+
147+
// The maximum number of items to return in a single page. By default 100 and
148+
// at most 1000.
149+
int32 page_size = 3;
150+
151+
// The next_page_token value returned from a previous list request.
152+
string page_token = 4;
153+
}
154+
155+
// The response message for
156+
// [Generators.ListGenerators][google.cloud.dialogflow.cx.v3beta1.Generators.ListGenerators].
157+
message ListGeneratorsResponse {
158+
// The list of generators. There will be a maximum number of items returned
159+
// based on the page_size field in the request.
160+
repeated Generator generators = 1;
161+
162+
// Token to retrieve the next page of results, or empty if there are no more
163+
// results in the list.
164+
string next_page_token = 2;
165+
}
166+
167+
// The request message for
168+
// [Generators.GetGenerator][google.cloud.dialogflow.cx.v3beta1.Generators.GetGenerator].
169+
message GetGeneratorRequest {
170+
// Required. The name of the generator.
171+
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
172+
// ID>/generators/<Generator ID>`.
173+
string name = 1 [
174+
(google.api.field_behavior) = REQUIRED,
175+
(google.api.resource_reference) = {
176+
type: "dialogflow.googleapis.com/Generator"
177+
}
178+
];
179+
180+
// The language to list generators for.
181+
string language_code = 2;
182+
}
183+
184+
// The request message for
185+
// [Generators.CreateGenerator][google.cloud.dialogflow.cx.v3beta1.Generators.CreateGenerator].
186+
message CreateGeneratorRequest {
187+
// Required. The agent to create a generator for.
188+
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
189+
string parent = 1 [
190+
(google.api.field_behavior) = REQUIRED,
191+
(google.api.resource_reference) = {
192+
child_type: "dialogflow.googleapis.com/Generator"
193+
}
194+
];
195+
196+
// Required. The generator to create.
197+
Generator generator = 2 [(google.api.field_behavior) = REQUIRED];
198+
199+
// The language to create generators for the following fields:
200+
// * `Generator.prompt_text.text`
201+
// If not specified, the agent's default language is used.
202+
string language_code = 3;
203+
}
204+
205+
// The request message for
206+
// [Generators.UpdateGenerator][google.cloud.dialogflow.cx.v3beta1.Generators.UpdateGenerator].
207+
message UpdateGeneratorRequest {
208+
// Required. The generator to update.
209+
Generator generator = 1 [(google.api.field_behavior) = REQUIRED];
210+
211+
// The language to list generators for.
212+
string language_code = 2;
213+
214+
// The mask to control which fields get updated. If the mask is not present,
215+
// all fields will be updated.
216+
google.protobuf.FieldMask update_mask = 3;
217+
}
218+
219+
// The request message for
220+
// [Generators.DeleteGenerator][google.cloud.dialogflow.cx.v3beta1.Generators.DeleteGenerator].
221+
message DeleteGeneratorRequest {
222+
// Required. The name of the generator to delete.
223+
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
224+
// ID>/generators/<Generator ID>`.
225+
string name = 1 [
226+
(google.api.field_behavior) = REQUIRED,
227+
(google.api.resource_reference) = {
228+
type: "dialogflow.googleapis.com/Generator"
229+
}
230+
];
231+
232+
// This field has no effect for generators not being used.
233+
// For generators that are used by pages/flows/transition route groups:
234+
//
235+
// * If `force` is set to false, an error will be returned with message
236+
// indicating the referenced resources.
237+
// * If `force` is set to true, Dialogflow will remove the generator, as well
238+
// as any references to the generator (i.e.
239+
// [Generator][Fulfillment.generator]) in fulfillments.
240+
bool force = 2;
241+
}

0 commit comments

Comments
 (0)