Skip to content

Commit d01eb46

Browse files
Google APIscopybara-github
authored andcommitted
feat: add conversational search
feat: add tile navigation docs: keep the API doc up-to-date with recent changes PiperOrigin-RevId: 683821686
1 parent c24e836 commit d01eb46

8 files changed

Lines changed: 482 additions & 7 deletions

File tree

google/cloud/retail/v2/BUILD.bazel

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99
# * extra_protoc_file_parameters
1010
# The complete list of preserved parameters can be found in the source code.
1111

12+
# buildifier: disable=load-on-top
13+
1214
# This is an API workspace, having public visibility by default makes perfect sense.
1315
package(default_visibility = ["//visibility:public"])
1416

1517
##############################################################################
1618
# Common
1719
##############################################################################
18-
load("@rules_proto//proto:defs.bzl", "proto_library")
20+
# buildifier: disable=same-origin-load
1921
load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
22+
load("@rules_proto//proto:defs.bzl", "proto_library")
2023

2124
proto_library(
2225
name = "retail_proto",
@@ -29,6 +32,8 @@ proto_library(
2932
"control.proto",
3033
"control_service.proto",
3134
"export_config.proto",
35+
"generative_question.proto",
36+
"generative_question_service.proto",
3237
"import_config.proto",
3338
"model.proto",
3439
"model_service.proto",
@@ -66,12 +71,14 @@ proto_library_with_info(
6671
deps = [
6772
":retail_proto",
6873
"//google/cloud:common_resources_proto",
74+
"//google/cloud/location:location_proto",
6975
],
7076
)
7177

7278
##############################################################################
7379
# Java
7480
##############################################################################
81+
# buildifier: disable=same-origin-load
7582
load(
7683
"@com_google_googleapis_imports//:imports.bzl",
7784
"java_gapic_assembly_gradle_pkg",
@@ -101,11 +108,13 @@ java_gapic_library(
101108
service_yaml = "retail_v2.yaml",
102109
test_deps = [
103110
":retail_java_grpc",
111+
"//google/cloud/location:location_java_grpc",
104112
],
105113
transport = "grpc+rest",
106114
deps = [
107115
":retail_java_proto",
108116
"//google/api:api_java_proto",
117+
"//google/cloud/location:location_java_proto",
109118
],
110119
)
111120

@@ -120,6 +129,8 @@ java_gapic_test(
120129
"com.google.cloud.retail.v2.CompletionServiceClientTest",
121130
"com.google.cloud.retail.v2.ControlServiceClientHttpJsonTest",
122131
"com.google.cloud.retail.v2.ControlServiceClientTest",
132+
"com.google.cloud.retail.v2.GenerativeQuestionServiceClientHttpJsonTest",
133+
"com.google.cloud.retail.v2.GenerativeQuestionServiceClientTest",
123134
"com.google.cloud.retail.v2.ModelServiceClientHttpJsonTest",
124135
"com.google.cloud.retail.v2.ModelServiceClientTest",
125136
"com.google.cloud.retail.v2.PredictionServiceClientHttpJsonTest",
@@ -152,6 +163,7 @@ java_gapic_assembly_gradle_pkg(
152163
##############################################################################
153164
# Go
154165
##############################################################################
166+
# buildifier: disable=same-origin-load
155167
load(
156168
"@com_google_googleapis_imports//:imports.bzl",
157169
"go_gapic_assembly_pkg",
@@ -182,9 +194,11 @@ go_gapic_library(
182194
release_level = "ga",
183195
rest_numeric_enums = True,
184196
service_yaml = "retail_v2.yaml",
197+
transport = "grpc+rest",
185198
deps = [
186199
":retail_go_proto",
187200
"//google/api:httpbody_go_proto",
201+
"//google/cloud/location:location_go_proto",
188202
"//google/longrunning:longrunning_go_proto",
189203
"@com_google_cloud_go_longrunning//:go_default_library",
190204
"@com_google_cloud_go_longrunning//autogen:go_default_library",
@@ -208,6 +222,7 @@ go_gapic_assembly_pkg(
208222
##############################################################################
209223
# Python
210224
##############################################################################
225+
# buildifier: disable=same-origin-load
211226
load(
212227
"@com_google_googleapis_imports//:imports.bzl",
213228
"py_gapic_assembly_pkg",
@@ -222,6 +237,8 @@ py_gapic_library(
222237
rest_numeric_enums = True,
223238
service_yaml = "retail_v2.yaml",
224239
transport = "grpc+rest",
240+
deps = [
241+
],
225242
)
226243

227244
py_test(
@@ -245,6 +262,7 @@ py_gapic_assembly_pkg(
245262
##############################################################################
246263
# PHP
247264
##############################################################################
265+
# buildifier: disable=same-origin-load
248266
load(
249267
"@com_google_googleapis_imports//:imports.bzl",
250268
"php_gapic_assembly_pkg",
@@ -265,7 +283,9 @@ php_gapic_library(
265283
rest_numeric_enums = True,
266284
service_yaml = "retail_v2.yaml",
267285
transport = "grpc+rest",
268-
deps = [":retail_php_proto"],
286+
deps = [
287+
":retail_php_proto",
288+
],
269289
)
270290

271291
# Open Source Packages
@@ -280,6 +300,7 @@ php_gapic_assembly_pkg(
280300
##############################################################################
281301
# Node.js
282302
##############################################################################
303+
# buildifier: disable=same-origin-load
283304
load(
284305
"@com_google_googleapis_imports//:imports.bzl",
285306
"nodejs_gapic_assembly_pkg",
@@ -311,6 +332,7 @@ nodejs_gapic_assembly_pkg(
311332
##############################################################################
312333
# Ruby
313334
##############################################################################
335+
# buildifier: disable=same-origin-load
314336
load(
315337
"@com_google_googleapis_imports//:imports.bzl",
316338
"ruby_cloud_gapic_library",
@@ -365,6 +387,7 @@ ruby_gapic_assembly_pkg(
365387
##############################################################################
366388
# C#
367389
##############################################################################
390+
# buildifier: disable=same-origin-load
368391
load(
369392
"@com_google_googleapis_imports//:imports.bzl",
370393
"csharp_gapic_assembly_pkg",
@@ -375,6 +398,7 @@ load(
375398

376399
csharp_proto_library(
377400
name = "retail_csharp_proto",
401+
extra_opts = [],
378402
deps = [":retail_proto"],
379403
)
380404

@@ -411,6 +435,7 @@ csharp_gapic_assembly_pkg(
411435
##############################################################################
412436
# C++
413437
##############################################################################
438+
# buildifier: disable=same-origin-load
414439
load(
415440
"@com_google_googleapis_imports//:imports.bzl",
416441
"cc_grpc_library",

google/cloud/retail/v2/common.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ message Rule {
337337
}
338338

339339
// Each instance corresponds to a force return attribute for the given
340-
// condition. There can't be more 3 instances here.
340+
// condition. There can't be more 15 instances here.
341341
repeated FacetPositionAdjustment facet_position_adjustments = 1;
342342
}
343343

google/cloud/retail/v2/completion_service.proto

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ message CompleteQueryRequest {
151151
// capped by 20.
152152
int32 max_suggestions = 5;
153153

154-
// If true, attribute suggestions are enabled and provided in response.
154+
// If true, attribute suggestions are enabled and provided in the response.
155155
//
156-
// This field is only available for "cloud-retail" dataset.
156+
// This field is only available for the "cloud-retail" dataset.
157157
bool enable_attribute_suggestions = 9;
158158

159159
// The entity for customers who run multiple entities, domains, sites, or
@@ -192,6 +192,12 @@ message CompleteQueryResponse {
192192
string recent_search = 1;
193193
}
194194

195+
// Resource that represents attribute results.
196+
// The list of suggestions for the attribute.
197+
message AttributeResult {
198+
repeated string suggestions = 1;
199+
}
200+
195201
// Results of the matching suggestions. The result list is ordered and the
196202
// first result is top suggestion.
197203
repeated CompletionResult completion_results = 1;
@@ -224,4 +230,14 @@ message CompleteQueryResponse {
224230
// Recent searches are deduplicated. More recent searches will be reserved
225231
// when duplication happens.
226232
repeated RecentSearchResult recent_search_results = 3 [deprecated = true];
233+
234+
// A map of matched attribute suggestions. This field is only available for
235+
// "cloud-retail" dataset.
236+
//
237+
// Current supported keys:
238+
//
239+
// * `brands`
240+
//
241+
// * `categories`
242+
map<string, AttributeResult> attribute_results = 4;
227243
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Copyright 2024 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.v2;
18+
19+
import "google/api/field_behavior.proto";
20+
21+
option csharp_namespace = "Google.Cloud.Retail.V2";
22+
option go_package = "cloud.google.com/go/retail/apiv2/retailpb;retailpb";
23+
option java_multiple_files = true;
24+
option java_outer_classname = "GenerativeQuestionProto";
25+
option java_package = "com.google.cloud.retail.v2";
26+
option objc_class_prefix = "RETAIL";
27+
option php_namespace = "Google\\Cloud\\Retail\\V2";
28+
option ruby_package = "Google::Cloud::Retail::V2";
29+
30+
// Configuration for overall generative question feature state.
31+
message GenerativeQuestionsFeatureConfig {
32+
// Required. Resource name of the affected catalog.
33+
// Format: projects/{project}/locations/{location}/catalogs/{catalog}
34+
string catalog = 1 [(google.api.field_behavior) = REQUIRED];
35+
36+
// Optional. Determines whether questions will be used at serving time.
37+
// Note: This feature cannot be enabled until initial data requirements are
38+
// satisfied.
39+
bool feature_enabled = 2 [(google.api.field_behavior) = OPTIONAL];
40+
41+
// Optional. Minimum number of products in the response to trigger follow-up
42+
// questions. Value must be 0 or positive.
43+
int32 minimum_products = 3 [(google.api.field_behavior) = OPTIONAL];
44+
}
45+
46+
// Configuration for a single generated question.
47+
message GenerativeQuestionConfig {
48+
// Required. Resource name of the catalog.
49+
// Format: projects/{project}/locations/{location}/catalogs/{catalog}
50+
string catalog = 1 [(google.api.field_behavior) = REQUIRED];
51+
52+
// Required. The facet to which the question is associated.
53+
string facet = 2 [(google.api.field_behavior) = REQUIRED];
54+
55+
// Output only. The LLM generated question.
56+
string generated_question = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
57+
58+
// Optional. The question that will be used at serving time.
59+
// Question can have a max length of 300 bytes.
60+
// When not populated, generated_question should be used.
61+
string final_question = 4 [(google.api.field_behavior) = OPTIONAL];
62+
63+
// Output only. Values that can be used to answer the question.
64+
repeated string example_values = 5
65+
[(google.api.field_behavior) = OUTPUT_ONLY];
66+
67+
// Output only. The ratio of how often a question was asked.
68+
float frequency = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
69+
70+
// Optional. Whether the question is asked at serving time.
71+
bool allowed_in_conversation = 7 [(google.api.field_behavior) = OPTIONAL];
72+
}

0 commit comments

Comments
 (0)