|
| 1 | +// Copyright 2025 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +syntax = "proto3"; |
| 16 | + |
| 17 | +package google.cloud.retail.v2alpha; |
| 18 | + |
| 19 | +import "google/api/annotations.proto"; |
| 20 | +import "google/api/client.proto"; |
| 21 | +import "google/api/field_behavior.proto"; |
| 22 | +import "google/api/resource.proto"; |
| 23 | +import "google/cloud/retail/v2alpha/common.proto"; |
| 24 | +import "google/cloud/retail/v2alpha/search_service.proto"; |
| 25 | + |
| 26 | +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; |
| 27 | +option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; |
| 28 | +option java_multiple_files = true; |
| 29 | +option java_outer_classname = "ConversationalSearchServiceProto"; |
| 30 | +option java_package = "com.google.cloud.retail.v2alpha"; |
| 31 | +option objc_class_prefix = "RETAIL"; |
| 32 | +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; |
| 33 | +option ruby_package = "Google::Cloud::Retail::V2alpha"; |
| 34 | + |
| 35 | +// Service for retail conversational search. |
| 36 | +// |
| 37 | +// This feature is only available for users who have Retail Conversational |
| 38 | +// Search enabled. Enable Retail Conversational Search on Cloud Console |
| 39 | +// before using this feature. |
| 40 | +service ConversationalSearchService { |
| 41 | + option (google.api.default_host) = "retail.googleapis.com"; |
| 42 | + option (google.api.oauth_scopes) = |
| 43 | + "https://www.googleapis.com/auth/cloud-platform"; |
| 44 | + |
| 45 | + // Performs a conversational search. |
| 46 | + // |
| 47 | + // This feature is only available for users who have Conversational Search |
| 48 | + // enabled. |
| 49 | + rpc ConversationalSearch(ConversationalSearchRequest) |
| 50 | + returns (stream ConversationalSearchResponse) { |
| 51 | + option (google.api.http) = { |
| 52 | + post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:conversationalSearch" |
| 53 | + body: "*" |
| 54 | + additional_bindings { |
| 55 | + post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:conversationalSearch" |
| 56 | + body: "*" |
| 57 | + } |
| 58 | + }; |
| 59 | + } |
| 60 | +} |
| 61 | + |
| 62 | +// Request message for |
| 63 | +// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2alpha.ConversationalSearchService.ConversationalSearch] |
| 64 | +// method. |
| 65 | +message ConversationalSearchRequest { |
| 66 | + // Search parameters. |
| 67 | + message SearchParams { |
| 68 | + // Optional. The filter string to restrict search results. |
| 69 | + // |
| 70 | + // The syntax of the filter string is the same as |
| 71 | + // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter]. |
| 72 | + string filter = 1 [(google.api.field_behavior) = OPTIONAL]; |
| 73 | + |
| 74 | + // Optional. The canonical filter string to restrict search results. |
| 75 | + // |
| 76 | + // The syntax of the canonical filter string is the same as |
| 77 | + // [SearchRequest.canonical_filter][google.cloud.retail.v2alpha.SearchRequest.canonical_filter]. |
| 78 | + string canonical_filter = 2 [(google.api.field_behavior) = OPTIONAL]; |
| 79 | + |
| 80 | + // Optional. The sort string to specify the sorting of search results. |
| 81 | + // |
| 82 | + // The syntax of the sort string is the same as |
| 83 | + // [SearchRequest.sort][]. |
| 84 | + string sort_by = 3 [(google.api.field_behavior) = OPTIONAL]; |
| 85 | + |
| 86 | + // Optional. The boost spec to specify the boosting of search results. |
| 87 | + // |
| 88 | + // The syntax of the boost spec is the same as |
| 89 | + // [SearchRequest.boost_spec][google.cloud.retail.v2alpha.SearchRequest.boost_spec]. |
| 90 | + SearchRequest.BoostSpec boost_spec = 4 |
| 91 | + [(google.api.field_behavior) = OPTIONAL]; |
| 92 | + } |
| 93 | + |
| 94 | + // This field specifies the current user answer during the conversational |
| 95 | + // filtering search. This can be either user selected from suggested answers |
| 96 | + // or user input plain text. |
| 97 | + message UserAnswer { |
| 98 | + // This field specifies the selected answers during the conversational |
| 99 | + // search. |
| 100 | + message SelectedAnswer { |
| 101 | + // Optional. This field specifies the selected answer which is a attribute |
| 102 | + // key-value. |
| 103 | + ProductAttributeValue product_attribute_value = 1 |
| 104 | + [(google.api.field_behavior) = OPTIONAL]; |
| 105 | + } |
| 106 | + |
| 107 | + // This field specifies the type of user answer. |
| 108 | + oneof type { |
| 109 | + // This field specifies the incremental input text from the user during |
| 110 | + // the conversational search. |
| 111 | + string text_answer = 1; |
| 112 | + |
| 113 | + // Optional. This field specifies the selected answer during the |
| 114 | + // conversational search. This should be a subset of |
| 115 | + // [ConversationalSearchResponse.followup_question.suggested_answers][]. |
| 116 | + SelectedAnswer selected_answer = 2 |
| 117 | + [(google.api.field_behavior) = OPTIONAL]; |
| 118 | + } |
| 119 | + } |
| 120 | + |
| 121 | + // This field specifies all conversational filtering related parameters |
| 122 | + // addition to conversational retail search. |
| 123 | + message ConversationalFilteringSpec { |
| 124 | + // Enum to control Conversational Filtering mode. |
| 125 | + enum Mode { |
| 126 | + // Default value. |
| 127 | + MODE_UNSPECIFIED = 0; |
| 128 | + |
| 129 | + // Enabled Conversational Filtering without default Conversational Search. |
| 130 | + CONVERSATIONAL_FILTER_ONLY = 3; |
| 131 | + } |
| 132 | + |
| 133 | + // Optional. This field is deprecated. Please use |
| 134 | + // [ConversationalFilteringSpec.conversational_filtering_mode][google.cloud.retail.v2alpha.ConversationalSearchRequest.ConversationalFilteringSpec.conversational_filtering_mode] |
| 135 | + // instead. |
| 136 | + bool enable_conversational_filtering = 1 |
| 137 | + [deprecated = true, (google.api.field_behavior) = OPTIONAL]; |
| 138 | + |
| 139 | + // Optional. This field specifies the current user answer during the |
| 140 | + // conversational filtering search. It can be either user selected from |
| 141 | + // suggested answers or user input plain text. |
| 142 | + UserAnswer user_answer = 2 [(google.api.field_behavior) = OPTIONAL]; |
| 143 | + |
| 144 | + // Optional. Mode to control Conversational Filtering. |
| 145 | + // Defaults to |
| 146 | + // [Mode.DISABLED][google.cloud.retail.v2alpha.ConversationalSearchRequest.ConversationalFilteringSpec.Mode.DISABLED] |
| 147 | + // if it's unset. |
| 148 | + Mode conversational_filtering_mode = 4 |
| 149 | + [(google.api.field_behavior) = OPTIONAL]; |
| 150 | + } |
| 151 | + |
| 152 | + // Required. The resource name of the search engine placement, such as |
| 153 | + // `projects/*/locations/global/catalogs/default_catalog/placements/default_search` |
| 154 | + // or |
| 155 | + // `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` |
| 156 | + // This field is used to identify the serving config name and the set |
| 157 | + // of models that will be used to make the search. |
| 158 | + string placement = 1 [(google.api.field_behavior) = REQUIRED]; |
| 159 | + |
| 160 | + // Required. The branch resource name, such as |
| 161 | + // `projects/*/locations/global/catalogs/default_catalog/branches/0`. |
| 162 | + // |
| 163 | + // Use "default_branch" as the branch ID or leave this field empty, to search |
| 164 | + // products under the default branch. |
| 165 | + string branch = 2 [ |
| 166 | + (google.api.field_behavior) = REQUIRED, |
| 167 | + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } |
| 168 | + ]; |
| 169 | + |
| 170 | + // Optional. Raw search query to be searched for. |
| 171 | + // |
| 172 | + // If this field is empty, the request is considered a category browsing |
| 173 | + // request. |
| 174 | + string query = 3 [(google.api.field_behavior) = OPTIONAL]; |
| 175 | + |
| 176 | + // Optional. The categories associated with a category page. Must be set for |
| 177 | + // category navigation queries to achieve good search quality. The format |
| 178 | + // should be the same as |
| 179 | + // [UserEvent.page_categories][google.cloud.retail.v2alpha.UserEvent.page_categories]; |
| 180 | + // |
| 181 | + // To represent full path of category, use '>' sign to separate different |
| 182 | + // hierarchies. If '>' is part of the category name, replace it with |
| 183 | + // other character(s). |
| 184 | + // |
| 185 | + // Category pages include special pages such as sales or promotions. For |
| 186 | + // instance, a special sale page may have the category hierarchy: |
| 187 | + // "pageCategories" : ["Sales > 2017 Black Friday Deals"]. |
| 188 | + repeated string page_categories = 4 [(google.api.field_behavior) = OPTIONAL]; |
| 189 | + |
| 190 | + // Optional. This field specifies the conversation id, which maintains the |
| 191 | + // state of the conversation between client side and server side. Use the |
| 192 | + // value from the previous |
| 193 | + // [ConversationalSearchResponse.conversation_id][google.cloud.retail.v2alpha.ConversationalSearchResponse.conversation_id]. |
| 194 | + // For the initial request, this should be empty. |
| 195 | + string conversation_id = 5 [(google.api.field_behavior) = OPTIONAL]; |
| 196 | + |
| 197 | + // Optional. Search parameters. |
| 198 | + SearchParams search_params = 6 [(google.api.field_behavior) = OPTIONAL]; |
| 199 | + |
| 200 | + // Required. A unique identifier for tracking visitors. For example, this |
| 201 | + // could be implemented with an HTTP cookie, which should be able to uniquely |
| 202 | + // identify a visitor on a single device. This unique identifier should not |
| 203 | + // change if the visitor logs in or out of the website. |
| 204 | + // |
| 205 | + // This should be the same identifier as |
| 206 | + // [UserEvent.visitor_id][google.cloud.retail.v2alpha.UserEvent.visitor_id]. |
| 207 | + // |
| 208 | + // The field must be a UTF-8 encoded string with a length limit of 128 |
| 209 | + // characters. Otherwise, an INVALID_ARGUMENT error is returned. |
| 210 | + string visitor_id = 9 [(google.api.field_behavior) = REQUIRED]; |
| 211 | + |
| 212 | + // Optional. User information. |
| 213 | + UserInfo user_info = 7 [(google.api.field_behavior) = OPTIONAL]; |
| 214 | + |
| 215 | + // Optional. This field specifies all conversational filtering related |
| 216 | + // parameters. |
| 217 | + ConversationalFilteringSpec conversational_filtering_spec = 8 |
| 218 | + [(google.api.field_behavior) = OPTIONAL]; |
| 219 | +} |
| 220 | + |
| 221 | +// Response message for |
| 222 | +// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2alpha.ConversationalSearchService.ConversationalSearch] |
| 223 | +// method. |
| 224 | +message ConversationalSearchResponse { |
| 225 | + // The conversational followup question generated for Intent refinement. |
| 226 | + message FollowupQuestion { |
| 227 | + // Suggested answers to the follow-up question. |
| 228 | + message SuggestedAnswer { |
| 229 | + // Product attribute value, including an attribute key and an |
| 230 | + // attribute value. Other types can be added here in the future. |
| 231 | + ProductAttributeValue product_attribute_value = 1; |
| 232 | + } |
| 233 | + |
| 234 | + // The conversational followup question generated for Intent refinement. |
| 235 | + string followup_question = 1; |
| 236 | + |
| 237 | + // The answer options provided to client for the follow-up question. |
| 238 | + repeated SuggestedAnswer suggested_answers = 2; |
| 239 | + } |
| 240 | + |
| 241 | + // The proposed refined search for intent-refinement/bundled shopping |
| 242 | + // conversation. When using CONVERSATIONAL_FILTER_ONLY mode, the |
| 243 | + // refined_query from search response will be populated here. |
| 244 | + message RefinedSearch { |
| 245 | + // The query to be used for search. |
| 246 | + string query = 1; |
| 247 | + } |
| 248 | + |
| 249 | + // This field specifies all related information that is needed on client |
| 250 | + // side for UI rendering of conversational filtering search. |
| 251 | + message ConversationalFilteringResult { |
| 252 | + // Additional filter that client side need to apply. |
| 253 | + message AdditionalFilter { |
| 254 | + // Product attribute value, including an attribute key and an |
| 255 | + // attribute value. Other types can be added here in the future. |
| 256 | + ProductAttributeValue product_attribute_value = 1; |
| 257 | + } |
| 258 | + |
| 259 | + // The conversational filtering question. |
| 260 | + FollowupQuestion followup_question = 1; |
| 261 | + |
| 262 | + // This is the incremental additional filters implied from the current |
| 263 | + // user answer. User should add the suggested addition filters to the |
| 264 | + // previous [ConversationalSearchRequest.search_params.filter][] and |
| 265 | + // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter], |
| 266 | + // and use the merged filter in the follow up requests. |
| 267 | + AdditionalFilter additional_filter = 2; |
| 268 | + } |
| 269 | + |
| 270 | + // Conversation UUID. This field will be stored in client side storage to |
| 271 | + // maintain the conversation session with server and will be used for next |
| 272 | + // search request's |
| 273 | + // [ConversationalSearchRequest.conversation_id][google.cloud.retail.v2alpha.ConversationalSearchRequest.conversation_id] |
| 274 | + // to restore conversation state in server. |
| 275 | + string conversation_id = 4; |
| 276 | + |
| 277 | + // The proposed refined search queries. They can be used to fetch the relevant |
| 278 | + // search results. When using CONVERSATIONAL_FILTER_ONLY mode, the |
| 279 | + // refined_query from search response will be populated here. |
| 280 | + repeated RefinedSearch refined_search = 6; |
| 281 | + |
| 282 | + // This field specifies all related information that is needed on client |
| 283 | + // side for UI rendering of conversational filtering search. |
| 284 | + ConversationalFilteringResult conversational_filtering_result = 7; |
| 285 | +} |
0 commit comments