Skip to content

Commit c73d0da

Browse files
Google APIscopybara-github
authored andcommitted
feat: add agent answer feedback capability
feat: add fields for supporting barge-in in StreamingDetectIntent API feat: add end_user_metadata to QueryParameters feat: add boost & bury and filter ES controls PiperOrigin-RevId: 583523426
1 parent f859ca0 commit c73d0da

5 files changed

Lines changed: 255 additions & 9 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ load(
403403

404404
csharp_proto_library(
405405
name = "cx_csharp_proto",
406+
extra_opts = [],
406407
deps = [":cx_proto"],
407408
)
408409

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,15 @@ message Agent {
245245
string engine = 1 [(google.api.field_behavior) = REQUIRED];
246246
}
247247

248+
// Settings for answer feedback collection.
249+
message AnswerFeedbackSettings {
250+
// Optional. If enabled, end users will be able to provide
251+
// [answer feedback][google.cloud.dialogflow.cx.v3beta1.AnswerFeedback] to
252+
// Dialogflow responses. Feature works only if interaction logging is
253+
// enabled in the Dialogflow agent.
254+
bool enable_answer_feedback = 1 [(google.api.field_behavior) = OPTIONAL];
255+
}
256+
248257
// The unique identifier of the agent.
249258
// Required for the
250259
// [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3beta1.Agents.UpdateAgent]
@@ -335,6 +344,10 @@ message Agent {
335344

336345
// Gen App Builder-related agent-level settings.
337346
optional GenAppBuilderSettings gen_app_builder_settings = 33;
347+
348+
// Optional. Answer feedback collection settings.
349+
AnswerFeedbackSettings answer_feedback_settings = 38
350+
[(google.api.field_behavior) = OPTIONAL];
338351
}
339352

340353
// The request message for

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,39 @@ message SpeechWordInfo {
151151
float confidence = 4;
152152
}
153153

154+
// Configuration of the barge-in behavior. Barge-in instructs the API to return
155+
// a detected utterance at a proper time while the client is playing back the
156+
// response audio from a previous request. When the client sees the
157+
// utterance, it should stop the playback and immediately get ready for
158+
// receiving the responses for the current request.
159+
//
160+
// The barge-in handling requires the client to start streaming audio input
161+
// as soon as it starts playing back the audio from the previous response. The
162+
// playback is modeled into two phases:
163+
//
164+
// * No barge-in phase: which goes first and during which speech detection
165+
// should not be carried out.
166+
//
167+
// * Barge-in phase: which follows the no barge-in phase and during which
168+
// the API starts speech detection and may inform the client that an utterance
169+
// has been detected. Note that no-speech event is not expected in this
170+
// phase.
171+
//
172+
// The client provides this configuration in terms of the durations of those
173+
// two phases. The durations are measured in terms of the audio length from the
174+
// the start of the input audio.
175+
//
176+
// No-speech event is a response with END_OF_UTTERANCE without any transcript
177+
// following up.
178+
message BargeInConfig {
179+
// Duration that is not eligible for barge-in at the beginning of the input
180+
// audio.
181+
google.protobuf.Duration no_barge_in_duration = 1;
182+
183+
// Total duration for the playback at the beginning of the input audio.
184+
google.protobuf.Duration total_duration = 2;
185+
}
186+
154187
// Instructs the speech recognizer on how to process the audio content.
155188
message InputAudioConfig {
156189
// Required. Audio encoding of the audio content to process.
@@ -211,6 +244,9 @@ message InputAudioConfig {
211244
// needed.
212245
// Note: This setting is relevant only for streaming methods.
213246
bool single_utterance = 8;
247+
248+
// Configuration of barge-in behavior during the streaming of input audio.
249+
BargeInConfig barge_in_config = 15;
214250
}
215251

216252
// Gender of the voice as described in

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,6 @@ service EntityTypes {
4040
"https://www.googleapis.com/auth/cloud-platform,"
4141
"https://www.googleapis.com/auth/dialogflow";
4242

43-
// Returns the list of all entity types in the specified agent.
44-
rpc ListEntityTypes(ListEntityTypesRequest)
45-
returns (ListEntityTypesResponse) {
46-
option (google.api.http) = {
47-
get: "/v3beta1/{parent=projects/*/locations/*/agents/*}/entityTypes"
48-
};
49-
option (google.api.method_signature) = "parent";
50-
}
51-
5243
// Retrieves the specified entity type.
5344
rpc GetEntityType(GetEntityTypeRequest) returns (EntityType) {
5445
option (google.api.http) = {
@@ -91,6 +82,15 @@ service EntityTypes {
9182
};
9283
option (google.api.method_signature) = "name";
9384
}
85+
86+
// Returns the list of all entity types in the specified agent.
87+
rpc ListEntityTypes(ListEntityTypesRequest)
88+
returns (ListEntityTypesResponse) {
89+
option (google.api.http) = {
90+
get: "/v3beta1/{parent=projects/*/locations/*/agents/*}/entityTypes"
91+
};
92+
option (google.api.method_signature) = "parent";
93+
}
9494
}
9595

9696
// Entities are extracted from user input and represent parameters that are

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

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import "google/cloud/dialogflow/cx/v3beta1/page.proto";
2727
import "google/cloud/dialogflow/cx/v3beta1/response_message.proto";
2828
import "google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto";
2929
import "google/protobuf/duration.proto";
30+
import "google/protobuf/field_mask.proto";
3031
import "google/protobuf/struct.proto";
3132
import "google/rpc/status.proto";
3233
import "google/type/latlng.proto";
@@ -44,6 +45,11 @@ option (google.api.resource_definition) = {
4445
pattern: "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}"
4546
pattern: "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}"
4647
};
48+
option (google.api.resource_definition) = {
49+
type: "discoveryengine.googleapis.com/DataStore"
50+
pattern: "projects/{project}/locations/{location}/dataStores/{data_store}"
51+
pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}"
52+
};
4753

4854
// A session represents an interaction with a user. You retrieve user input
4955
// and pass it to the
@@ -114,6 +120,78 @@ service Sessions {
114120
}
115121
};
116122
}
123+
124+
// Updates the feedback received from the user for a single turn of the bot
125+
// response.
126+
rpc SubmitAnswerFeedback(SubmitAnswerFeedbackRequest)
127+
returns (AnswerFeedback) {
128+
option (google.api.http) = {
129+
post: "/v3beta1/{session=projects/*/locations/*/agents/*/sessions/*}:submitAnswerFeedback"
130+
body: "*"
131+
};
132+
}
133+
}
134+
135+
// Stores information about feedback provided by users about a response.
136+
message AnswerFeedback {
137+
// Represents thumbs up/down rating provided by user about a response.
138+
enum Rating {
139+
// Rating not specified.
140+
RATING_UNSPECIFIED = 0;
141+
142+
// Thumbs up feedback from user.
143+
THUMBS_UP = 1;
144+
145+
// Thumbs down feedback from user.
146+
THUMBS_DOWN = 2;
147+
}
148+
149+
// Stores extra information about why users provided thumbs down rating.
150+
message RatingReason {
151+
// Optional. Custom reason labels for thumbs down rating provided by the
152+
// user. The maximum number of labels allowed is 10 and the maximum length
153+
// of a single label is 128 characters.
154+
repeated string reason_labels = 3 [(google.api.field_behavior) = OPTIONAL];
155+
156+
// Optional. Additional feedback about the rating.
157+
// This field can be populated without choosing a predefined `reason`.
158+
string feedback = 2 [(google.api.field_behavior) = OPTIONAL];
159+
}
160+
161+
// Optional. Rating from user for the specific Dialogflow response.
162+
Rating rating = 1 [(google.api.field_behavior) = OPTIONAL];
163+
164+
// Optional. In case of thumbs down rating provided, users can optionally
165+
// provide context about the rating.
166+
RatingReason rating_reason = 2 [(google.api.field_behavior) = OPTIONAL];
167+
168+
// Optional. Custom rating from the user about the provided answer, with
169+
// maximum length of 1024 characters. For example, client could use a
170+
// customized JSON object to indicate the rating.
171+
string custom_rating = 3 [(google.api.field_behavior) = OPTIONAL];
172+
}
173+
174+
// The request to set the feedback for a bot answer.
175+
message SubmitAnswerFeedbackRequest {
176+
// Required. The name of the session the feedback was sent to.
177+
string session = 1 [
178+
(google.api.field_behavior) = REQUIRED,
179+
(google.api.resource_reference) = {
180+
type: "dialogflow.googleapis.com/Session"
181+
}
182+
];
183+
184+
// Required. ID of the response to update its feedback. This is the same as
185+
// DetectIntentResponse.response_id.
186+
string response_id = 2 [(google.api.field_behavior) = REQUIRED];
187+
188+
// Required. Feedback provided for a bot answer.
189+
AnswerFeedback answer_feedback = 3 [(google.api.field_behavior) = REQUIRED];
190+
191+
// Optional. The mask to control which fields to update. If the mask is not
192+
// present, all fields will be updated.
193+
google.protobuf.FieldMask update_mask = 4
194+
[(google.api.field_behavior) = OPTIONAL];
117195
}
118196

