Skip to content

Commit 86c7ca6

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: 583522403
1 parent 6fd67df commit 86c7ca6

5 files changed

Lines changed: 255 additions & 9 deletions

File tree

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

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

405405
csharp_proto_library(
406406
name = "cx_csharp_proto",
407+
extra_opts = [],
407408
deps = [":cx_proto"],
408409
)
409410

google/cloud/dialogflow/cx/v3/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.v3.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.v3.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/v3/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/v3/entity_type.proto

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

42-
// Returns the list of all entity types in the specified agent.
43-
rpc ListEntityTypes(ListEntityTypesRequest)
44-
returns (ListEntityTypesResponse) {
45-
option (google.api.http) = {
46-
get: "/v3/{parent=projects/*/locations/*/agents/*}/entityTypes"
47-
};
48-
option (google.api.method_signature) = "parent";
49-
}
50-
5142
// Retrieves the specified entity type.
5243
rpc GetEntityType(GetEntityTypeRequest) returns (EntityType) {
5344
option (google.api.http) = {
@@ -94,6 +85,15 @@ service EntityTypes {
9485
};
9586
option (google.api.method_signature) = "name";
9687
}
88+
89+
// Returns the list of all entity types in the specified agent.
90+
rpc ListEntityTypes(ListEntityTypesRequest)
91+
returns (ListEntityTypesResponse) {
92+
option (google.api.http) = {
93+
get: "/v3/{parent=projects/*/locations/*/agents/*}/entityTypes"
94+
};
95+
option (google.api.method_signature) = "parent";
96+
}
9797
}
9898

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

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

612804
// Represents the query input. It can contain one of:
@@ -772,6 +964,10 @@ message QueryResult {
772964
// Dialogflow exports audio to Google Cloud Storage, then the client may need
773965
// to wait for the resulting object to appear in the bucket before proceeding.
774966
AdvancedSettings advanced_settings = 21;
967+
968+
// Indicates whether the Thumbs up/Thumbs down rating controls are need to be
969+
// shown for the response in the Dialogflow Messenger widget.
970+
bool allow_answer_feedback = 32;
775971
}
776972

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

0 commit comments

Comments
 (0)