Skip to content

Commit a083dfb

Browse files
Google APIscopybara-github
authored andcommitted
feat: add new fields in conversational search public SDK
PiperOrigin-RevId: 787249742
1 parent e3d5822 commit a083dfb

3 files changed

Lines changed: 170 additions & 0 deletions

File tree

google/cloud/retail/v2alpha/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ proto_library(
4949
"project_service.proto",
5050
"promotion.proto",
5151
"purge_config.proto",
52+
"safety.proto",
5253
"search_service.proto",
5354
"serving_config.proto",
5455
"serving_config_service.proto",

google/cloud/retail/v2alpha/conversational_search_service.proto

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import "google/api/client.proto";
2121
import "google/api/field_behavior.proto";
2222
import "google/api/resource.proto";
2323
import "google/cloud/retail/v2alpha/common.proto";
24+
import "google/cloud/retail/v2alpha/safety.proto";
2425
import "google/cloud/retail/v2alpha/search_service.proto";
2526

2627
option csharp_namespace = "Google.Cloud.Retail.V2Alpha";
@@ -126,6 +127,12 @@ message ConversationalSearchRequest {
126127
// Default value.
127128
MODE_UNSPECIFIED = 0;
128129

130+
// Disable Conversational Filtering.
131+
DISABLED = 1;
132+
133+
// Enabled Conversational Filtering with default Conversational Search.
134+
ENABLED = 2;
135+
129136
// Enabled Conversational Filtering without default Conversational Search.
130137
CONVERSATIONAL_FILTER_ONLY = 3;
131138
}
@@ -216,6 +223,30 @@ message ConversationalSearchRequest {
216223
// parameters.
217224
ConversationalFilteringSpec conversational_filtering_spec = 8
218225
[(google.api.field_behavior) = OPTIONAL];
226+
227+
// Optional. The user labels applied to a resource must meet the following
228+
// requirements:
229+
//
230+
// * Each resource can have multiple labels, up to a maximum of 64.
231+
// * Each label must be a key-value pair.
232+
// * Keys have a minimum length of 1 character and a maximum length of 63
233+
// characters and cannot be empty. Values can be empty and have a maximum
234+
// length of 63 characters.
235+
// * Keys and values can contain only lowercase letters, numeric characters,
236+
// underscores, and dashes. All characters must use UTF-8 encoding, and
237+
// international characters are allowed.
238+
// * The key portion of a label must be unique. However, you can use the same
239+
// key with multiple resources.
240+
// * Keys must start with a lowercase letter or international character.
241+
//
242+
// See [Google Cloud
243+
// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
244+
// for more details.
245+
map<string, string> user_labels = 12 [(google.api.field_behavior) = OPTIONAL];
246+
247+
// Optional. The safety settings to be applied to the generated content.
248+
repeated SafetySetting safety_settings = 14
249+
[(google.api.field_behavior) = OPTIONAL];
219250
}
220251

221252
// Response message for
@@ -269,6 +300,46 @@ message ConversationalSearchResponse {
269300
AdditionalFilter additional_filter = 2;
270301
}
271302

303+
// The state of the response generation.
304+
enum State {
305+
// Unknown.
306+
STATE_UNSPECIFIED = 0;
307+
308+
// Response generation is being streamed.
309+
STREAMING = 1;
310+
311+
// Response generation has succeeded.
312+
SUCCEEDED = 2;
313+
}
314+
315+
// The types Retail classifies the search query as.
316+
//
317+
// Supported values are:
318+
//
319+
// - "ADVERSARIAL"
320+
// - "CHITCHAT"
321+
// - "JAILBREAK"
322+
// - "ORDER_SUPPORT"
323+
// - "SIMPLE_PRODUCT_SEARCH"
324+
// - "INTENT_REFINEMENT"
325+
// - "PRODUCT_DETAILS"
326+
// - "PRODUCT_COMPARISON"
327+
// - "DEALS_AND_COUPONS"
328+
// - "STORE_RELEVANT"
329+
// - "BLOCKLISTED"
330+
// - "BEST_PRODUCT"
331+
// - "RETAIL_SUPPORT"
332+
// - "DISABLED"
333+
// clang-format off
334+
// clang-format on
335+
repeated string user_query_types = 10;
336+
337+
// The conversational answer-based text response generated by the Server.
338+
string conversational_text_response = 2;
339+
340+
// The conversational followup question generated for Intent refinement.
341+
FollowupQuestion followup_question = 3;
342+
272343
// Conversation UUID. This field will be stored in client side storage to
273344
// maintain the conversation session with server and will be used for next
274345
// search request's
@@ -284,4 +355,7 @@ message ConversationalSearchResponse {
284355
// This field specifies all related information that is needed on client
285356
// side for UI rendering of conversational filtering search.
286357
ConversationalFilteringResult conversational_filtering_result = 7;
358+
359+
// Output only. The state of the response generation.
360+
State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
287361
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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/field_behavior.proto";
20+
21+
option csharp_namespace = "Google.Cloud.Retail.V2Alpha";
22+
option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb";
23+
option java_multiple_files = true;
24+
option java_outer_classname = "SafetyProto";
25+
option java_package = "com.google.cloud.retail.v2alpha";
26+
option objc_class_prefix = "RETAIL";
27+
option php_namespace = "Google\\Cloud\\Retail\\V2alpha";
28+
option ruby_package = "Google::Cloud::Retail::V2alpha";
29+
30+
// Harm categories that will block the content.
31+
enum HarmCategory {
32+
// The harm category is unspecified.
33+
HARM_CATEGORY_UNSPECIFIED = 0;
34+
35+
// The harm category is hate speech.
36+
HARM_CATEGORY_HATE_SPEECH = 1;
37+
38+
// The harm category is dangerous content.
39+
HARM_CATEGORY_DANGEROUS_CONTENT = 2;
40+
41+
// The harm category is harassment.
42+
HARM_CATEGORY_HARASSMENT = 3;
43+
44+
// The harm category is sexually explicit content.
45+
HARM_CATEGORY_SEXUALLY_EXPLICIT = 4;
46+
47+
// The harm category is civic integrity.
48+
HARM_CATEGORY_CIVIC_INTEGRITY = 5;
49+
}
50+
51+
// Safety settings.
52+
message SafetySetting {
53+
// Probability based thresholds levels for blocking.
54+
enum HarmBlockThreshold {
55+
// Unspecified harm block threshold.
56+
HARM_BLOCK_THRESHOLD_UNSPECIFIED = 0;
57+
58+
// Block low threshold and above (i.e. block more).
59+
BLOCK_LOW_AND_ABOVE = 1;
60+
61+
// Block medium threshold and above.
62+
BLOCK_MEDIUM_AND_ABOVE = 2;
63+
64+
// Block only high threshold (i.e. block less).
65+
BLOCK_ONLY_HIGH = 3;
66+
67+
// Block none.
68+
BLOCK_NONE = 4;
69+
70+
// Turn off the safety filter.
71+
OFF = 5;
72+
}
73+
74+
// Probability vs severity.
75+
enum HarmBlockMethod {
76+
// The harm block method is unspecified.
77+
HARM_BLOCK_METHOD_UNSPECIFIED = 0;
78+
79+
// The harm block method uses both probability and severity scores.
80+
SEVERITY = 1;
81+
82+
// The harm block method uses the probability score.
83+
PROBABILITY = 2;
84+
}
85+
86+
// Harm category.
87+
HarmCategory category = 1;
88+
89+
// The harm block threshold.
90+
HarmBlockThreshold threshold = 2;
91+
92+
// Optional. Specify if the threshold is used for probability or severity
93+
// score. If not specified, the threshold is used for probability score.
94+
HarmBlockMethod method = 3 [(google.api.field_behavior) = OPTIONAL];
95+
}

0 commit comments

Comments
 (0)