Skip to content

Commit cdfb4a3

Browse files
feat: [google-cloud-retail] add a user_attributes field in SearchRequest that can be used for personalization (#14037)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE 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 END_COMMIT_OVERRIDE 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 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent decb2ac commit cdfb4a3

File tree

14 files changed

+81
-13
lines changed

14 files changed

+81
-13
lines changed

packages/google-cloud-retail/google/cloud/retail/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
ColorInfo,
103103
Condition,
104104
CustomAttribute,
105+
DoubleList,
105106
FulfillmentInfo,
106107
Image,
107108
Interval,
@@ -113,6 +114,7 @@
113114
Rule,
114115
SearchSolutionUseCase,
115116
SolutionType,
117+
StringList,
116118
UserInfo,
117119
)
118120
from google.cloud.retail_v2.types.completion_service import (
@@ -299,6 +301,7 @@
299301
"ColorInfo",
300302
"Condition",
301303
"CustomAttribute",
304+
"DoubleList",
302305
"FulfillmentInfo",
303306
"Image",
304307
"Interval",
@@ -307,6 +310,7 @@
307310
"PriceInfo",
308311
"Rating",
309312
"Rule",
313+
"StringList",
310314
"UserInfo",
311315
"AttributeConfigLevel",
312316
"RecommendationsFilteringOption",

packages/google-cloud-retail/google/cloud/retail/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.2.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-retail/google/cloud/retail_v2/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
ColorInfo,
7676
Condition,
7777
CustomAttribute,
78+
DoubleList,
7879
FulfillmentInfo,
7980
Image,
8081
Interval,
@@ -86,6 +87,7 @@
8687
Rule,
8788
SearchSolutionUseCase,
8889
SolutionType,
90+
StringList,
8991
UserInfo,
9092
)
9193
from .types.completion_service import CompleteQueryRequest, CompleteQueryResponse
@@ -273,6 +275,7 @@
273275
"DeleteModelRequest",
274276
"DeleteProductRequest",
275277
"DeleteServingConfigRequest",
278+
"DoubleList",
276279
"ExperimentInfo",
277280
"ExportAnalyticsMetricsRequest",
278281
"ExportAnalyticsMetricsResponse",
@@ -369,6 +372,7 @@
369372
"SetInventoryRequest",
370373
"SetInventoryResponse",
371374
"SolutionType",
375+
"StringList",
372376
"Tile",
373377
"TuneModelMetadata",
374378
"TuneModelRequest",

packages/google-cloud-retail/google/cloud/retail_v2/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.2.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-retail/google/cloud/retail_v2/types/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
ColorInfo,
4242
Condition,
4343
CustomAttribute,
44+
DoubleList,
4445
FulfillmentInfo,
4546
Image,
4647
Interval,
@@ -52,6 +53,7 @@
5253
Rule,
5354
SearchSolutionUseCase,
5455
SolutionType,
56+
StringList,
5557
UserInfo,
5658
)
5759
from .completion_service import CompleteQueryRequest, CompleteQueryResponse
@@ -205,6 +207,7 @@
205207
"ColorInfo",
206208
"Condition",
207209
"CustomAttribute",
210+
"DoubleList",
208211
"FulfillmentInfo",
209212
"Image",
210213
"Interval",
@@ -213,6 +216,7 @@
213216
"PriceInfo",
214217
"Rating",
215218
"Rule",
219+
"StringList",
216220
"UserInfo",
217221
"AttributeConfigLevel",
218222
"RecommendationsFilteringOption",

packages/google-cloud-retail/google/cloud/retail_v2/types/common.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
"UserInfo",
4141
"LocalInventory",
4242
"PinControlMetadata",
43+
"StringList",
44+
"DoubleList",
4345
},
4446
)
4547

@@ -1490,4 +1492,32 @@ class ProductPins(proto.Message):
14901492
)
14911493

14921494

