Skip to content

Commit 82e7310

Browse files
feat: [retail] add a user_attributes field in SearchRequest that can be used for personalization (#6446)
* feat: add a user_attributes field in SearchRequest that can be used for personalization feat: add a model_scores field in SearchResponse.results to expose model quality signals PiperOrigin-RevId: 775377248 Source-Link: googleapis/googleapis@d2835e8 Source-Link: googleapis/googleapis-gen@e2be136 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXJldGFpbC8uT3dsQm90LnlhbWwiLCJoIjoiZTJiZTEzNjBhNGNhOGRkMTdkMWEyNGUzOWE0ZTk1YWJmZWY1MmI0NiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: miguel <[email protected]>
1 parent 152edb5 commit 82e7310

89 files changed

Lines changed: 93792 additions & 127157 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -59,39 +59,39 @@ service CatalogService {
5959
}
6060

6161
// Set a specified branch id as default branch. API methods such as
62-
// [SearchService.Search][google.cloud.retail.v2.SearchService.Search],
63-
// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct],
64-
// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
65-
// will treat requests using "default_branch" to the actual branch id set as
66-
// default.
62+
// [SearchService.Search][google.cloud.retail.v2.SearchService.Search],
63+
// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct],
64+
// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
65+
// will treat requests using "default_branch" to the actual branch id set as
66+
// default.
6767
//
68-
// For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as
69-
// default, setting
70-
// [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
71-
// `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent
72-
// to setting
73-
// [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
74-
// `projects/*/locations/*/catalogs/*/branches/1`.
68+
// For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as
69+
// default, setting
70+
// [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
71+
// `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent
72+
// to setting
73+
// [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
74+
// `projects/*/locations/*/catalogs/*/branches/1`.
7575
//
76-
// Using multiple branches can be useful when developers would like
77-
// to have a staging branch to test and verify for future usage. When it
78-
// becomes ready, developers switch on the staging branch using this API
79-
// while keeping using
80-
// `projects/*/locations/*/catalogs/*/branches/default_branch` as
81-
// [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
82-
// route the traffic to this staging branch.
76+
// Using multiple branches can be useful when developers would like
77+
// to have a staging branch to test and verify for future usage. When it
78+
// becomes ready, developers switch on the staging branch using this API
79+
// while keeping using
80+
// `projects/*/locations/*/catalogs/*/branches/default_branch` as
81+
// [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
82+
// route the traffic to this staging branch.
8383
//
84-
// CAUTION: If you have live predict/search traffic, switching the default
85-
// branch could potentially cause outages if the ID space of the new branch
86-
// is very different from the old one.
84+
// CAUTION: If you have live predict/search traffic, switching the default
85+
// branch could potentially cause outages if the ID space of the new branch
86+
// is very different from the old one.
8787
//
88-
// More specifically:
88+
// More specifically:
8989
//
90-
// * PredictionService will only return product IDs from branch {newBranch}.
91-
// * SearchService will only return product IDs from branch {newBranch}
92-
// (if branch is not explicitly set).
93-
// * UserEventService will only join events with products from branch
94-
// {newBranch}.
90+
// * PredictionService will only return product IDs from branch {newBranch}.
91+
// * SearchService will only return product IDs from branch {newBranch}
92+
// (if branch is not explicitly set).
93+
// * UserEventService will only join events with products from branch
94+
// {newBranch}.
9595
rpc SetDefaultBranch(SetDefaultBranchRequest)
9696
returns (google.protobuf.Empty) {
9797
option (google.api.http) = {
@@ -102,8 +102,8 @@ service CatalogService {
102102
}
103103

104104
// Get which branch is currently default branch set by
105-
// [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch]
106-
// method under a specified parent catalog.
105+
// [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch]
106+
// method under a specified parent catalog.
107107
rpc GetDefaultBranch(GetDefaultBranchRequest)
108108
returns (GetDefaultBranchResponse) {
109109
option (google.api.http) = {

packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,3 +932,15 @@ message PinControlMetadata {
932932
// keyed by pin position.
933933
map<int64, ProductPins> dropped_pins = 2;
934934
}
935+
936+
// A list of string values.
937+
message StringList {
938+
// String values.
939+
repeated string values = 1;
940+
}
941+
942+
// A message with a list of double values.
943+
message DoubleList {
944+
// The list of double values.
945+
repeated double values = 1;
946+
}

packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,8 @@ message SearchRequest {
429429
// [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
430430
Condition condition = 1;
431431

432-
// Whether to pin unexpanded results. If this field is set to true,
432+
// Whether to pin unexpanded results. The default value is false. If this
433+
// field is set to true,
433434
// unexpanded products are always at the top of the search results, followed
434435
// by the expanded results.
435436
bool pin_unexpanded_results = 2;
@@ -879,6 +880,29 @@ message SearchRequest {
879880
// [LocalInventory.place_id][google.cloud.retail.v2.LocalInventory.place_id]
880881
// for revenue optimization.
881882
string place_id = 46 [(google.api.field_behavior) = OPTIONAL];
883+
884+
// Optional. The user attributes that could be used for personalization of
885+
// search results.
886+
// * Populate at most 100 key-value pairs per query.
887+
// * Only supports string keys and repeated string values.
888+
// * Duplcate keys are not allowed within a single query.
889+
//
890+
// Example:
891+
// user_attributes: [
892+
// { key: "pets"
893+
// value {
894+
// values: "dog"
895+
// values: "cat"
896+
// }
897+
// },
898+
// { key: "state"
899+
// value {
900+
// values: "CA"
901+
// }
902+
// }
903+
// ]
904+
map<string, StringList> user_attributes = 47
905+
[(google.api.field_behavior) = OPTIONAL];
882906
}
883907

884908
// Response message for
@@ -971,6 +995,9 @@ message SearchResponse {
971995
//
972996
// * `purchased`: Indicates that this product has been purchased before.
973997
repeated string personal_labels = 7;
998+
999+
// Google provided available scores.
1000+
map<string, DoubleList> model_scores = 8;
9741001
}
9751002

9761003
// A facet result.

packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ message UserEvent {
7070
// 128 bytes. A session is an aggregation of an end user behavior in a time
7171
// span.
7272
//
73-
// A general guideline to populate the sesion_id:
73+
// A general guideline to populate the session_id:
7474
// 1. If user has no activity for 30 min, a new session_id should be assigned.
7575
// 2. The session_id should be unique across users, suggest use uuid or add
7676
// visitor_id as prefix.

packages/google-cloud-retail/protos/protos.d.ts

Lines changed: 206 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)