Skip to content

Commit e8148d6

Browse files
Google APIscopybara-github
authored andcommitted
feat: added Generator API
docs: updated doc for speech mode PiperOrigin-RevId: 586469693
1 parent 44582d0 commit e8148d6

5 files changed

Lines changed: 264 additions & 4 deletions

File tree

google/cloud/dialogflow/cx/v3/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.v3.ExperimentsClientTest",
134135
"com.google.cloud.dialogflow.cx.v3.FlowsClientHttpJsonTest",
135136
"com.google.cloud.dialogflow.cx.v3.FlowsClientTest",
137+
"com.google.cloud.dialogflow.cx.v3.GeneratorsClientHttpJsonTest",
138+
"com.google.cloud.dialogflow.cx.v3.GeneratorsClientTest",
136139
"com.google.cloud.dialogflow.cx.v3.IntentsClientHttpJsonTest",
137140
"com.google.cloud.dialogflow.cx.v3.IntentsClientTest",
138141
"com.google.cloud.dialogflow.cx.v3.PagesClientHttpJsonTest",
@@ -404,7 +407,6 @@ load(
404407

405408
csharp_proto_library(
406409
name = "cx_csharp_proto",
407-
extra_opts = [],
408410
deps = [":cx_proto"],
409411
)
410412

google/cloud/dialogflow/cx/v3/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/v3/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.v3.Fulfillments"
2828
},
29+
{
30+
"service": "google.cloud.dialogflow.cx.v3.Generators"
31+
},
2932
{
3033
"service": "google.cloud.dialogflow.cx.v3.Intents"
3134
},
@@ -109,6 +112,10 @@
109112
{
110113
"service": "google.cloud.dialogflow.cx.v3.Sessions",
111114
"method": "StreamingDetectIntent"
115+
},
116+
{
117+
"service": "google.cloud.dialogflow.cx.v3.Sessions",
118+
"method": "ServerStreamingDetectIntent"
112119
}
113120
],
114121
"timeout": "220s"

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

0 commit comments

Comments
 (0)