feat: add new fields in conversational search public SDK

PiperOrigin-RevId: 787249742
This commit is contained in:
Google APIs 2025-07-25 14:53:31 -07:00 committed by Copybara-Service
parent e3d58220ef
commit a083dfbc3f
3 changed files with 170 additions and 0 deletions

View file

@ -49,6 +49,7 @@ proto_library(
"project_service.proto",
"promotion.proto",
"purge_config.proto",
"safety.proto",
"search_service.proto",
"serving_config.proto",
"serving_config_service.proto",

View file

@ -21,6 +21,7 @@ import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/retail/v2alpha/common.proto";
import "google/cloud/retail/v2alpha/safety.proto";
import "google/cloud/retail/v2alpha/search_service.proto";
option csharp_namespace = "Google.Cloud.Retail.V2Alpha";
@ -126,6 +127,12 @@ message ConversationalSearchRequest {
// Default value.
MODE_UNSPECIFIED = 0;
// Disable Conversational Filtering.
DISABLED = 1;
// Enabled Conversational Filtering with default Conversational Search.
ENABLED = 2;
// Enabled Conversational Filtering without default Conversational Search.
CONVERSATIONAL_FILTER_ONLY = 3;
}
@ -216,6 +223,30 @@ message ConversationalSearchRequest {
// parameters.
ConversationalFilteringSpec conversational_filtering_spec = 8
[(google.api.field_behavior) = OPTIONAL];
// Optional. The user labels applied to a resource must meet the following
// requirements:
//
// * Each resource can have multiple labels, up to a maximum of 64.
// * Each label must be a key-value pair.
// * Keys have a minimum length of 1 character and a maximum length of 63
// characters and cannot be empty. Values can be empty and have a maximum
// length of 63 characters.
// * Keys and values can contain only lowercase letters, numeric characters,
// underscores, and dashes. All characters must use UTF-8 encoding, and
// international characters are allowed.
// * The key portion of a label must be unique. However, you can use the same
// key with multiple resources.
// * Keys must start with a lowercase letter or international character.
//
// See [Google Cloud
// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
// for more details.
map<string, string> user_labels = 12 [(google.api.field_behavior) = OPTIONAL];
// Optional. The safety settings to be applied to the generated content.
repeated SafetySetting safety_settings = 14
[(google.api.field_behavior) = OPTIONAL];
}
// Response message for
@ -269,6 +300,46 @@ message ConversationalSearchResponse {
AdditionalFilter additional_filter = 2;
}
// The state of the response generation.
enum State {
// Unknown.
STATE_UNSPECIFIED = 0;
// Response generation is being streamed.
STREAMING = 1;
// Response generation has succeeded.
SUCCEEDED = 2;
}
// The types Retail classifies the search query as.
//
// Supported values are:
//
// - "ADVERSARIAL"
// - "CHITCHAT"
// - "JAILBREAK"
// - "ORDER_SUPPORT"
// - "SIMPLE_PRODUCT_SEARCH"
// - "INTENT_REFINEMENT"
// - "PRODUCT_DETAILS"
// - "PRODUCT_COMPARISON"
// - "DEALS_AND_COUPONS"
// - "STORE_RELEVANT"
// - "BLOCKLISTED"
// - "BEST_PRODUCT"
// - "RETAIL_SUPPORT"
// - "DISABLED"
// clang-format off
// clang-format on
repeated string user_query_types = 10;
// The conversational answer-based text response generated by the Server.
string conversational_text_response = 2;
// The conversational followup question generated for Intent refinement.
FollowupQuestion followup_question = 3;
// Conversation UUID. This field will be stored in client side storage to
// maintain the conversation session with server and will be used for next
// search request's
@ -284,4 +355,7 @@ message ConversationalSearchResponse {
// This field specifies all related information that is needed on client
// side for UI rendering of conversational filtering search.
ConversationalFilteringResult conversational_filtering_result = 7;
// Output only. The state of the response generation.
State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
}

View file

@ -0,0 +1,95 @@
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.cloud.retail.v2alpha;
import "google/api/field_behavior.proto";
option csharp_namespace = "Google.Cloud.Retail.V2Alpha";
option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb";
option java_multiple_files = true;
option java_outer_classname = "SafetyProto";
option java_package = "com.google.cloud.retail.v2alpha";
option objc_class_prefix = "RETAIL";
option php_namespace = "Google\\Cloud\\Retail\\V2alpha";
option ruby_package = "Google::Cloud::Retail::V2alpha";
// Harm categories that will block the content.
enum HarmCategory {
// The harm category is unspecified.
HARM_CATEGORY_UNSPECIFIED = 0;
// The harm category is hate speech.
HARM_CATEGORY_HATE_SPEECH = 1;
// The harm category is dangerous content.
HARM_CATEGORY_DANGEROUS_CONTENT = 2;
// The harm category is harassment.
HARM_CATEGORY_HARASSMENT = 3;
// The harm category is sexually explicit content.
HARM_CATEGORY_SEXUALLY_EXPLICIT = 4;
// The harm category is civic integrity.
HARM_CATEGORY_CIVIC_INTEGRITY = 5;
}
// Safety settings.
message SafetySetting {
// Probability based thresholds levels for blocking.
enum HarmBlockThreshold {
// Unspecified harm block threshold.
HARM_BLOCK_THRESHOLD_UNSPECIFIED = 0;
// Block low threshold and above (i.e. block more).
BLOCK_LOW_AND_ABOVE = 1;
// Block medium threshold and above.
BLOCK_MEDIUM_AND_ABOVE = 2;
// Block only high threshold (i.e. block less).
BLOCK_ONLY_HIGH = 3;
// Block none.
BLOCK_NONE = 4;
// Turn off the safety filter.
OFF = 5;
}
// Probability vs severity.
enum HarmBlockMethod {
// The harm block method is unspecified.
HARM_BLOCK_METHOD_UNSPECIFIED = 0;
// The harm block method uses both probability and severity scores.
SEVERITY = 1;
// The harm block method uses the probability score.
PROBABILITY = 2;
}
// Harm category.
HarmCategory category = 1;
// The harm block threshold.
HarmBlockThreshold threshold = 2;
// Optional. Specify if the threshold is used for probability or severity
// score. If not specified, the threshold is used for probability score.
HarmBlockMethod method = 3 [(google.api.field_behavior) = OPTIONAL];
}