xref: /aosp_15_r20/external/googleapis/google/cloud/dialogflow/v2/conversation.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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/conversation_profile.proto";
24import "google/cloud/dialogflow/v2/participant.proto";
25import "google/cloud/dialogflow/v2/session.proto";
26import "google/protobuf/timestamp.proto";
27
28option cc_enable_arenas = true;
29option csharp_namespace = "Google.Cloud.Dialogflow.V2";
30option go_package = "cloud.google.com/go/dialogflow/apiv2/dialogflowpb;dialogflowpb";
31option java_multiple_files = true;
32option java_outer_classname = "ConversationProto";
33option java_package = "com.google.cloud.dialogflow.v2";
34option objc_class_prefix = "DF";
35
36// Service for managing
37// [Conversations][google.cloud.dialogflow.v2.Conversation].
38service Conversations {
39  option (google.api.default_host) = "dialogflow.googleapis.com";
40  option (google.api.oauth_scopes) =
41      "https://www.googleapis.com/auth/cloud-platform,"
42      "https://www.googleapis.com/auth/dialogflow";
43
44  // Creates a new conversation. Conversations are auto-completed after 24
45  // hours.
46  //
47  // Conversation Lifecycle:
48  // There are two stages during a conversation: Automated Agent Stage and
49  // Assist Stage.
50  //
51  // For Automated Agent Stage, there will be a dialogflow agent responding to
52  // user queries.
53  //
54  // For Assist Stage, there's no dialogflow agent responding to user queries.
55  // But we will provide suggestions which are generated from conversation.
56  //
57  // If
58  // [Conversation.conversation_profile][google.cloud.dialogflow.v2.Conversation.conversation_profile]
59  // is configured for a dialogflow agent, conversation will start from
60  // `Automated Agent Stage`, otherwise, it will start from `Assist Stage`. And
61  // during `Automated Agent Stage`, once an
62  // [Intent][google.cloud.dialogflow.v2.Intent] with
63  // [Intent.live_agent_handoff][google.cloud.dialogflow.v2.Intent.live_agent_handoff]
64  // is triggered, conversation will transfer to Assist Stage.
65  rpc CreateConversation(CreateConversationRequest) returns (Conversation) {
66    option (google.api.http) = {
67      post: "/v2/{parent=projects/*}/conversations"
68      body: "conversation"
69      additional_bindings {
70        post: "/v2/{parent=projects/*/locations/*}/conversations"
71        body: "conversation"
72      }
73    };
74    option (google.api.method_signature) = "parent,conversation";
75  }
76
77  // Returns the list of all conversations in the specified project.
78  rpc ListConversations(ListConversationsRequest)
79      returns (ListConversationsResponse) {
80    option (google.api.http) = {
81      get: "/v2/{parent=projects/*}/conversations"
82      additional_bindings {
83        get: "/v2/{parent=projects/*/locations/*}/conversations"
84      }
85    };
86    option (google.api.method_signature) = "parent";
87  }
88
89  // Retrieves the specific conversation.
90  rpc GetConversation(GetConversationRequest) returns (Conversation) {
91    option (google.api.http) = {
92      get: "/v2/{name=projects/*/conversations/*}"
93      additional_bindings {
94        get: "/v2/{name=projects/*/locations/*/conversations/*}"
95      }
96    };
97    option (google.api.method_signature) = "name";
98  }
99
100  // Completes the specified conversation. Finished conversations are purged
101  // from the database after 30 days.
102  rpc CompleteConversation(CompleteConversationRequest) returns (Conversation) {
103    option (google.api.http) = {
104      post: "/v2/{name=projects/*/conversations/*}:complete"
105      body: "*"
106      additional_bindings {
107        post: "/v2/{name=projects/*/locations/*/conversations/*}:complete"
108        body: "*"
109      }
110    };
111    option (google.api.method_signature) = "name";
112  }
113
114  // Lists messages that belong to a given conversation.
115  // `messages` are ordered by `create_time` in descending order. To fetch
116  // updates without duplication, send request with filter
117  // `create_time_epoch_microseconds >
118  // [first item's create_time of previous request]` and empty page_token.
119  rpc ListMessages(ListMessagesRequest) returns (ListMessagesResponse) {
120    option (google.api.http) = {
121      get: "/v2/{parent=projects/*/conversations/*}/messages"
122      additional_bindings {
123        get: "/v2/{parent=projects/*/locations/*/conversations/*}/messages"
124      }
125    };
126    option (google.api.method_signature) = "parent";
127  }
128
129  // Suggests summary for a conversation based on specific historical messages.
130  // The range of the messages to be used for summary can be specified in the
131  // request.
132  rpc SuggestConversationSummary(SuggestConversationSummaryRequest)
133      returns (SuggestConversationSummaryResponse) {
134    option (google.api.http) = {
135      post: "/v2/{conversation=projects/*/conversations/*}/suggestions:suggestConversationSummary"
136      body: "*"
137      additional_bindings {
138        post: "/v2/{conversation=projects/*/locations/*/conversations/*}/suggestions:suggestConversationSummary"
139        body: "*"
140      }
141    };
142    option (google.api.method_signature) = "conversation";
143  }
144
145  // Generates and returns a summary for a conversation that does not have a
146  // resource created for it.
147  rpc GenerateStatelessSummary(GenerateStatelessSummaryRequest)
148      returns (GenerateStatelessSummaryResponse) {
149    option (google.api.http) = {
150      post: "/v2/{stateless_conversation.parent=projects/*}/suggestions:generateStatelessSummary"
151      body: "*"
152      additional_bindings {
153        post: "/v2/{stateless_conversation.parent=projects/*/locations/*}/suggestions:generateStatelessSummary"
154        body: "*"
155      }
156    };
157  }
158
159  // Get answers for the given query based on knowledge documents.
160  rpc SearchKnowledge(SearchKnowledgeRequest)
161      returns (SearchKnowledgeResponse) {
162    option (google.api.http) = {
163      post: "/v2/{parent=projects/*}/suggestions:searchKnowledge"
164      body: "*"
165      additional_bindings {
166        post: "/v2/{parent=projects/*/locations/*}/suggestions:searchKnowledge"
167        body: "*"
168      }
169      additional_bindings {
170        post: "/v2/{conversation=projects/*/conversations/*}/suggestions:searchKnowledge"
171        body: "*"
172      }
173      additional_bindings {
174        post: "/v2/{conversation=projects/*/locations/*/conversations/*}/suggestions:searchKnowledge"
175        body: "*"
176      }
177    };
178  }
179}
180
181// Represents a conversation.
182// A conversation is an interaction between an agent, including live agents
183// and Dialogflow agents, and a support customer. Conversations can
184// include phone calls and text-based chat sessions.
185message Conversation {
186  option (google.api.resource) = {
187    type: "dialogflow.googleapis.com/Conversation"
188    pattern: "projects/{project}/conversations/{conversation}"
189    pattern: "projects/{project}/locations/{location}/conversations/{conversation}"
190  };
191
192  // Enumeration of the completion status of the conversation.
193  enum LifecycleState {
194    // Unknown.
195    LIFECYCLE_STATE_UNSPECIFIED = 0;
196
197    // Conversation is currently open for media analysis.
198    IN_PROGRESS = 1;
199
200    // Conversation has been completed.
201    COMPLETED = 2;
202  }
203
204  // Enumeration of the different conversation stages a conversation can be in.
205  // Reference:
206  // https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages
207  enum ConversationStage {
208    // Unknown. Should never be used after a conversation is successfully
209    // created.
210    CONVERSATION_STAGE_UNSPECIFIED = 0;
211
212    // The conversation should return virtual agent responses into the
213    // conversation.
214    VIRTUAL_AGENT_STAGE = 1;
215
216    // The conversation should not provide responses, just listen and provide
217    // suggestions.
218    HUMAN_ASSIST_STAGE = 2;
219  }
220
221  // Output only. The unique identifier of this conversation.
222  // Format: `projects/<Project ID>/locations/<Location
223  // ID>/conversations/<Conversation ID>`.
224  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
225
226  // Output only. The current state of the Conversation.
227  LifecycleState lifecycle_state = 2
228      [(google.api.field_behavior) = OUTPUT_ONLY];
229
230  // Required. The Conversation Profile to be used to configure this
231  // Conversation. This field cannot be updated.
232  // Format: `projects/<Project ID>/locations/<Location
233  // ID>/conversationProfiles/<Conversation Profile ID>`.
234  string conversation_profile = 3 [
235    (google.api.field_behavior) = REQUIRED,
236    (google.api.resource_reference) = {
237      type: "dialogflow.googleapis.com/ConversationProfile"
238    }
239  ];
240
241  // Output only. It will not be empty if the conversation is to be connected
242  // over telephony.
243  ConversationPhoneNumber phone_number = 4
244      [(google.api.field_behavior) = OUTPUT_ONLY];
245
246  // Output only. The time the conversation was started.
247  google.protobuf.Timestamp start_time = 5
248      [(google.api.field_behavior) = OUTPUT_ONLY];
249
250  // Output only. The time the conversation was finished.
251  google.protobuf.Timestamp end_time = 6
252      [(google.api.field_behavior) = OUTPUT_ONLY];
253
254  // The stage of a conversation. It indicates whether the virtual agent or a
255  // human agent is handling the conversation.
256  //
257  // If the conversation is created with the conversation profile that has
258  // Dialogflow config set, defaults to
259  // [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE];
260  // Otherwise, defaults to
261  // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.HUMAN_ASSIST_STAGE].
262  //
263  // If the conversation is created with the conversation profile that has
264  // Dialogflow config set but explicitly sets conversation_stage to
265  // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.HUMAN_ASSIST_STAGE],
266  // it skips
267  // [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE]
268  // stage and directly goes to
269  // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.HUMAN_ASSIST_STAGE].
270  ConversationStage conversation_stage = 7;
271}
272
273// The request message for
274// [Conversations.CreateConversation][google.cloud.dialogflow.v2.Conversations.CreateConversation].
275message CreateConversationRequest {
276  // Required. Resource identifier of the project creating the conversation.
277  // Format: `projects/<Project ID>/locations/<Location ID>`.
278  string parent = 1 [
279    (google.api.field_behavior) = REQUIRED,
280    (google.api.resource_reference) = {
281      child_type: "dialogflow.googleapis.com/Conversation"
282    }
283  ];
284
285  // Required. The conversation to create.
286  Conversation conversation = 2 [(google.api.field_behavior) = REQUIRED];
287
288  // Optional. Identifier of the conversation. Generally it's auto generated by
289  // Google. Only set it if you cannot wait for the response to return a
290  // auto-generated one to you.
291  //
292  // The conversation ID must be compliant with the regression fomula
293  // `[a-zA-Z][a-zA-Z0-9_-]*` with the characters length in range of [3,64].
294  // If the field is provided, the caller is resposible for
295  // 1. the uniqueness of the ID, otherwise the request will be rejected.
296  // 2. the consistency for whether to use custom ID or not under a project to
297  // better ensure uniqueness.
298  string conversation_id = 3 [(google.api.field_behavior) = OPTIONAL];
299}
300
301// The request message for
302// [Conversations.ListConversations][google.cloud.dialogflow.v2.Conversations.ListConversations].
303message ListConversationsRequest {
304  // Required. The project from which to list all conversation.
305  // Format: `projects/<Project ID>/locations/<Location ID>`.
306  string parent = 1 [
307    (google.api.field_behavior) = REQUIRED,
308    (google.api.resource_reference) = {
309      child_type: "dialogflow.googleapis.com/Conversation"
310    }
311  ];
312
313  // Optional. The maximum number of items to return in a single page. By
314  // default 100 and at most 1000.
315  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
316
317  // Optional. The next_page_token value returned from a previous list request.
318  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
319
320  // A filter expression that filters conversations listed in the response. In
321  // general, the expression must specify the field name, a comparison operator,
322  // and the value to use for filtering:
323  // <ul>
324  //   <li>The value must be a string, a number, or a boolean.</li>
325  //   <li>The comparison operator must be either `=`,`!=`, `>`, or `<`.</li>
326  //   <li>To filter on multiple expressions, separate the
327  //       expressions with `AND` or `OR` (omitting both implies `AND`).</li>
328  //   <li>For clarity, expressions can be enclosed in parentheses.</li>
329  // </ul>
330  // Only `lifecycle_state` can be filtered on in this way. For example,
331  // the following expression only returns `COMPLETED` conversations:
332  //
333  // `lifecycle_state = "COMPLETED"`
334  //
335  // For more information about filtering, see
336  // [API Filtering](https://aip.dev/160).
337  string filter = 4;
338}
339
340// The response message for
341// [Conversations.ListConversations][google.cloud.dialogflow.v2.Conversations.ListConversations].
342message ListConversationsResponse {
343  // The list of conversations. There will be a maximum number of items
344  // returned based on the page_size field in the request.
345  repeated Conversation conversations = 1;
346
347  // Token to retrieve the next page of results, or empty if there are no
348  // more results in the list.
349  string next_page_token = 2;
350}
351
352// The request message for
353// [Conversations.GetConversation][google.cloud.dialogflow.v2.Conversations.GetConversation].
354message GetConversationRequest {
355  // Required. The name of the conversation. Format:
356  // `projects/<Project ID>/locations/<Location ID>/conversations/<Conversation
357  // ID>`.
358  string name = 1 [
359    (google.api.field_behavior) = REQUIRED,
360    (google.api.resource_reference) = {
361      type: "dialogflow.googleapis.com/Conversation"
362    }
363  ];
364}
365
366// The request message for
367// [Conversations.CompleteConversation][google.cloud.dialogflow.v2.Conversations.CompleteConversation].
368message CompleteConversationRequest {
369  // Required. Resource identifier of the conversation to close.
370  // Format: `projects/<Project ID>/locations/<Location
371  // ID>/conversations/<Conversation ID>`.
372  string name = 1 [
373    (google.api.field_behavior) = REQUIRED,
374    (google.api.resource_reference) = {
375      type: "dialogflow.googleapis.com/Conversation"
376    }
377  ];
378}
379
380// The request message for
381// [Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages].
382message ListMessagesRequest {
383  // Required. The name of the conversation to list messages for.
384  // Format: `projects/<Project ID>/locations/<Location
385  // ID>/conversations/<Conversation ID>`
386  string parent = 1 [
387    (google.api.field_behavior) = REQUIRED,
388    (google.api.resource_reference) = {
389      child_type: "dialogflow.googleapis.com/Message"
390    }
391  ];
392
393  // Optional. Filter on message fields. Currently predicates on `create_time`
394  // and `create_time_epoch_microseconds` are supported. `create_time` only
395  // support milliseconds accuracy. E.g.,
396  // `create_time_epoch_microseconds > 1551790877964485` or
397  // `create_time > 2017-01-15T01:30:15.01Z`.
398  //
399  // For more information about filtering, see
400  // [API Filtering](https://aip.dev/160).
401  string filter = 4 [(google.api.field_behavior) = OPTIONAL];
402
403  // Optional. The maximum number of items to return in a single page. By
404  // default 100 and at most 1000.
405  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
406
407  // Optional. The next_page_token value returned from a previous list request.
408  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
409}
410
411// The response message for
412// [Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages].
413message ListMessagesResponse {
414  // The list of messages. There will be a maximum number of items
415  // returned based on the page_size field in the request.
416  // `messages` is sorted by `create_time` in descending order.
417  repeated Message messages = 1;
418
419  // Token to retrieve the next page of results, or empty if there are
420  // no more results in the list.
421  string next_page_token = 2;
422}
423
424// Represents a phone number for telephony integration. It allows for connecting
425// a particular conversation over telephony.
426message ConversationPhoneNumber {
427  // Output only. The phone number to connect to this conversation.
428  string phone_number = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
429}
430
431// The request message for
432// [Conversations.SuggestConversationSummary][google.cloud.dialogflow.v2.Conversations.SuggestConversationSummary].
433message SuggestConversationSummaryRequest {
434  // Required. The conversation to fetch suggestion for.
435  // Format: `projects/<Project ID>/locations/<Location
436  // ID>/conversations/<Conversation ID>`.
437  string conversation = 1 [
438    (google.api.field_behavior) = REQUIRED,
439    (google.api.resource_reference) = {
440      type: "dialogflow.googleapis.com/Conversation"
441    }
442  ];
443
444  // The name of the latest conversation message used as context for
445  // compiling suggestion. If empty, the latest message of the conversation will
446  // be used.
447  //
448  // Format: `projects/<Project ID>/locations/<Location
449  // ID>/conversations/<Conversation ID>/messages/<Message ID>`.
450  string latest_message = 3 [(google.api.resource_reference) = {
451    type: "dialogflow.googleapis.com/Message"
452  }];
453
454  // Max number of messages prior to and including
455  // [latest_message] to use as context when compiling the
456  // suggestion. By default 500 and at most 1000.
457  int32 context_size = 4;
458
459  // Parameters for a human assist query. Only used for POC/demo purpose.
460  AssistQueryParameters assist_query_params = 5;
461}
462
463// The response message for
464// [Conversations.SuggestConversationSummary][google.cloud.dialogflow.v2.Conversations.SuggestConversationSummary].
465message SuggestConversationSummaryResponse {
466  // Generated summary for a conversation.
467  message Summary {
468    // The summary content that is concatenated into one string.
469    string text = 1;
470
471    // The summary content that is divided into sections. The key is the
472    // section's name and the value is the section's content. There is no
473    // specific format for the key or value.
474    map<string, string> text_sections = 4;
475
476    // The name of the answer record. Format:
477    // "projects/<Project ID>/answerRecords/<Answer Record ID>"
478    string answer_record = 3 [(google.api.resource_reference) = {
479      type: "dialogflow.googleapis.com/AnswerRecord"
480    }];
481
482    // The baseline model version used to generate this summary. It is empty if
483    // a baseline model was not used to generate this summary.
484    string baseline_model_version = 5;
485  }
486
487  // Generated summary.
488  Summary summary = 1;
489
490  // The name of the latest conversation message used as context for
491  // compiling suggestion.
492  //
493  // Format: `projects/<Project ID>/locations/<Location
494  // ID>/conversations/<Conversation ID>/messages/<Message ID>`.
495  string latest_message = 2 [(google.api.resource_reference) = {
496    type: "dialogflow.googleapis.com/Message"
497  }];
498
499  // Number of messages prior to and including
500  // [last_conversation_message][] used to compile the suggestion. It may be
501  // smaller than the [SuggestSummaryRequest.context_size][] field in the
502  // request if there weren't that many messages in the conversation.
503  int32 context_size = 3;
504}
505
506// The request message for
507// [Conversations.GenerateStatelessSummary][google.cloud.dialogflow.v2.Conversations.GenerateStatelessSummary].
508message GenerateStatelessSummaryRequest {
509  // The minimum amount of information required to generate a Summary without
510  // having a Conversation resource created.
511  message MinimalConversation {
512    // Required. The messages that the Summary will be generated from. It is
513    // expected that this message content is already redacted and does not
514    // contain any PII. Required fields: {content, language_code, participant,
515    // participant_role} Optional fields: {send_time} If send_time is not
516    // provided, then the messages must be provided in chronological order.
517    repeated Message messages = 1 [(google.api.field_behavior) = REQUIRED];
518
519    // Required. The parent resource to charge for the Summary's generation.
520    // Format: `projects/<Project ID>/locations/<Location ID>`.
521    string parent = 2 [
522      (google.api.field_behavior) = REQUIRED,
523      (google.api.resource_reference) = {
524        type: "locations.googleapis.com/Location"
525      }
526    ];
527  }
528
529  // Required. The conversation to suggest a summary for.
530  MinimalConversation stateless_conversation = 1
531      [(google.api.field_behavior) = REQUIRED];
532
533  // Required. A ConversationProfile containing information required for Summary
534  // generation.
535  // Required fields: {language_code, security_settings}
536  // Optional fields: {agent_assistant_config}
537  ConversationProfile conversation_profile = 2
538      [(google.api.field_behavior) = REQUIRED];
539
540  // The name of the latest conversation message used as context for
541  // generating a Summary. If empty, the latest message of the conversation will
542  // be used. The format is specific to the user and the names of the messages
543  // provided.
544  string latest_message = 3 [(google.api.resource_reference) = {
545    type: "dialogflow.googleapis.com/Message"
546  }];
547
548  // Max number of messages prior to and including
549  // [latest_message] to use as context when compiling the
550  // suggestion. By default 500 and at most 1000.
551  int32 max_context_size = 4;
552}
553
554// The response message for
555// [Conversations.GenerateStatelessSummary][google.cloud.dialogflow.v2.Conversations.GenerateStatelessSummary].
556message GenerateStatelessSummaryResponse {
557  // Generated summary for a conversation.
558  message Summary {
559    // The summary content that is concatenated into one string.
560    string text = 1;
561
562    // The summary content that is divided into sections. The key is the
563    // section's name and the value is the section's content. There is no
564    // specific format for the key or value.
565    map<string, string> text_sections = 2;
566
567    // The baseline model version used to generate this summary. It is empty if
568    // a baseline model was not used to generate this summary.
569    string baseline_model_version = 4;
570  }
571
572  // Generated summary.
573  Summary summary = 1;
574
575  // The name of the latest conversation message used as context for
576  // compiling suggestion. The format is specific to the user and the names of
577  // the messages provided.
578  string latest_message = 2 [(google.api.resource_reference) = {
579    type: "dialogflow.googleapis.com/Message"
580  }];
581
582  // Number of messages prior to and including
583  // [last_conversation_message][] used to compile the suggestion. It may be
584  // smaller than the [GenerateStatelessSummaryRequest.context_size][] field in
585  // the request if there weren't that many messages in the conversation.
586  int32 context_size = 3;
587}
588
589// The request message for
590// [Conversations.SearchKnowledge][google.cloud.dialogflow.v2.Conversations.SearchKnowledge].
591message SearchKnowledgeRequest {
592  // The parent resource contains the conversation profile
593  // Format: 'projects/<Project ID>' or `projects/<Project
594  // ID>/locations/<Location ID>`.
595  string parent = 6;
596
597  // Required. The natural language text query for knowledge search.
598  TextInput query = 1 [(google.api.field_behavior) = REQUIRED];
599
600  // Required. The conversation profile used to configure the search.
601  // Format: `projects/<Project ID>/locations/<Location
602  // ID>/conversationProfiles/<Conversation Profile ID>`.
603  string conversation_profile = 2 [
604    (google.api.field_behavior) = REQUIRED,
605    (google.api.resource_reference) = {
606      type: "dialogflow.googleapis.com/ConversationProfile"
607    }
608  ];
609
610  // The ID of the search session.
611  // The session_id can be combined with Dialogflow V3 Agent ID retrieved from
612  // conversation profile or on its own to identify a search session. The search
613  // history of the same session will impact the search result. It's up to the
614  // API caller to choose an appropriate `Session ID`. It can be a random number
615  // or some type of session identifiers (preferably hashed). The length must
616  // not exceed 36 characters.
617  string session_id = 3;
618
619  // The conversation (between human agent and end user) where the search
620  // request is triggered. Format: `projects/<Project ID>/locations/<Location
621  // ID>/conversations/<Conversation ID>`.
622  string conversation = 4 [(google.api.resource_reference) = {
623    type: "dialogflow.googleapis.com/Conversation"
624  }];
625
626  // The name of the latest conversation message when the request is
627  // triggered.
628  // Format: `projects/<Project ID>/locations/<Location
629  // ID>/conversations/<Conversation ID>/messages/<Message ID>`.
630  string latest_message = 5 [(google.api.resource_reference) = {
631    type: "dialogflow.googleapis.com/Message"
632  }];
633}
634
635// The response message for
636// [Conversations.SearchKnowledge][google.cloud.dialogflow.v2.Conversations.SearchKnowledge].
637message SearchKnowledgeResponse {
638  // Most relevant snippets extracted from articles in the given knowledge base,
639  // ordered by confidence.
640  repeated SearchKnowledgeAnswer answers = 2;
641
642  // The rewritten query used to search knowledge.
643  string rewritten_query = 3;
644}
645
646// Represents a SearchKnowledge answer.
647message SearchKnowledgeAnswer {
648  // The type of the answer.
649  enum AnswerType {
650    // The answer has a unspecified type.
651    ANSWER_TYPE_UNSPECIFIED = 0;
652
653    // The answer is from FAQ documents.
654    FAQ = 1;
655
656    // The answer is from generative model.
657    GENERATIVE = 2;
658
659    // The answer is from intent matching.
660    INTENT = 3;
661  }
662
663  // The sources of the answers.
664  message AnswerSource {
665    // The title of the article.
666    string title = 1;
667
668    // The URI of the article.
669    string uri = 2;
670
671    // The relevant snippet of the article.
672    string snippet = 3;
673  }
674
675  // The piece of text from the knowledge base documents that answers
676  // the search query
677  string answer = 1;
678
679  // The type of the answer.
680  AnswerType answer_type = 2;
681
682  // All sources used to generate the answer.
683  repeated AnswerSource answer_sources = 3;
684
685  // The name of the answer record.
686  // Format: `projects/<Project ID>/locations/<location ID>/answer
687  // Records/<Answer Record ID>`
688  string answer_record = 5;
689}
690