Skip to content

Commit

Permalink
feat: support case insensitive match on search facets
Browse files Browse the repository at this point in the history
feat: allow to return min/max values on search numeric facets
feat: allow to use serving configs as an alias of placements
docs: keep the API doc up-to-date with recent changes

PiperOrigin-RevId: 464560246
  • Loading branch information
Google APIs authored and copybara-github committed Aug 1, 2022
1 parent c52559c commit 139f56e
Show file tree
Hide file tree
Showing 7 changed files with 238 additions and 148 deletions.
10 changes: 4 additions & 6 deletions google/cloud/retail/v2/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,8 @@ message Interval {
// The lower bound of the interval. If neither of the min fields are set, then
// the lower bound is negative infinity.
//
// This field must be not larger than
// [max][google.cloud.retail.v2.Interval.max]. Otherwise, an INVALID_ARGUMENT
// error is returned.
// This field must not be larger than max.
// Otherwise, an INVALID_ARGUMENT error is returned.
oneof min {
// Inclusive lower bound.
double minimum = 1;
Expand All @@ -233,9 +232,8 @@ message Interval {
// The upper bound of the interval. If neither of the max fields are set, then
// the upper bound is positive infinity.
//
// This field must be not smaller than
// [min][google.cloud.retail.v2.Interval.min]. Otherwise, an INVALID_ARGUMENT
// error is returned.
// This field must be not smaller than min.
// Otherwise, an INVALID_ARGUMENT error is returned.
oneof max {
// Inclusive upper bound.
double maximum = 3;
Expand Down
10 changes: 7 additions & 3 deletions google/cloud/retail/v2/completion_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ message CompleteQueryRequest {
// characters. Otherwise, an INVALID_ARGUMENT error is returned.
string visitor_id = 7;

// Note that this field applies for `user-data` dataset only. For requests
// with `cloud-retail` dataset, setting this field has no effect.
//
// The language filters applied to the output suggestions. If set, it should
// contain the language of the query. If not set, suggestions are returned
// without considering language restrictions. This is the BCP-47 language
Expand Down Expand Up @@ -159,8 +162,9 @@ message CompleteQueryResponse {
// ingested through BigQuery.
//
// * For "cloud-retail", the attributes are product attributes generated
// by Cloud Retail. This is an experimental feature. Contact Retail Search
// support team if you are interested in enabling it.
// by Cloud Retail. It requires
// [UserEvent.product_details][google.cloud.retail.v2.UserEvent.product_details]
// is imported properly.
map<string, CustomAttribute> attributes = 2;
}

Expand Down Expand Up @@ -195,7 +199,7 @@ message CompleteQueryResponse {
// [CompleteQueryRequest.query][google.cloud.retail.v2.CompleteQueryRequest.query]
// case insensitively.
//
// * They are transformed to lower cases.
// * They are transformed to lower case.
//
// * They are UTF-8 safe.
//
Expand Down
46 changes: 33 additions & 13 deletions google/cloud/retail/v2/prediction_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package google.cloud.retail.v2;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/retail/v2/user_event.proto";
import "google/protobuf/struct.proto";

Expand All @@ -42,21 +43,30 @@ service PredictionService {
option (google.api.http) = {
post: "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict"
body: "*"
additional_bindings {
post: "/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict"
body: "*"
}
};
}
}

// Request message for Predict method.
message PredictRequest {
// Required. Full resource name of the format:
// {name=projects/*/locations/global/catalogs/default_catalog/placements/*}
// The ID of the Recommendations AI placement. Before you can request
// predictions from your model, you must create at least one placement for it.
// For more information, see [Managing
// placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements).
// `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}`
// or
// `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`.
// We recommend using the `servingConfigs` resource. `placements` is a legacy
// resource.
// The ID of the Recommendations AI serving config or placement.
// Before you can request predictions from your model, you must create at
// least one serving config or placement for it. For more information, see
// [Managing serving configurations]
// (https://cloud.google.com/retail/docs/manage-configs).
//
// The full list of available placements can be seen at
// https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements
// The full list of available serving configs can be seen at
// https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs
string placement = 1 [(google.api.field_behavior) = REQUIRED];

// Required. Context about the user, what they are looking at and what action
Expand All @@ -75,14 +85,14 @@ message PredictRequest {
// [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset.
UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED];

// Maximum number of results to return per page. Set this property
// to the number of prediction results needed. If zero, the service will
// choose a reasonable default. The maximum allowed value is 100. Values
// above 100 will be coerced to 100.
// Maximum number of results to return. Set this property to the number of
// prediction results needed. If zero, the service will choose a reasonable
// default. The maximum allowed value is 100. Values above 100 will be coerced
// to 100.
int32 page_size = 3;

// The previous PredictResponse.next_page_token.
string page_token = 4;
// This field is not used; leave it unset.
string page_token = 4 [deprecated = true];

// Filter for restricting prediction results with a length limit of 5,000
// characters. Accepts values for tags and the `filterOutOfStockItems` flag.
Expand Down Expand Up @@ -113,6 +123,14 @@ message PredictRequest {
// receive empty results instead.
// Note that the API will never return items with storageStatus of "EXPIRED"
// or "DELETED" regardless of filter choices.
//
// If `filterSyntaxV2` is set to true under the `params` field, then
// attribute-based expressions are expected instead of the above described
// tag-based syntax. Examples:
//
// * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones"))
// * (availability: ANY("IN_STOCK")) AND
// (colors: ANY("Red") OR categories: ANY("Phones"))
string filter = 5;

// Use validate only mode for this prediction query. If set to true, a
Expand Down Expand Up @@ -146,6 +164,8 @@ message PredictRequest {
// 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives
// request-level control and adjusts prediction results based on product
// category.
// * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter`
// field is interpreteted according to the new, attribute-based syntax.
map<string, google.protobuf.Value> params = 7;

// The labels applied to a resource must meet the following requirements:
Expand Down
Loading

0 comments on commit 139f56e

Please sign in to comment.