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 15syntax = "proto3"; 16 17package google.cloud.dialogflow.v2; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/cloud/dialogflow/v2/participant.proto"; 24import "google/protobuf/field_mask.proto"; 25import "google/protobuf/timestamp.proto"; 26 27option cc_enable_arenas = true; 28option csharp_namespace = "Google.Cloud.Dialogflow.V2"; 29option go_package = "cloud.google.com/go/dialogflow/apiv2/dialogflowpb;dialogflowpb"; 30option java_multiple_files = true; 31option java_outer_classname = "AnswerRecordsProto"; 32option java_package = "com.google.cloud.dialogflow.v2"; 33option objc_class_prefix = "DF"; 34 35// Service for managing 36// [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord]. 37service AnswerRecords { 38 option (google.api.default_host) = "dialogflow.googleapis.com"; 39 option (google.api.oauth_scopes) = 40 "https://www.googleapis.com/auth/cloud-platform," 41 "https://www.googleapis.com/auth/dialogflow"; 42 43 // Returns the list of all answer records in the specified project in reverse 44 // chronological order. 45 rpc ListAnswerRecords(ListAnswerRecordsRequest) 46 returns (ListAnswerRecordsResponse) { 47 option (google.api.http) = { 48 get: "/v2/{parent=projects/*}/answerRecords" 49 additional_bindings { 50 get: "/v2/{parent=projects/*/locations/*}/answerRecords" 51 } 52 }; 53 option (google.api.method_signature) = "parent"; 54 } 55 56 // Updates the specified answer record. 57 rpc UpdateAnswerRecord(UpdateAnswerRecordRequest) returns (AnswerRecord) { 58 option (google.api.http) = { 59 patch: "/v2/{answer_record.name=projects/*/answerRecords/*}" 60 body: "answer_record" 61 additional_bindings { 62 patch: "/v2/{answer_record.name=projects/*/locations/*/answerRecords/*}" 63 body: "answer_record" 64 } 65 }; 66 option (google.api.method_signature) = "answer_record,update_mask"; 67 } 68} 69 70// Answer records are records to manage answer history and feedbacks for 71// Dialogflow. 72// 73// Currently, answer record includes: 74// 75// - human agent assistant article suggestion 76// - human agent assistant faq article 77// 78// It doesn't include: 79// 80// - `DetectIntent` intent matching 81// - `DetectIntent` knowledge 82// 83// Answer records are not related to the conversation history in the 84// Dialogflow Console. A Record is generated even when the end-user disables 85// conversation history in the console. Records are created when there's a human 86// agent assistant suggestion generated. 87// 88// A typical workflow for customers provide feedback to an answer is: 89// 90// 1. For human agent assistant, customers get suggestion via ListSuggestions 91// API. Together with the answers, 92// [AnswerRecord.name][google.cloud.dialogflow.v2.AnswerRecord.name] are 93// returned to the customers. 94// 2. The customer uses the 95// [AnswerRecord.name][google.cloud.dialogflow.v2.AnswerRecord.name] to call the 96// [UpdateAnswerRecord][] method to send feedback about a specific answer 97// that they believe is wrong. 98message AnswerRecord { 99 option (google.api.resource) = { 100 type: "dialogflow.googleapis.com/AnswerRecord" 101 pattern: "projects/{project}/answerRecords/{answer_record}" 102 pattern: "projects/{project}/locations/{location}/answerRecords/{answer_record}" 103 }; 104 105 // The unique identifier of this answer record. 106 // Format: `projects/<Project ID>/locations/<Location 107 // ID>/answerRecords/<Answer Record ID>`. 108 string name = 1; 109 110 // Required. The AnswerFeedback for this record. You can set this with 111 // [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord] 112 // in order to give us feedback about this answer. 113 AnswerFeedback answer_feedback = 2 [(google.api.field_behavior) = REQUIRED]; 114 115 // The record for this answer. 116 oneof record { 117 // Output only. The record for human agent assistant. 118 AgentAssistantRecord agent_assistant_record = 4 119 [(google.api.field_behavior) = OUTPUT_ONLY]; 120 } 121} 122 123// Request message for 124// [AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords]. 125message ListAnswerRecordsRequest { 126 // Required. The project to list all answer records for in reverse 127 // chronological order. Format: `projects/<Project ID>/locations/<Location 128 // ID>`. 129 string parent = 1 [ 130 (google.api.field_behavior) = REQUIRED, 131 (google.api.resource_reference) = { 132 child_type: "dialogflow.googleapis.com/AnswerRecord" 133 } 134 ]; 135 136 // Optional. Filters to restrict results to specific answer records. 137 // 138 // Marked deprecated as it hasn't been, and isn't currently, supported. 139 // 140 // For more information about filtering, see 141 // [API Filtering](https://aip.dev/160). 142 string filter = 2 [deprecated = true, (google.api.field_behavior) = OPTIONAL]; 143 144 // Optional. The maximum number of records to return in a single page. 145 // The server may return fewer records than this. If unspecified, we use 10. 146 // The maximum is 100. 147 int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; 148 149 // Optional. The 150 // [ListAnswerRecordsResponse.next_page_token][google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token] 151 // value returned from a previous list request used to continue listing on 152 // the next page. 153 string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; 154} 155 156// Response message for 157// [AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords]. 158message ListAnswerRecordsResponse { 159 // The list of answer records. 160 repeated AnswerRecord answer_records = 1; 161 162 // A token to retrieve next page of results. Or empty if there are no more 163 // results. 164 // Pass this value in the 165 // [ListAnswerRecordsRequest.page_token][google.cloud.dialogflow.v2.ListAnswerRecordsRequest.page_token] 166 // field in the subsequent call to `ListAnswerRecords` method to retrieve the 167 // next page of results. 168 string next_page_token = 2; 169} 170 171// Request message for 172// [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord]. 173message UpdateAnswerRecordRequest { 174 // Required. Answer record to update. 175 AnswerRecord answer_record = 1 [(google.api.field_behavior) = REQUIRED]; 176 177 // Required. The mask to control which fields get updated. 178 google.protobuf.FieldMask update_mask = 2 179 [(google.api.field_behavior) = REQUIRED]; 180} 181 182// Represents feedback the customer has about the quality & correctness of a 183// certain answer in a conversation. 184message AnswerFeedback { 185 // The correctness level of an answer. 186 enum CorrectnessLevel { 187 // Correctness level unspecified. 188 CORRECTNESS_LEVEL_UNSPECIFIED = 0; 189 190 // Answer is totally wrong. 191 NOT_CORRECT = 1; 192 193 // Answer is partially correct. 194 PARTIALLY_CORRECT = 2; 195 196 // Answer is fully correct. 197 FULLY_CORRECT = 3; 198 } 199 200 // The correctness level of the specific answer. 201 CorrectnessLevel correctness_level = 1; 202 203 // Normally, detail feedback is provided when answer is not fully correct. 204 oneof detail_feedback { 205 // Detail feedback of agent assist suggestions. 206 AgentAssistantFeedback agent_assistant_detail_feedback = 2; 207 } 208 209 // Indicates whether the answer/item was clicked by the human agent 210 // or not. Default to false. 211 // For knowledge search and knowledge assist, the answer record is considered 212 // to be clicked if the answer was copied or any URI was clicked. 213 bool clicked = 3; 214 215 // Time when the answer/item was clicked. 216 google.protobuf.Timestamp click_time = 5; 217 218 // Indicates whether the answer/item was displayed to the human 219 // agent in the agent desktop UI. Default to false. 220 bool displayed = 4; 221 222 // Time when the answer/item was displayed. 223 google.protobuf.Timestamp display_time = 6; 224} 225 226// Detail feedback of Agent Assist result. 227message AgentAssistantFeedback { 228 // Relevance of an answer. 229 enum AnswerRelevance { 230 // Answer relevance unspecified. 231 ANSWER_RELEVANCE_UNSPECIFIED = 0; 232 233 // Answer is irrelevant to query. 234 IRRELEVANT = 1; 235 236 // Answer is relevant to query. 237 RELEVANT = 2; 238 } 239 240 // Correctness of document. 241 enum DocumentCorrectness { 242 // Document correctness unspecified. 243 DOCUMENT_CORRECTNESS_UNSPECIFIED = 0; 244 245 // Information in document is incorrect. 246 INCORRECT = 1; 247 248 // Information in document is correct. 249 CORRECT = 2; 250 } 251 252 // Efficiency of document. 253 enum DocumentEfficiency { 254 // Document efficiency unspecified. 255 DOCUMENT_EFFICIENCY_UNSPECIFIED = 0; 256 257 // Document is inefficient. 258 INEFFICIENT = 1; 259 260 // Document is efficient. 261 EFFICIENT = 2; 262 } 263 264 // Feedback for conversation summarization. 265 message SummarizationFeedback { 266 // Timestamp when composing of the summary starts. 267 google.protobuf.Timestamp start_time = 1; 268 269 // Timestamp when the summary was submitted. 270 google.protobuf.Timestamp submit_time = 2; 271 272 // Text of actual submitted summary. 273 string summary_text = 3; 274 275 // Optional. Actual text sections of submitted summary. 276 map<string, string> text_sections = 4 277 [(google.api.field_behavior) = OPTIONAL]; 278 } 279 280 // Feedback for knowledge search. 281 message KnowledgeSearchFeedback { 282 // Whether the answer was copied by the human agent or not. 283 // If the value is set to be true, 284 // [AnswerFeedback.clicked][google.cloud.dialogflow.v2.AnswerFeedback.clicked] 285 // will be updated to be true. 286 bool answer_copied = 1; 287 288 // The URIs clicked by the human agent. The value is appended for each 289 // [UpdateAnswerRecordRequest][google.cloud.dialogflow.v2.UpdateAnswerRecordRequest]. 290 // If the value is not empty, 291 // [AnswerFeedback.clicked][google.cloud.dialogflow.v2.AnswerFeedback.clicked] 292 // will be updated to be true. 293 repeated string clicked_uris = 2; 294 } 295 296 // Optional. Whether or not the suggested answer is relevant. 297 // 298 // For example: 299 // 300 // * Query: "Can I change my mailing address?" 301 // * Suggested document says: "Items must be returned/exchanged within 60 302 // days of the purchase date." 303 // * [answer_relevance][google.cloud.dialogflow.v2.AgentAssistantFeedback.answer_relevance]: [AnswerRelevance.IRRELEVANT][google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance.IRRELEVANT] 304 AnswerRelevance answer_relevance = 1 [(google.api.field_behavior) = OPTIONAL]; 305 306 // Optional. Whether or not the information in the document is correct. 307 // 308 // For example: 309 // 310 // * Query: "Can I return the package in 2 days once received?" 311 // * Suggested document says: "Items must be returned/exchanged within 60 312 // days of the purchase date." 313 // * Ground truth: "No return or exchange is allowed." 314 // * [document_correctness]: INCORRECT 315 DocumentCorrectness document_correctness = 2 316 [(google.api.field_behavior) = OPTIONAL]; 317 318 // Optional. Whether or not the suggested document is efficient. For example, 319 // if the document is poorly written, hard to understand, hard to use or 320 // too long to find useful information, 321 // [document_efficiency][google.cloud.dialogflow.v2.AgentAssistantFeedback.document_efficiency] 322 // is 323 // [DocumentEfficiency.INEFFICIENT][google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency.INEFFICIENT]. 324 DocumentEfficiency document_efficiency = 3 325 [(google.api.field_behavior) = OPTIONAL]; 326 327 // Optional. Feedback for conversation summarization. 328 SummarizationFeedback summarization_feedback = 4 329 [(google.api.field_behavior) = OPTIONAL]; 330 331 // Optional. Feedback for knowledge search. 332 KnowledgeSearchFeedback knowledge_search_feedback = 5 333 [(google.api.field_behavior) = OPTIONAL]; 334} 335 336// Represents a record of a human agent assist answer. 337message AgentAssistantRecord { 338 // Output only. The agent assist answer. 339 oneof answer { 340 // Output only. The article suggestion answer. 341 ArticleAnswer article_suggestion_answer = 5 342 [(google.api.field_behavior) = OUTPUT_ONLY]; 343 344 // Output only. The FAQ answer. 345 FaqAnswer faq_answer = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; 346 347 // Output only. Dialogflow assist answer. 348 DialogflowAssistAnswer dialogflow_assist_answer = 7 349 [(google.api.field_behavior) = OUTPUT_ONLY]; 350 } 351} 352