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/import_config.proto"; 24import "google/cloud/discoveryengine/v1beta/purge_config.proto"; 25import "google/longrunning/operations.proto"; 26 27option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Beta"; 28option go_package = "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb;discoveryenginepb"; 29option java_multiple_files = true; 30option java_outer_classname = "CompletionServiceProto"; 31option java_package = "com.google.cloud.discoveryengine.v1beta"; 32option objc_class_prefix = "DISCOVERYENGINE"; 33option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1beta"; 34option ruby_package = "Google::Cloud::DiscoveryEngine::V1beta"; 35 36// Service for Auto-Completion. 37service CompletionService { 38 option (google.api.default_host) = "discoveryengine.googleapis.com"; 39 option (google.api.oauth_scopes) = 40 "https://www.googleapis.com/auth/cloud-platform"; 41 42 // Completes the specified user input with keyword suggestions. 43 rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) { 44 option (google.api.http) = { 45 get: "/v1beta/{data_store=projects/*/locations/*/dataStores/*}:completeQuery" 46 additional_bindings { 47 get: "/v1beta/{data_store=projects/*/locations/*/collections/*/dataStores/*}:completeQuery" 48 } 49 }; 50 } 51 52 // Imports all 53 // [SuggestionDenyListEntry][google.cloud.discoveryengine.v1beta.SuggestionDenyListEntry] 54 // for a DataStore. 55 rpc ImportSuggestionDenyListEntries(ImportSuggestionDenyListEntriesRequest) 56 returns (google.longrunning.Operation) { 57 option (google.api.http) = { 58 post: "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/suggestionDenyListEntries:import" 59 body: "*" 60 additional_bindings { 61 post: "/v1beta/{parent=projects/*/locations/*/dataStores/*}/suggestionDenyListEntries:import" 62 body: "*" 63 } 64 }; 65 option (google.longrunning.operation_info) = { 66 response_type: "google.cloud.discoveryengine.v1beta.ImportSuggestionDenyListEntriesResponse" 67 metadata_type: "google.cloud.discoveryengine.v1beta.ImportSuggestionDenyListEntriesMetadata" 68 }; 69 } 70 71 // Permanently deletes all 72 // [SuggestionDenyListEntry][google.cloud.discoveryengine.v1beta.SuggestionDenyListEntry] 73 // for a DataStore. 74 rpc PurgeSuggestionDenyListEntries(PurgeSuggestionDenyListEntriesRequest) 75 returns (google.longrunning.Operation) { 76 option (google.api.http) = { 77 post: "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/suggestionDenyListEntries:purge" 78 body: "*" 79 additional_bindings { 80 post: "/v1beta/{parent=projects/*/locations/*/dataStores/**}/suggestionDenyListEntries:purge" 81 body: "*" 82 } 83 }; 84 option (google.longrunning.operation_info) = { 85 response_type: "google.cloud.discoveryengine.v1beta.PurgeSuggestionDenyListEntriesResponse" 86 metadata_type: "google.cloud.discoveryengine.v1beta.PurgeSuggestionDenyListEntriesMetadata" 87 }; 88 } 89} 90 91// Request message for 92// [CompletionService.CompleteQuery][google.cloud.discoveryengine.v1beta.CompletionService.CompleteQuery] 93// method. 94message CompleteQueryRequest { 95 // Required. The parent data store resource name for which the completion is 96 // performed, such as 97 // `projects/*/locations/global/collections/default_collection/dataStores/default_data_store`. 98 string data_store = 1 [ 99 (google.api.field_behavior) = REQUIRED, 100 (google.api.resource_reference) = { 101 type: "discoveryengine.googleapis.com/DataStore" 102 } 103 ]; 104 105 // Required. The typeahead input used to fetch suggestions. Maximum length is 106 // 128 characters. 107 string query = 2 [(google.api.field_behavior) = REQUIRED]; 108 109 // Specifies the autocomplete data model. This overrides any model specified 110 // in the Configuration > Autocomplete section of the Cloud console. Currently 111 // supported values: 112 // 113 // * `document` - Using suggestions generated from user-imported documents. 114 // * `search-history` - Using suggestions generated from the past history of 115 // [SearchService.Search][google.cloud.discoveryengine.v1beta.SearchService.Search] 116 // API calls. Do not use it when there is no traffic for Search API. 117 // * `user-event` - Using suggestions generated from user-imported search 118 // events. 119 // * `document-completable` - Using suggestions taken directly from 120 // user-imported document fields marked as completable. 121 // 122 // Default values: 123 // 124 // * `document` is the default model for regular dataStores. 125 // * `search-history` is the default model for site search dataStores. 126 string query_model = 3; 127 128 // A unique identifier for tracking visitors. For example, this could be 129 // implemented with an HTTP cookie, which should be able to uniquely identify 130 // a visitor on a single device. This unique identifier should not change if 131 // the visitor logs in or out of the website. 132 // 133 // This field should NOT have a fixed value such as `unknown_visitor`. 134 // 135 // This should be the same identifier as 136 // [UserEvent.user_pseudo_id][google.cloud.discoveryengine.v1beta.UserEvent.user_pseudo_id] 137 // and 138 // [SearchRequest.user_pseudo_id][google.cloud.discoveryengine.v1beta.SearchRequest.user_pseudo_id]. 139 // 140 // The field must be a UTF-8 encoded string with a length limit of 128 141 // characters. Otherwise, an `INVALID_ARGUMENT` error is returned. 142 string user_pseudo_id = 4; 143 144 // Indicates if tail suggestions should be returned if there are no 145 // suggestions that match the full query. Even if set to true, if there are 146 // suggestions that match the full query, those are returned and no 147 // tail suggestions are returned. 148 bool include_tail_suggestions = 5; 149} 150 151// Response message for 152// [CompletionService.CompleteQuery][google.cloud.discoveryengine.v1beta.CompletionService.CompleteQuery] 153// method. 154message CompleteQueryResponse { 155 // Suggestions as search queries. 156 message QuerySuggestion { 157 // The suggestion for the query. 158 string suggestion = 1; 159 160 // The unique document field paths that serve as the source of this 161 // suggestion if it was generated from completable fields. 162 // 163 // This field is only populated for the document-completable model. 164 repeated string completable_field_paths = 2; 165 } 166 167 // Results of the matched query suggestions. The result list is ordered and 168 // the first result is a top suggestion. 169 repeated QuerySuggestion query_suggestions = 1; 170 171 // True if the returned suggestions are all tail suggestions. 172 // 173 // For tail matching to be triggered, include_tail_suggestions in the request 174 // must be true and there must be no suggestions that match the full query. 175 bool tail_match_triggered = 2; 176} 177