119197
// The request to detect user's intent.
@@ -609,6 +687,120 @@ message QueryParameters {
609687
// This value should be no longer than 1 day.
610688
google.protobuf.Duration session_ttl = 16
611689
[(google.api.field_behavior) = OPTIONAL];
690+
691+
// Optional. Information about the end-user to improve the relevance and
692+
// accuracy of generative answers.
693+
//
694+
// This will be interpreted and used by a language model, so, for good
695+
// results, the data should be self-descriptive, and in a simple structure.
696+
//
697+
// Example:
698+
//
699+
// ```json
700+
// {
701+
// "subscription plan": "Business Premium Plus",
702+
// "devices owned": [
703+
// {"model": "Google Pixel 7"},
704+
// {"model": "Google Pixel Tablet"}
705+
// ]
706+
// }
707+
// ```
708+
google.protobuf.Struct end_user_metadata = 18
709+
[(google.api.field_behavior) = OPTIONAL];
710+
711+
// Optional. Search configuration for UCS search queries.
712+
SearchConfig search_config = 20 [(google.api.field_behavior) = OPTIONAL];
713+
}
714+
715+
// Search configuration for UCS search queries.
716+
message SearchConfig {
717+
// Optional. Boosting configuration for the datastores.
718+
repeated BoostSpecs boost_specs = 1 [(google.api.field_behavior) = OPTIONAL];
719+
720+
// Optional. Filter configuration for the datastores.
721+
repeated FilterSpecs filter_specs = 2
722+
[(google.api.field_behavior) = OPTIONAL];
723+
}
724+
725+
// Boost specification to boost certain documents.
726+
// A copy of google.cloud.discoveryengine.v1main.BoostSpec, field documentation
727+
// is available at
728+
// https://cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1alpha/BoostSpec
729+
message BoostSpec {
730+
// Boost applies to documents which match a condition.
731+
message ConditionBoostSpec {
732+
// Optional. An expression which specifies a boost condition. The syntax and
733+
// supported fields are the same as a filter expression.
734+
// Examples:
735+
//
736+
// * To boost documents with document ID "doc_1" or "doc_2", and
737+
// color
738+
// "Red" or "Blue":
739+
// * (id: ANY("doc_1", "doc_2")) AND (color: ANY("Red","Blue"))
740+
string condition = 1 [(google.api.field_behavior) = OPTIONAL];
741+
742+
// Optional. Strength of the condition boost, which should be in [-1, 1].
743+
// Negative boost means demotion. Default is 0.0.
744+
//
745+
// Setting to 1.0 gives the document a big promotion. However, it does not
746+
// necessarily mean that the boosted document will be the top result at
747+
// all times, nor that other documents will be excluded. Results could
748+
// still be shown even when none of them matches the condition. And
749+
// results that are significantly more relevant to the search query can
750+
// still trump your heavily favored but irrelevant documents.
751+
//
752+
// Setting to -1.0 gives the document a big demotion. However, results
753+
// that are deeply relevant might still be shown. The document will have
754+
// an upstream battle to get a fairly high ranking, but it is not blocked
755+
// out completely.
756+
//
757+
// Setting to 0.0 means no boost applied. The boosting condition is
758+
// ignored.
759+
float boost = 2 [(google.api.field_behavior) = OPTIONAL];
760+
}
761+
762+
// Optional. Condition boost specifications. If a document matches multiple
763+
// conditions in the specifictions, boost scores from these specifications are
764+
// all applied and combined in a non-linear way. Maximum number of
765+
// specifications is 20.
766+
repeated ConditionBoostSpec condition_boost_specs = 1
767+
[(google.api.field_behavior) = OPTIONAL];
768+
}
769+
770+
// Boost specifications for data stores.
771+
message BoostSpecs {
772+
// Optional. Data Stores where the boosting configuration is applied. The full
773+
// names of the referenced data stores. Formats:
774+
// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`
775+
// `projects/{project}/locations/{location}/dataStores/{data_store}
776+
repeated string data_stores = 1 [
777+
(google.api.field_behavior) = OPTIONAL,
778+
(google.api.resource_reference) = {
779+
type: "discoveryengine.googleapis.com/DataStore"
780+
}
781+
];
782+
783+
// Optional. A list of boosting specifications.
784+
repeated BoostSpec spec = 2 [(google.api.field_behavior) = OPTIONAL];
785+
}
786+
787+
// Filter specifications for data stores.
788+
message FilterSpecs {
789+
// Optional. Data Stores where the boosting configuration is applied. The full
790+
// names of the referenced data stores. Formats:
791+
// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`
792+
// `projects/{project}/locations/{location}/dataStores/{data_store}
793+
repeated string data_stores = 1 [
794+
(google.api.field_behavior) = OPTIONAL,
795+
(google.api.resource_reference) = {
796+
type: "discoveryengine.googleapis.com/DataStore"
797+
}
798+
];
799+
800+
// Optional. The filter expression to be applied.
801+
// Expression syntax is documented at
802+
// https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata#filter-expression-syntax
803+
string filter = 2 [(google.api.field_behavior) = OPTIONAL];
612804
}
613805

614806
// Represents the query input. It can contain one of:
@@ -774,6 +966,10 @@ message QueryResult {
774966
// Dialogflow exports audio to Google Cloud Storage, then the client may need
775967
// to wait for the resulting object to appear in the bucket before proceeding.
776968
AdvancedSettings advanced_settings = 21;
969+
970+
// Indicates whether the Thumbs up/Thumbs down rating controls are need to be
971+
// shown for the response in the Dialogflow Messenger widget.
972+
bool allow_answer_feedback = 32;
777973
}
778974

779975
// Represents the natural language text to be processed.

0 commit comments

Comments
 (0)