diff --git a/google/cloud/dialogflow/cx/v3/BUILD.bazel b/google/cloud/dialogflow/cx/v3/BUILD.bazel index ae02262e49..241446c154 100644 --- a/google/cloud/dialogflow/cx/v3/BUILD.bazel +++ b/google/cloud/dialogflow/cx/v3/BUILD.bazel @@ -404,6 +404,7 @@ load( csharp_proto_library( name = "cx_csharp_proto", + extra_opts = [], deps = [":cx_proto"], ) diff --git a/google/cloud/dialogflow/cx/v3/agent.proto b/google/cloud/dialogflow/cx/v3/agent.proto index 7a086796fc..9a937500c1 100644 --- a/google/cloud/dialogflow/cx/v3/agent.proto +++ b/google/cloud/dialogflow/cx/v3/agent.proto @@ -245,6 +245,15 @@ message Agent { string engine = 1 [(google.api.field_behavior) = REQUIRED]; } + // Settings for answer feedback collection. + message AnswerFeedbackSettings { + // Optional. If enabled, end users will be able to provide + // [answer feedback][google.cloud.dialogflow.cx.v3.AnswerFeedback] to + // Dialogflow responses. Feature works only if interaction logging is + // enabled in the Dialogflow agent. + bool enable_answer_feedback = 1 [(google.api.field_behavior) = OPTIONAL]; + } + // The unique identifier of the agent. // Required for the // [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3.Agents.UpdateAgent] @@ -335,6 +344,10 @@ message Agent { // Gen App Builder-related agent-level settings. optional GenAppBuilderSettings gen_app_builder_settings = 33; + + // Optional. Answer feedback collection settings. + AnswerFeedbackSettings answer_feedback_settings = 38 + [(google.api.field_behavior) = OPTIONAL]; } // The request message for diff --git a/google/cloud/dialogflow/cx/v3/audio_config.proto b/google/cloud/dialogflow/cx/v3/audio_config.proto index 7f18827cb9..de62d4313a 100644 --- a/google/cloud/dialogflow/cx/v3/audio_config.proto +++ b/google/cloud/dialogflow/cx/v3/audio_config.proto @@ -151,6 +151,39 @@ message SpeechWordInfo { float confidence = 4; } +// Configuration of the barge-in behavior. Barge-in instructs the API to return +// a detected utterance at a proper time while the client is playing back the +// response audio from a previous request. When the client sees the +// utterance, it should stop the playback and immediately get ready for +// receiving the responses for the current request. +// +// The barge-in handling requires the client to start streaming audio input +// as soon as it starts playing back the audio from the previous response. The +// playback is modeled into two phases: +// +// * No barge-in phase: which goes first and during which speech detection +// should not be carried out. +// +// * Barge-in phase: which follows the no barge-in phase and during which +// the API starts speech detection and may inform the client that an utterance +// has been detected. Note that no-speech event is not expected in this +// phase. +// +// The client provides this configuration in terms of the durations of those +// two phases. The durations are measured in terms of the audio length from the +// the start of the input audio. +// +// No-speech event is a response with END_OF_UTTERANCE without any transcript +// following up. +message BargeInConfig { + // Duration that is not eligible for barge-in at the beginning of the input + // audio. + google.protobuf.Duration no_barge_in_duration = 1; + + // Total duration for the playback at the beginning of the input audio. + google.protobuf.Duration total_duration = 2; +} + // Instructs the speech recognizer on how to process the audio content. message InputAudioConfig { // Required. Audio encoding of the audio content to process. @@ -211,6 +244,9 @@ message InputAudioConfig { // needed. // Note: This setting is relevant only for streaming methods. bool single_utterance = 8; + + // Configuration of barge-in behavior during the streaming of input audio. + BargeInConfig barge_in_config = 15; } // Gender of the voice as described in diff --git a/google/cloud/dialogflow/cx/v3/entity_type.proto b/google/cloud/dialogflow/cx/v3/entity_type.proto index 28b68b5d99..c3f6d2f3d6 100644 --- a/google/cloud/dialogflow/cx/v3/entity_type.proto +++ b/google/cloud/dialogflow/cx/v3/entity_type.proto @@ -39,15 +39,6 @@ service EntityTypes { "https://www.googleapis.com/auth/cloud-platform," "https://www.googleapis.com/auth/dialogflow"; - // Returns the list of all entity types in the specified agent. - rpc ListEntityTypes(ListEntityTypesRequest) - returns (ListEntityTypesResponse) { - option (google.api.http) = { - get: "/v3/{parent=projects/*/locations/*/agents/*}/entityTypes" - }; - option (google.api.method_signature) = "parent"; - } - // Retrieves the specified entity type. rpc GetEntityType(GetEntityTypeRequest) returns (EntityType) { option (google.api.http) = { @@ -94,6 +85,15 @@ service EntityTypes { }; option (google.api.method_signature) = "name"; } + + // Returns the list of all entity types in the specified agent. + rpc ListEntityTypes(ListEntityTypesRequest) + returns (ListEntityTypesResponse) { + option (google.api.http) = { + get: "/v3/{parent=projects/*/locations/*/agents/*}/entityTypes" + }; + option (google.api.method_signature) = "parent"; + } } // Entities are extracted from user input and represent parameters that are diff --git a/google/cloud/dialogflow/cx/v3/session.proto b/google/cloud/dialogflow/cx/v3/session.proto index 9c322fd516..5dcddf3304 100644 --- a/google/cloud/dialogflow/cx/v3/session.proto +++ b/google/cloud/dialogflow/cx/v3/session.proto @@ -27,6 +27,7 @@ import "google/cloud/dialogflow/cx/v3/page.proto"; import "google/cloud/dialogflow/cx/v3/response_message.proto"; import "google/cloud/dialogflow/cx/v3/session_entity_type.proto"; import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; import "google/protobuf/struct.proto"; import "google/rpc/status.proto"; import "google/type/latlng.proto"; @@ -44,6 +45,11 @@ option (google.api.resource_definition) = { pattern: "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}" pattern: "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}" }; +option (google.api.resource_definition) = { + type: "discoveryengine.googleapis.com/DataStore" + pattern: "projects/{project}/locations/{location}/dataStores/{data_store}" + pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}" +}; // A session represents an interaction with a user. You retrieve user input // and pass it to the @@ -114,6 +120,78 @@ service Sessions { } }; } + + // Updates the feedback received from the user for a single turn of the bot + // response. + rpc SubmitAnswerFeedback(SubmitAnswerFeedbackRequest) + returns (AnswerFeedback) { + option (google.api.http) = { + post: "/v3/{session=projects/*/locations/*/agents/*/sessions/*}:submitAnswerFeedback" + body: "*" + }; + } +} + +// Stores information about feedback provided by users about a response. +message AnswerFeedback { + // Represents thumbs up/down rating provided by user about a response. + enum Rating { + // Rating not specified. + RATING_UNSPECIFIED = 0; + + // Thumbs up feedback from user. + THUMBS_UP = 1; + + // Thumbs down feedback from user. + THUMBS_DOWN = 2; + } + + // Stores extra information about why users provided thumbs down rating. + message RatingReason { + // Optional. Custom reason labels for thumbs down rating provided by the + // user. The maximum number of labels allowed is 10 and the maximum length + // of a single label is 128 characters. + repeated string reason_labels = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Additional feedback about the rating. + // This field can be populated without choosing a predefined `reason`. + string feedback = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Rating from user for the specific Dialogflow response. + Rating rating = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. In case of thumbs down rating provided, users can optionally + // provide context about the rating. + RatingReason rating_reason = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Custom rating from the user about the provided answer, with + // maximum length of 1024 characters. For example, client could use a + // customized JSON object to indicate the rating. + string custom_rating = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request to set the feedback for a bot answer. +message SubmitAnswerFeedbackRequest { + // Required. The name of the session the feedback was sent to. + string session = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Session" + } + ]; + + // Required. ID of the response to update its feedback. This is the same as + // DetectIntentResponse.response_id. + string response_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Feedback provided for a bot answer. + AnswerFeedback answer_feedback = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The mask to control which fields to update. If the mask is not + // present, all fields will be updated. + google.protobuf.FieldMask update_mask = 4 + [(google.api.field_behavior) = OPTIONAL]; } // The request to detect user's intent. @@ -607,6 +685,120 @@ message QueryParameters { // This value should be no longer than 1 day. google.protobuf.Duration session_ttl = 16 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Information about the end-user to improve the relevance and + // accuracy of generative answers. + // + // This will be interpreted and used by a language model, so, for good + // results, the data should be self-descriptive, and in a simple structure. + // + // Example: + // + // ```json + // { + // "subscription plan": "Business Premium Plus", + // "devices owned": [ + // {"model": "Google Pixel 7"}, + // {"model": "Google Pixel Tablet"} + // ] + // } + // ``` + google.protobuf.Struct end_user_metadata = 18 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Search configuration for UCS search queries. + SearchConfig search_config = 20 [(google.api.field_behavior) = OPTIONAL]; +} + +// Search configuration for UCS search queries. +message SearchConfig { + // Optional. Boosting configuration for the datastores. + repeated BoostSpecs boost_specs = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Filter configuration for the datastores. + repeated FilterSpecs filter_specs = 2 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Boost specification to boost certain documents. +// A copy of google.cloud.discoveryengine.v1main.BoostSpec, field documentation +// is available at +// https://cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1alpha/BoostSpec +message BoostSpec { + // Boost applies to documents which match a condition. + message ConditionBoostSpec { + // Optional. An expression which specifies a boost condition. The syntax and + // supported fields are the same as a filter expression. + // Examples: + // + // * To boost documents with document ID "doc_1" or "doc_2", and + // color + // "Red" or "Blue": + // * (id: ANY("doc_1", "doc_2")) AND (color: ANY("Red","Blue")) + string condition = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Strength of the condition boost, which should be in [-1, 1]. + // Negative boost means demotion. Default is 0.0. + // + // Setting to 1.0 gives the document a big promotion. However, it does not + // necessarily mean that the boosted document will be the top result at + // all times, nor that other documents will be excluded. Results could + // still be shown even when none of them matches the condition. And + // results that are significantly more relevant to the search query can + // still trump your heavily favored but irrelevant documents. + // + // Setting to -1.0 gives the document a big demotion. However, results + // that are deeply relevant might still be shown. The document will have + // an upstream battle to get a fairly high ranking, but it is not blocked + // out completely. + // + // Setting to 0.0 means no boost applied. The boosting condition is + // ignored. + float boost = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Condition boost specifications. If a document matches multiple + // conditions in the specifictions, boost scores from these specifications are + // all applied and combined in a non-linear way. Maximum number of + // specifications is 20. + repeated ConditionBoostSpec condition_boost_specs = 1 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Boost specifications for data stores. +message BoostSpecs { + // Optional. Data Stores where the boosting configuration is applied. The full + // names of the referenced data stores. Formats: + // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}` + // `projects/{project}/locations/{location}/dataStores/{data_store} + repeated string data_stores = 1 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "discoveryengine.googleapis.com/DataStore" + } + ]; + + // Optional. A list of boosting specifications. + repeated BoostSpec spec = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Filter specifications for data stores. +message FilterSpecs { + // Optional. Data Stores where the boosting configuration is applied. The full + // names of the referenced data stores. Formats: + // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}` + // `projects/{project}/locations/{location}/dataStores/{data_store} + repeated string data_stores = 1 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "discoveryengine.googleapis.com/DataStore" + } + ]; + + // Optional. The filter expression to be applied. + // Expression syntax is documented at + // https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata#filter-expression-syntax + string filter = 2 [(google.api.field_behavior) = OPTIONAL]; } // Represents the query input. It can contain one of: @@ -772,6 +964,10 @@ message QueryResult { // Dialogflow exports audio to Google Cloud Storage, then the client may need // to wait for the resulting object to appear in the bucket before proceeding. AdvancedSettings advanced_settings = 21; + + // Indicates whether the Thumbs up/Thumbs down rating controls are need to be + // shown for the response in the Dialogflow Messenger widget. + bool allow_answer_feedback = 32; } // Represents the natural language text to be processed.