Skip to content

Commit 4b4e8be

Browse files
Google APIscopybara-github
authored andcommitted
feat: Add CCAI API
PiperOrigin-RevId: 361000862
1 parent ead1721 commit 4b4e8be

15 files changed

Lines changed: 3136 additions & 31 deletions
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
exports_files(glob(["*.yaml"]))
1+
package(default_visibility = ["//visibility:public"])
2+
3+
exports_files(glob([
4+
"*.yaml",
5+
]))
6+
7+
proto_library(
8+
name = "common_resources_proto",
9+
srcs = ["common_resources.proto"],
10+
deps = [
11+
"//google/api:resource_proto",
12+
],
13+
)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
syntax = "proto3";
2+
3+
package google.cloud;
4+
5+
import "google/api/resource.proto";
6+
7+
option (google.api.resource_definition) = {
8+
type: "dialogflow.googleapis.com/ConversationModel"
9+
pattern: "projects/{project}/locations/{location}/conversationModels/{conversation_model}"
10+
};

google/cloud/dialogflow/v2/BUILD.bazel

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,20 @@ proto_library(
2222
name = "dialogflow_proto",
2323
srcs = [
2424
"agent.proto",
25+
"answer_record.proto",
2526
"audio_config.proto",
2627
"context.proto",
28+
"conversation.proto",
29+
"conversation_event.proto",
30+
"conversation_profile.proto",
31+
"document.proto",
2732
"entity_type.proto",
2833
"environment.proto",
34+
"gcs.proto",
35+
"human_agent_assistant_event.proto",
2936
"intent.proto",
37+
"knowledge_base.proto",
38+
"participant.proto",
3039
"session.proto",
3140
"session_entity_type.proto",
3241
"validation_result.proto",
@@ -53,6 +62,7 @@ proto_library_with_info(
5362
deps = [
5463
":dialogflow_proto",
5564
"//google/cloud:common_resources_proto",
65+
"//google/cloud/dialogflow:common_resources_proto",
5666
],
5767
)
5868

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

0 commit comments

Comments
 (0)