1// Copyright 2022 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.discoveryengine.v1alpha;
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/discoveryengine/v1alpha/answer.proto";
24import "google/cloud/discoveryengine/v1alpha/common.proto";
25import "google/cloud/discoveryengine/v1alpha/conversation.proto";
26import "google/cloud/discoveryengine/v1alpha/search_service.proto";
27import "google/cloud/discoveryengine/v1alpha/session.proto";
28import "google/protobuf/empty.proto";
29import "google/protobuf/field_mask.proto";
30
31option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Alpha";
32option go_package = "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb;discoveryenginepb";
33option java_multiple_files = true;
34option java_outer_classname = "ConversationalSearchServiceProto";
35option java_package = "com.google.cloud.discoveryengine.v1alpha";
36option objc_class_prefix = "DISCOVERYENGINE";
37option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1alpha";
38option ruby_package = "Google::Cloud::DiscoveryEngine::V1alpha";
39
40// Service for conversational search.
41service ConversationalSearchService {
42  option (google.api.default_host) = "discoveryengine.googleapis.com";
43  option (google.api.oauth_scopes) =
44      "https://www.googleapis.com/auth/cloud-platform";
45
46  // Converses a conversation.
47  rpc ConverseConversation(ConverseConversationRequest)
48      returns (ConverseConversationResponse) {
49    option (google.api.http) = {
50      post: "/v1alpha/{name=projects/*/locations/*/dataStores/*/conversations/*}:converse"
51      body: "*"
52      additional_bindings {
53        post: "/v1alpha/{name=projects/*/locations/*/collections/*/dataStores/*/conversations/*}:converse"
54        body: "*"
55      }
56      additional_bindings {
57        post: "/v1alpha/{name=projects/*/locations/*/collections/*/engines/*/conversations/*}:converse"
58        body: "*"
59      }
60    };
61    option (google.api.method_signature) = "name,query";
62  }
63
64  // Creates a Conversation.
65  //
66  // If the [Conversation][google.cloud.discoveryengine.v1alpha.Conversation] to
67  // create already exists, an ALREADY_EXISTS error is returned.
68  rpc CreateConversation(CreateConversationRequest) returns (Conversation) {
69    option (google.api.http) = {
70      post: "/v1alpha/{parent=projects/*/locations/*/dataStores/*}/conversations"
71      body: "conversation"
72      additional_bindings {
73        post: "/v1alpha/{parent=projects/*/locations/*/collections/*/dataStores/*}/conversations"
74        body: "conversation"
75      }
76      additional_bindings {
77        post: "/v1alpha/{parent=projects/*/locations/*/collections/*/engines/*}/conversations"
78        body: "conversation"
79      }
80    };
81    option (google.api.method_signature) = "parent,conversation";
82  }
83
84  // Deletes a Conversation.
85  //
86  // If the [Conversation][google.cloud.discoveryengine.v1alpha.Conversation] to
87  // delete does not exist, a NOT_FOUND error is returned.
88  rpc DeleteConversation(DeleteConversationRequest)
89      returns (google.protobuf.Empty) {
90    option (google.api.http) = {
91      delete: "/v1alpha/{name=projects/*/locations/*/dataStores/*/conversations/*}"
92      additional_bindings {
93        delete: "/v1alpha/{name=projects/*/locations/*/collections/*/dataStores/*/conversations/*}"
94      }
95      additional_bindings {
96        delete: "/v1alpha/{name=projects/*/locations/*/collections/*/engines/*/conversations/*}"
97      }
98    };
99    option (google.api.method_signature) = "name";
100  }
101
102  // Updates a Conversation.
103  //
104  // [Conversation][google.cloud.discoveryengine.v1alpha.Conversation] action
105  // type cannot be changed. If the
106  // [Conversation][google.cloud.discoveryengine.v1alpha.Conversation] to update
107  // does not exist, a NOT_FOUND error is returned.
108  rpc UpdateConversation(UpdateConversationRequest) returns (Conversation) {
109    option (google.api.http) = {
110      patch: "/v1alpha/{conversation.name=projects/*/locations/*/dataStores/*/conversations/*}"
111      body: "conversation"
112      additional_bindings {
113        patch: "/v1alpha/{conversation.name=projects/*/locations/*/collections/*/dataStores/*/conversations/*}"
114        body: "conversation"
115      }
116      additional_bindings {
117        patch: "/v1alpha/{conversation.name=projects/*/locations/*/collections/*/engines/*/conversations/*}"
118        body: "conversation"
119      }
120    };
121    option (google.api.method_signature) = "conversation,update_mask";
122  }
123
124  // Gets a Conversation.
125  rpc GetConversation(GetConversationRequest) returns (Conversation) {
126    option (google.api.http) = {
127      get: "/v1alpha/{name=projects/*/locations/*/dataStores/*/conversations/*}"
128      additional_bindings {
129        get: "/v1alpha/{name=projects/*/locations/*/collections/*/dataStores/*/conversations/*}"
130      }
131      additional_bindings {
132        get: "/v1alpha/{name=projects/*/locations/*/collections/*/engines/*/conversations/*}"
133      }
134    };
135    option (google.api.method_signature) = "name";
136  }
137
138  // Lists all Conversations by their parent
139  // [DataStore][google.cloud.discoveryengine.v1alpha.DataStore].
140  rpc ListConversations(ListConversationsRequest)
141      returns (ListConversationsResponse) {
142    option (google.api.http) = {
143      get: "/v1alpha/{parent=projects/*/locations/*/dataStores/*}/conversations"
144      additional_bindings {
145        get: "/v1alpha/{parent=projects/*/locations/*/collections/*/dataStores/*}/conversations"
146      }
147      additional_bindings {
148        get: "/v1alpha/{parent=projects/*/locations/*/collections/*/engines/*}/conversations"
149      }
150    };
151    option (google.api.method_signature) = "parent";
152  }
153
154  // Answer query method.
155  rpc AnswerQuery(AnswerQueryRequest) returns (AnswerQueryResponse) {
156    option (google.api.http) = {
157      post: "/v1alpha/{serving_config=projects/*/locations/*/dataStores/*/servingConfigs/*}:answer"
158      body: "*"
159      additional_bindings {
160        post: "/v1alpha/{serving_config=projects/*/locations/*/collections/*/dataStores/*/servingConfigs/*}:answer"
161        body: "*"
162      }
163      additional_bindings {
164        post: "/v1alpha/{serving_config=projects/*/locations/*/collections/*/engines/*/servingConfigs/*}:answer"
165        body: "*"
166      }
167    };
168  }
169
170  // Gets a Answer.
171  rpc GetAnswer(GetAnswerRequest) returns (Answer) {
172    option (google.api.http) = {
173      get: "/v1alpha/{name=projects/*/locations/*/dataStores/*/sessions/*/answers/*}"
174      additional_bindings {
175        get: "/v1alpha/{name=projects/*/locations/*/collections/*/dataStores/*/sessions/*/answers/*}"
176      }
177      additional_bindings {
178        get: "/v1alpha/{name=projects/*/locations/*/collections/*/engines/*/sessions/*/answers/*}"
179      }
180    };
181    option (google.api.method_signature) = "name";
182  }
183
184  // Creates a Session.
185  //
186  // If the [Session][google.cloud.discoveryengine.v1alpha.Session] to create
187  // already exists, an ALREADY_EXISTS error is returned.
188  rpc CreateSession(CreateSessionRequest) returns (Session) {
189    option (google.api.http) = {
190      post: "/v1alpha/{parent=projects/*/locations/*/dataStores/*}/sessions"
191      body: "session"
192      additional_bindings {
193        post: "/v1alpha/{parent=projects/*/locations/*/collections/*/dataStores/*}/sessions"
194        body: "session"
195      }
196      additional_bindings {
197        post: "/v1alpha/{parent=projects/*/locations/*/collections/*/engines/*}/sessions"
198        body: "session"
199      }
200    };
201    option (google.api.method_signature) = "parent,session";
202  }
203
204  // Deletes a Session.
205  //
206  // If the [Session][google.cloud.discoveryengine.v1alpha.Session] to delete
207  // does not exist, a NOT_FOUND error is returned.
208  rpc DeleteSession(DeleteSessionRequest) returns (google.protobuf.Empty) {
209    option (google.api.http) = {
210      delete: "/v1alpha/{name=projects/*/locations/*/dataStores/*/sessions/*}"
211      additional_bindings {
212        delete: "/v1alpha/{name=projects/*/locations/*/collections/*/dataStores/*/sessions/*}"
213      }
214      additional_bindings {
215        delete: "/v1alpha/{name=projects/*/locations/*/collections/*/engines/*/sessions/*}"
216      }
217    };
218    option (google.api.method_signature) = "name";
219  }
220
221  // Updates a Session.
222  //
223  // [Session][google.cloud.discoveryengine.v1alpha.Session] action type cannot
224  // be changed. If the [Session][google.cloud.discoveryengine.v1alpha.Session]
225  // to update does not exist, a NOT_FOUND error is returned.
226  rpc UpdateSession(UpdateSessionRequest) returns (Session) {
227    option (google.api.http) = {
228      patch: "/v1alpha/{session.name=projects/*/locations/*/dataStores/*/sessions/*}"
229      body: "session"
230      additional_bindings {
231        patch: "/v1alpha/{session.name=projects/*/locations/*/collections/*/dataStores/*/sessions/*}"
232        body: "session"
233      }
234      additional_bindings {
235        patch: "/v1alpha/{session.name=projects/*/locations/*/collections/*/engines/*/sessions/*}"
236        body: "session"
237      }
238    };
239    option (google.api.method_signature) = "session,update_mask";
240  }
241
242  // Gets a Session.
243  rpc GetSession(GetSessionRequest) returns (Session) {
244    option (google.api.http) = {
245      get: "/v1alpha/{name=projects/*/locations/*/dataStores/*/sessions/*}"
246      additional_bindings {
247        get: "/v1alpha/{name=projects/*/locations/*/collections/*/dataStores/*/sessions/*}"
248      }
249      additional_bindings {
250        get: "/v1alpha/{name=projects/*/locations/*/collections/*/engines/*/sessions/*}"
251      }
252    };
253    option (google.api.method_signature) = "name";
254  }
255
256  // Lists all Sessions by their parent
257  // [DataStore][google.cloud.discoveryengine.v1alpha.DataStore].
258  rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse) {
259    option (google.api.http) = {
260      get: "/v1alpha/{parent=projects/*/locations/*/dataStores/*}/sessions"
261      additional_bindings {
262        get: "/v1alpha/{parent=projects/*/locations/*/collections/*/dataStores/*}/sessions"
263      }
264      additional_bindings {
265        get: "/v1alpha/{parent=projects/*/locations/*/collections/*/engines/*}/sessions"
266      }
267    };
268    option (google.api.method_signature) = "parent";
269  }
270}
271
272// Request message for
273// [ConversationalSearchService.ConverseConversation][google.cloud.discoveryengine.v1alpha.ConversationalSearchService.ConverseConversation]
274// method.
275message ConverseConversationRequest {
276  // Required. The resource name of the Conversation to get. Format:
277  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}`.
278  // Use
279  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/-`
280  // to activate auto session mode, which automatically creates a new
281  // conversation inside a ConverseConversation session.
282  string name = 1 [
283    (google.api.field_behavior) = REQUIRED,
284    (google.api.resource_reference) = {
285      type: "discoveryengine.googleapis.com/Conversation"
286    }
287  ];
288
289  // Required. Current user input.
290  TextInput query = 2 [(google.api.field_behavior) = REQUIRED];
291
292  // The resource name of the Serving Config to use. Format:
293  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/servingConfigs/{serving_config_id}`
294  // If this is not set, the default serving config will be used.
295  string serving_config = 3 [(google.api.resource_reference) = {
296    type: "discoveryengine.googleapis.com/ServingConfig"
297  }];
298
299  // The conversation to be used by auto session only. The name field will be
300  // ignored as we automatically assign new name for the conversation in auto
301  // session.
302  Conversation conversation = 5;
303
304  // Whether to turn on safe search.
305  bool safe_search = 6;
306
307  // The user labels applied to a resource must meet the following requirements:
308  //
309  // * Each resource can have multiple labels, up to a maximum of 64.
310  // * Each label must be a key-value pair.
311  // * Keys have a minimum length of 1 character and a maximum length of 63
312  //   characters and cannot be empty. Values can be empty and have a maximum
313  //   length of 63 characters.
314  // * Keys and values can contain only lowercase letters, numeric characters,
315  //   underscores, and dashes. All characters must use UTF-8 encoding, and
316  //   international characters are allowed.
317  // * The key portion of a label must be unique. However, you can use the same
318  //   key with multiple resources.
319  // * Keys must start with a lowercase letter or international character.
320  //
321  // See [Google Cloud
322  // Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
323  // for more details.
324  map<string, string> user_labels = 7;
325
326  // A specification for configuring the summary returned in the response.
327  SearchRequest.ContentSearchSpec.SummarySpec summary_spec = 8;
328
329  // The filter syntax consists of an expression language for constructing a
330  // predicate from one or more fields of the documents being filtered. Filter
331  // expression is case-sensitive. This will be used to filter search results
332  // which may affect the summary response.
333  //
334  // If this field is unrecognizable, an  `INVALID_ARGUMENT`  is returned.
335  //
336  // Filtering in Vertex AI Search is done by mapping the LHS filter key to a
337  // key property defined in the Vertex AI Search backend -- this mapping is
338  // defined by the customer in their schema. For example a media customer might
339  // have a field 'name' in their schema. In this case the filter would look
340  // like this: filter --> name:'ANY("king kong")'
341  //
342  // For more information about filtering including syntax and filter
343  // operators, see
344  // [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata)
345  string filter = 9;
346
347  // Boost specification to boost certain documents in search results which may
348  // affect the converse response. For more information on boosting, see
349  // [Boosting](https://cloud.google.com/retail/docs/boosting#boost)
350  SearchRequest.BoostSpec boost_spec = 10;
351}
352
353// Response message for
354// [ConversationalSearchService.ConverseConversation][google.cloud.discoveryengine.v1alpha.ConversationalSearchService.ConverseConversation]
355// method.
356message ConverseConversationResponse {
357  // Answer to the current query.
358  Reply reply = 1;
359
360  // Updated conversation including the answer.
361  Conversation conversation = 2;
362
363  // Suggested related questions.
364  repeated string related_questions = 6;
365
366  // Search Results.
367  repeated SearchResponse.SearchResult search_results = 3;
368}
369
370// Request for CreateConversation method.
371message CreateConversationRequest {
372  // Required. Full resource name of parent data store. Format:
373  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}`
374  string parent = 1 [
375    (google.api.field_behavior) = REQUIRED,
376    (google.api.resource_reference) = {
377      type: "discoveryengine.googleapis.com/DataStore"
378    }
379  ];
380
381  // Required. The conversation to create.
382  Conversation conversation = 2 [(google.api.field_behavior) = REQUIRED];
383}
384
385// Request for UpdateConversation method.
386message UpdateConversationRequest {
387  // Required. The Conversation to update.
388  Conversation conversation = 1 [(google.api.field_behavior) = REQUIRED];
389
390  // Indicates which fields in the provided
391  // [Conversation][google.cloud.discoveryengine.v1alpha.Conversation] to
392  // update. The following are NOT supported:
393  //
394  // * [Conversation.name][google.cloud.discoveryengine.v1alpha.Conversation.name]
395  //
396  // If not set or empty, all supported fields are updated.
397  google.protobuf.FieldMask update_mask = 2;
398}
399
400// Request for DeleteConversation method.
401message DeleteConversationRequest {
402  // Required. The resource name of the Conversation to delete. Format:
403  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}`
404  string name = 1 [
405    (google.api.field_behavior) = REQUIRED,
406    (google.api.resource_reference) = {
407      type: "discoveryengine.googleapis.com/Conversation"
408    }
409  ];
410}
411
412// Request for GetConversation method.
413message GetConversationRequest {
414  // Required. The resource name of the Conversation to get. Format:
415  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}`
416  string name = 1 [
417    (google.api.field_behavior) = REQUIRED,
418    (google.api.resource_reference) = {
419      type: "discoveryengine.googleapis.com/Conversation"
420    }
421  ];
422}
423
424// Request for ListConversations method.
425message ListConversationsRequest {
426  // Required. The data store resource name. Format:
427  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}`
428  string parent = 1 [
429    (google.api.field_behavior) = REQUIRED,
430    (google.api.resource_reference) = {
431      type: "discoveryengine.googleapis.com/DataStore"
432    }
433  ];
434
435  // Maximum number of results to return. If unspecified, defaults
436  // to 50. Max allowed value is 1000.
437  int32 page_size = 2;
438
439  // A page token, received from a previous `ListConversations` call.
440  // Provide this to retrieve the subsequent page.
441  string page_token = 3;
442
443  // A filter to apply on the list results. The supported features are:
444  // user_pseudo_id, state.
445  //
446  // Example:
447  // "user_pseudo_id = some_id"
448  string filter = 4;
449
450  // A comma-separated list of fields to order by, sorted in ascending order.
451  // Use "desc" after a field name for descending.
452  // Supported fields:
453  //   * `update_time`
454  //   * `create_time`
455  //   * `conversation_name`
456  //
457  // Example:
458  // "update_time desc"
459  // "create_time"
460  string order_by = 5;
461}
462
463// Response for ListConversations method.
464message ListConversationsResponse {
465  // All the Conversations for a given data store.
466  repeated Conversation conversations = 1;
467
468  // Pagination token, if not returned indicates the last page.
469  string next_page_token = 2;
470}
471
472// Request message for
473// [ConversationalSearchService.AnswerQuery][google.cloud.discoveryengine.v1alpha.ConversationalSearchService.AnswerQuery]
474// method.
475message AnswerQueryRequest {
476  // Safety specification.
477  message SafetySpec {
478    // Enable the safety filtering on the answer response. It is false by
479    // default.
480    bool enable = 1;
481  }
482
483  // Related questions specification.
484  message RelatedQuestionsSpec {
485    // Enable related questions feature if true.
486    bool enable = 1;
487  }
488
489  // Answer generation specification.
490  message AnswerGenerationSpec {
491    // Answer Generation Model specification.
492    message ModelSpec {
493      // Model version. If not set, it will use the default stable model.
494      // Allowed values are: stable, preview.
495      string model_version = 1;
496    }
497
498    // Answer generation prompt specification.
499    message PromptSpec {
500      // Customized preamble.
501      string preamble = 1;
502    }
503
504    // Answer generation model specification.
505    ModelSpec model_spec = 1;
506
507    // Answer generation prompt specification.
508    PromptSpec prompt_spec = 2;
509
510    // Specifies whether to include citation metadata in the answer. The default
511    // value is `false`.
512    bool include_citations = 3;
513
514    // Language code for Answer. Use language tags defined by
515    // [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
516    // Note: This is an experimental feature.
517    string answer_language_code = 4;
518
519    // Specifies whether to filter out adversarial queries. The default value
520    // is `false`.
521    //
522    // Google employs search-query classification to detect adversarial
523    // queries. No answer is returned if the search query is classified as an
524    // adversarial query. For example, a user might ask a question regarding
525    // negative comments about the company or submit a query designed to
526    // generate unsafe, policy-violating output. If this field is set to
527    // `true`, we skip generating answers for adversarial queries and return
528    // fallback messages instead.
529    bool ignore_adversarial_query = 5;
530
531    // Specifies whether to filter out queries that are not answer-seeking.
532    // The default value is `false`.
533    //
534    // Google employs search-query classification to detect answer-seeking
535    // queries. No answer is returned if the search query is classified as a
536    // non-answer seeking query. If this field is set to `true`, we skip
537    // generating answers for non-answer seeking queries and return
538    // fallback messages instead.
539    bool ignore_non_answer_seeking_query = 6;
540  }
541
542  // Search specification.
543  message SearchSpec {
544    // Search parameters.
545    message SearchParams {
546      // Number of search results to return.
547      // The default value is 10.
548      int32 max_return_results = 1;
549
550      // The filter syntax consists of an expression language for constructing
551      // a predicate from one or more fields of the documents being filtered.
552      // Filter expression is case-sensitive. This will be used to filter
553      // search results which may affect the Answer response.
554      //
555      // If this field is unrecognizable, an  `INVALID_ARGUMENT`  is returned.
556      //
557      // Filtering in Vertex AI Search is done by mapping the LHS filter key
558      // to a key property defined in the Vertex AI Search backend -- this
559      // mapping is defined by the customer in their schema. For example a
560      // media customers might have a field 'name' in their schema. In this
561      // case the filter would look like this: filter --> name:'ANY("king
562      // kong")'
563      //
564      // For more information about filtering including syntax and filter
565      // operators, see
566      // [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata)
567      string filter = 2;
568
569      // Boost specification to boost certain documents in search results which
570      // may affect the answer query response. For more information on boosting,
571      // see [Boosting](https://cloud.google.com/retail/docs/boosting#boost)
572      SearchRequest.BoostSpec boost_spec = 3;
573
574      // The order in which documents are returned. Documents can be ordered
575      // by a field in an
576      // [Document][google.cloud.discoveryengine.v1alpha.Document] object. Leave
577      // it unset if ordered by relevance. `order_by` expression is
578      // case-sensitive. For more information on ordering, see
579      // [Ordering](https://cloud.google.com/retail/docs/filter-and-order#order)
580      //
581      // If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
582      string order_by = 4;
583
584      // Specifies the search result mode. If unspecified, the
585      // search result mode is based on
586      // [DataStore.DocumentProcessingConfig.chunking_config][]:
587      // * If [DataStore.DocumentProcessingConfig.chunking_config][] is
588      // specified,
589      //   it defaults to `CHUNKS`.
590      // * Otherwise, it defaults to `DOCUMENTS`.
591      // See [parse and chunk
592      // documents](https://cloud.google.com/generative-ai-app-builder/docs/parse-chunk-documents)
593      SearchRequest.ContentSearchSpec.SearchResultMode search_result_mode = 5;
594
595      // Custom fine tuning configs.
596      CustomFineTuningSpec custom_fine_tuning_spec = 6;
597    }
598
599    // Search result list.
600    message SearchResultList {
601      // Search result.
602      message SearchResult {
603        // Unstructured document information.
604        message UnstructuredDocumentInfo {
605          // Document context.
606          message DocumentContext {
607            // Page identifier.
608            string page_identifier = 1;
609
610            // Document content.
611            string content = 2;
612          }
613
614          // Extractive segment.
615          // [Guide](https://cloud.google.com/generative-ai-app-builder/docs/snippets#extractive-segments)
616          message ExtractiveSegment {
617            // Page identifier.
618            string page_identifier = 1;
619
620            // Extractive segment content.
621            string content = 2;
622          }
623
624          // Extractive answer.
625          // [Guide](https://cloud.google.com/generative-ai-app-builder/docs/snippets#get-answers)
626          message ExtractiveAnswer {
627            // Page identifier.
628            string page_identifier = 1;
629
630            // Extractive answer content.
631            string content = 2;
632          }
633
634          // Document resource name.
635          string document = 1 [(google.api.resource_reference) = {
636            type: "discoveryengine.googleapis.com/Document"
637          }];
638
639          // URI for the document.
640          string uri = 2;
641
642          // Title.
643          string title = 3;
644
645          // List of document contexts.
646          repeated DocumentContext document_contexts = 4;
647
648          // List of extractive segments.
649          repeated ExtractiveSegment extractive_segments = 5;
650
651          // List of extractive answers.
652          repeated ExtractiveAnswer extractive_answers = 6;
653        }
654
655        // Chunk information.
656        message ChunkInfo {
657          // Chunk resource name.
658          string chunk = 1 [(google.api.resource_reference) = {
659            type: "discoveryengine.googleapis.com/Chunk"
660          }];
661
662          // Chunk textual content.
663          string content = 2;
664        }
665
666        // Search result content.
667        oneof content {
668          // Unstructured document information.
669          UnstructuredDocumentInfo unstructured_document_info = 1;
670
671          // Chunk information.
672          ChunkInfo chunk_info = 2;
673        }
674      }
675
676      // Search results.
677      repeated SearchResult search_results = 1;
678    }
679
680    // Search parameters to control the search behavior.
681    // Or provide search result list to generate answer.
682    oneof input {
683      // Search parameters.
684      SearchParams search_params = 1;
685
686      // Search result list.
687      SearchResultList search_result_list = 2;
688    }
689  }
690
691  // Query understanding specification.
692  message QueryUnderstandingSpec {
693    // Query classification specification.
694    message QueryClassificationSpec {
695      // Query classification types.
696      enum Type {
697        // Unspecified query classification type.
698        TYPE_UNSPECIFIED = 0;
699
700        // Adversarial query classification type.
701        ADVERSARIAL_QUERY = 1;
702
703        // Non-answer-seeking query classification type.
704        NON_ANSWER_SEEKING_QUERY = 2;
705      }
706
707      // Enabled query classification types.
708      repeated Type types = 1;
709    }
710
711    // Query rephraser specification.
712    message QueryRephraserSpec {
713      // Disable query rephraser.
714      bool disable = 1;
715
716      // Max rephrase steps.
717      // The max number is 10 steps.
718      // If not set or set to < 1, it will be set to 1 by default.
719      int32 max_rephrase_steps = 2;
720    }
721
722    // Query classification specification.
723    QueryClassificationSpec query_classification_spec = 1;
724
725    // Query rephraser specification.
726    QueryRephraserSpec query_rephraser_spec = 2;
727  }
728
729  // Required. The resource name of the Search serving config, such as
730  // `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`,
731  // or
732  // `projects/*/locations/global/collections/default_collection/dataStores/*/servingConfigs/default_serving_config`.
733  // This field is used to identify the serving configuration name, set
734  // of models used to make the search.
735  string serving_config = 1 [
736    (google.api.field_behavior) = REQUIRED,
737    (google.api.resource_reference) = {
738      type: "discoveryengine.googleapis.com/ServingConfig"
739    }
740  ];
741
742  // Required. Current user query.
743  Query query = 2 [(google.api.field_behavior) = REQUIRED];
744
745  // The session resource name. Not required.
746  //
747  // When session field is not set, the API is in sessionless mode.
748  //
749  // We support auto session mode: users can use the wildcard symbol “-” as
750  // session id.  A new id will be automatically generated and assigned.
751  string session = 3 [(google.api.resource_reference) = {
752    type: "discoveryengine.googleapis.com/Session"
753  }];
754
755  // Model specification.
756  SafetySpec safety_spec = 4;
757
758  // Related questions specification.
759  RelatedQuestionsSpec related_questions_spec = 5;
760
761  // Answer generation specification.
762  AnswerGenerationSpec answer_generation_spec = 7;
763
764  // Search specification.
765  SearchSpec search_spec = 8;
766
767  // Query understanding specification.
768  QueryUnderstandingSpec query_understanding_spec = 9;
769
770  // Asynchronous mode control.
771  //
772  // If enabled, the response will be returned with answer/session resource
773  // name without final answer. The API users need to do the polling to get
774  // the latest status of answer/session by calling
775  // [ConversationalSearchService.GetAnswer][google.cloud.discoveryengine.v1alpha.ConversationalSearchService.GetAnswer]
776  // or
777  // [ConversationalSearchService.GetSession][google.cloud.discoveryengine.v1alpha.ConversationalSearchService.GetSession]
778  // method.
779  bool asynchronous_mode = 10;
780
781  // A unique identifier for tracking visitors. For example, this could be
782  // implemented with an HTTP cookie, which should be able to uniquely identify
783  // a visitor on a single device. This unique identifier should not change if
784  // the visitor logs in or out of the website.
785  //
786  // This field should NOT have a fixed value such as `unknown_visitor`.
787  //
788  // The field must be a UTF-8 encoded string with a length limit of 128
789  // characters. Otherwise, an  `INVALID_ARGUMENT`  error is returned.
790  string user_pseudo_id = 12;
791}
792
793// Response message for
794// [ConversationalSearchService.AnswerQuery][google.cloud.discoveryengine.v1alpha.ConversationalSearchService.AnswerQuery]
795// method.
796message AnswerQueryResponse {
797  // Answer resource object.
798  // If [AnswerQueryRequest.StepSpec.max_step_count][] is greater than 1,
799  // use [Answer.name][google.cloud.discoveryengine.v1alpha.Answer.name] to
800  // fetch answer information using
801  // [ConversationalSearchService.GetAnswer][google.cloud.discoveryengine.v1alpha.ConversationalSearchService.GetAnswer]
802  // API.
803  Answer answer = 1;
804
805  // Session resource object.
806  // It will be only available when session field is set and valid in the
807  // [AnswerQueryRequest][google.cloud.discoveryengine.v1alpha.AnswerQueryRequest]
808  // request.
809  Session session = 2;
810}
811
812// Request for GetAnswer method.
813message GetAnswerRequest {
814  // Required. The resource name of the Answer to get. Format:
815  // `projects/{project_number}/locations/{location_id}/collections/{collection}/engines/{engine_id}/sessions/{session_id}/answers/{answer_id}`
816  string name = 1 [
817    (google.api.field_behavior) = REQUIRED,
818    (google.api.resource_reference) = {
819      type: "discoveryengine.googleapis.com/Answer"
820    }
821  ];
822}
823
824// Request for CreateSession method.
825message CreateSessionRequest {
826  // Required. Full resource name of parent data store. Format:
827  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}`
828  string parent = 1 [
829    (google.api.field_behavior) = REQUIRED,
830    (google.api.resource_reference) = {
831      type: "discoveryengine.googleapis.com/DataStore"
832    }
833  ];
834
835  // Required. The session to create.
836  Session session = 2 [(google.api.field_behavior) = REQUIRED];
837}
838
839// Request for UpdateSession method.
840message UpdateSessionRequest {
841  // Required. The Session to update.
842  Session session = 1 [(google.api.field_behavior) = REQUIRED];
843
844  // Indicates which fields in the provided
845  // [Session][google.cloud.discoveryengine.v1alpha.Session] to update. The
846  // following are NOT supported:
847  //
848  // * [Session.name][google.cloud.discoveryengine.v1alpha.Session.name]
849  //
850  // If not set or empty, all supported fields are updated.
851  google.protobuf.FieldMask update_mask = 2;
852}
853
854// Request for DeleteSession method.
855message DeleteSessionRequest {
856  // Required. The resource name of the Session to delete. Format:
857  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}`
858  string name = 1 [
859    (google.api.field_behavior) = REQUIRED,
860    (google.api.resource_reference) = {
861      type: "discoveryengine.googleapis.com/Session"
862    }
863  ];
864}
865
866// Request for GetSession method.
867message GetSessionRequest {
868  // Required. The resource name of the Session to get. Format:
869  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}`
870  string name = 1 [
871    (google.api.field_behavior) = REQUIRED,
872    (google.api.resource_reference) = {
873      type: "discoveryengine.googleapis.com/Session"
874    }
875  ];
876}
877
878// Request for ListSessions method.
879message ListSessionsRequest {
880  // Required. The data store resource name. Format:
881  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}`
882  string parent = 1 [
883    (google.api.field_behavior) = REQUIRED,
884    (google.api.resource_reference) = {
885      type: "discoveryengine.googleapis.com/DataStore"
886    }
887  ];
888
889  // Maximum number of results to return. If unspecified, defaults
890  // to 50. Max allowed value is 1000.
891  int32 page_size = 2;
892
893  // A page token, received from a previous `ListSessions` call.
894  // Provide this to retrieve the subsequent page.
895  string page_token = 3;
896
897  // A filter to apply on the list results. The supported features are:
898  // user_pseudo_id, state.
899  //
900  // Example:
901  // "user_pseudo_id = some_id"
902  string filter = 4;
903
904  // A comma-separated list of fields to order by, sorted in ascending order.
905  // Use "desc" after a field name for descending.
906  // Supported fields:
907  //   * `update_time`
908  //   * `create_time`
909  //   * `session_name`
910  //
911  // Example:
912  // "update_time desc"
913  // "create_time"
914  string order_by = 5;
915}
916
917// Response for ListSessions method.
918message ListSessionsResponse {
919  // All the Sessions for a given data store.
920  repeated Session sessions = 1;
921
922  // Pagination token, if not returned indicates the last page.
923  string next_page_token = 2;
924}
925