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