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