1495+
class StringList(proto.Message):
1496+
r"""A list of string values.
1497+
1498+
Attributes:
1499+
values (MutableSequence[str]):
1500+
String values.
1501+
"""
1502+
1503+
values: MutableSequence[str] = proto.RepeatedField(
1504+
proto.STRING,
1505+
number=1,
1506+
)
1507+
1508+
1509+
class DoubleList(proto.Message):
1510+
r"""A message with a list of double values.
1511+
1512+
Attributes:
1513+
values (MutableSequence[float]):
1514+
The list of double values.
1515+
"""
1516+
1517+
values: MutableSequence[float] = proto.RepeatedField(
1518+
proto.DOUBLE,
1519+
number=1,
1520+
)
1521+
1522+
14931523
__all__ = tuple(sorted(__protobuf__.manifest))

packages/google-cloud-retail/google/cloud/retail_v2/types/search_service.py

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,17 @@ class SearchRequest(proto.Message):
440440
local inventory with the matching product's
441441
[LocalInventory.place_id][google.cloud.retail.v2.LocalInventory.place_id]
442442
for revenue optimization.
443+
user_attributes (MutableMapping[str, google.cloud.retail_v2.types.StringList]):
444+
Optional. The user attributes that could be used for
445+
personalization of search results.
446+
447+
- Populate at most 100 key-value pairs per query.
448+
- Only supports string keys and repeated string values.
449+
- Duplcate keys are not allowed within a single query.
450+
451+
Example: user_attributes: [ { key: "pets" value { values:
452+
"dog" values: "cat" } }, { key: "state" value { values: "CA"
453+
} } ]
443454
"""
444455

445456
class SearchMode(proto.Enum):
@@ -912,10 +923,11 @@ class QueryExpansionSpec(proto.Message):
912923
Default to
913924
[Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
914925
pin_unexpanded_results (bool):
915-
Whether to pin unexpanded results. If this
916-
field is set to true, unexpanded products are
917-
always at the top of the search results,
918-
followed by the expanded results.
926+
Whether to pin unexpanded results. The
927+
default value is false. If this field is set to
928+
true, unexpanded products are always at the top
929+
of the search results, followed by the expanded
930+
results.
919931
"""
920932

921933
class Condition(proto.Enum):
@@ -1276,6 +1288,12 @@ class TileNavigationSpec(proto.Message):
12761288
proto.STRING,
12771289
number=46,
12781290
)
1291+
user_attributes: MutableMapping[str, common.StringList] = proto.MapField(
1292+
proto.STRING,
1293+
proto.MESSAGE,
1294+
number=47,
1295+
message=common.StringList,
1296+
)
12791297

12801298

12811299
class SearchResponse(proto.Message):
@@ -1447,6 +1465,8 @@ class SearchResult(proto.Message):
14471465
14481466
- ``purchased``: Indicates that this product has been
14491467
purchased before.
1468+
model_scores (MutableMapping[str, google.cloud.retail_v2.types.DoubleList]):
1469+
Google provided available scores.
14501470
"""
14511471

14521472
id: str = proto.Field(
@@ -1480,6 +1500,12 @@ class SearchResult(proto.Message):
14801500
proto.STRING,
14811501
number=7,
14821502
)
1503+
model_scores: MutableMapping[str, common.DoubleList] = proto.MapField(
1504+
proto.STRING,
1505+
proto.MESSAGE,
1506+
number=8,
1507+
message=common.DoubleList,
1508+
)
14831509

14841510
class Facet(proto.Message):
14851511
r"""A facet result.

packages/google-cloud-retail/google/cloud/retail_v2/types/user_event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class UserEvent(proto.Message):
7878
length limit of 128 bytes. A session is an aggregation of an
7979
end user behavior in a time span.
8080
81-
A general guideline to populate the sesion_id:
81+
A general guideline to populate the session_id:
8282
8383
1. If user has no activity for 30 min, a new session_id
8484
should be assigned.

packages/google-cloud-retail/google/cloud/retail_v2alpha/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.2.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-retail/google/cloud/retail_v2beta/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.2.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

0 commit comments

Comments
 (0)