Skip to content

Commit 4fea9f8

Browse files
feat: [google-cloud-retail] add language_code, region_code and place_id to SearchRequest (#13845)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: add language_code, region_code and place_id to SearchRequest feat: add pin_control_metadata to SearchResponse docs: keep the API doc up-to-date with recent changes feat: add conversational search API END_COMMIT_OVERRIDE PiperOrigin-RevId: 752323436 Source-Link: googleapis/googleapis@1ac7dc2 Source-Link: googleapis/googleapis-gen@117bcc0 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXJldGFpbC8uT3dsQm90LnlhbWwiLCJoIjoiMTE3YmNjMGQyZGE5YzEzZmQwN2U2MzA1MTE1YTY4NzliZmE5ODZmZCJ9 BEGIN_NESTED_COMMIT feat: [google-cloud-retail] add conversational search API PiperOrigin-RevId: 751643959 Source-Link: googleapis/googleapis@2eec62d Source-Link: googleapis/googleapis-gen@dc04c51 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXJldGFpbC8uT3dsQm90LnlhbWwiLCJoIjoiZGMwNGM1MWFlMTA4NTg3MmY0Njk0ODc2OGQzYzIxMTcyZjQ4YWYwMSJ9 END_NESTED_COMMIT BEGIN_NESTED_COMMIT feat: [google-cloud-retail] add language_code, region_code and place_id to SearchRequest feat: add pin_control_metadata to SearchResponse docs: keep the API doc up-to-date with recent changes PiperOrigin-RevId: 751590638 Source-Link: googleapis/googleapis@7b29e66 Source-Link: googleapis/googleapis-gen@a7be28d Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXJldGFpbC8uT3dsQm90LnlhbWwiLCJoIjoiYTdiZTI4ZGNhOWNiMGQwNmE0ZGM5MDA1NmRjM2NhYWI3MzRhODI3NyJ9 END_NESTED_COMMIT --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent d530650 commit 4fea9f8

File tree

62 files changed

+7964
-173
lines changed

Some content is hidden

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

62 files changed

+7964
-173
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ConversationalSearchService
2+
---------------------------------------------
3+
4+
.. automodule:: google.cloud.retail_v2alpha.services.conversational_search_service
5+
:members:
6+
:inherited-members:

packages/google-cloud-retail/docs/retail_v2alpha/services_.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Services for Google Cloud Retail v2alpha API
88
catalog_service
99
completion_service
1010
control_service
11+
conversational_search_service
1112
generative_question_service
1213
merchant_center_account_link_service
1314
model_service

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
Image,
107107
Interval,
108108
LocalInventory,
109+
PinControlMetadata,
109110
PriceInfo,
110111
Rating,
111112
RecommendationsFilteringOption,
@@ -302,6 +303,7 @@
302303
"Image",
303304
"Interval",
304305
"LocalInventory",
306+
"PinControlMetadata",
305307
"PriceInfo",
306308
"Rating",
307309
"Rule",

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.0.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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
Image,
8080
Interval,
8181
LocalInventory,
82+
PinControlMetadata,
8283
PriceInfo,
8384
Rating,
8485
RecommendationsFilteringOption,
@@ -320,6 +321,7 @@
320321
"OutputConfig",
321322
"OutputResult",
322323
"PauseModelRequest",
324+
"PinControlMetadata",
323325
"PredictRequest",
324326
"PredictResponse",
325327
"PredictionServiceClient",

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.0.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-retail/google/cloud/retail_v2/services/user_event_service/async_client.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,11 @@ async def collect_user_event(
408408
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
409409
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
410410
) -> httpbody_pb2.HttpBody:
411-
r"""Writes a single user event from the browser. This
412-
uses a GET request to due to browser restriction of
413-
POST-ing to a 3rd party domain.
411+
r"""Writes a single user event from the browser.
412+
413+
For larger user event payload over 16 KB, the POST
414+
method should be used instead, otherwise a 400 Bad
415+
Request error is returned.
414416
415417
This method is used only by the Retail API JavaScript
416418
pixel and Google Tag Manager. Users should not call this

packages/google-cloud-retail/google/cloud/retail_v2/services/user_event_service/client.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -854,9 +854,11 @@ def collect_user_event(
854854
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
855855
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
856856
) -> httpbody_pb2.HttpBody:
857-
r"""Writes a single user event from the browser. This
858-
uses a GET request to due to browser restriction of
859-
POST-ing to a 3rd party domain.
857+
r"""Writes a single user event from the browser.
858+
859+
For larger user event payload over 16 KB, the POST
860+
method should be used instead, otherwise a 400 Bad
861+
Request error is returned.
860862
861863
This method is used only by the Retail API JavaScript
862864
pixel and Google Tag Manager. Users should not call this

packages/google-cloud-retail/google/cloud/retail_v2/services/user_event_service/transports/grpc.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,11 @@ def collect_user_event(
377377
) -> Callable[[user_event_service.CollectUserEventRequest], httpbody_pb2.HttpBody]:
378378
r"""Return a callable for the collect user event method over gRPC.
379379
380-
Writes a single user event from the browser. This
381-
uses a GET request to due to browser restriction of
382-
POST-ing to a 3rd party domain.
380+
Writes a single user event from the browser.
381+
382+
For larger user event payload over 16 KB, the POST
383+
method should be used instead, otherwise a 400 Bad
384+
Request error is returned.
383385
384386
This method is used only by the Retail API JavaScript
385387
pixel and Google Tag Manager. Users should not call this

packages/google-cloud-retail/google/cloud/retail_v2/services/user_event_service/transports/grpc_asyncio.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,11 @@ def collect_user_event(
389389
]:
390390
r"""Return a callable for the collect user event method over gRPC.
391391
392-
Writes a single user event from the browser. This
393-
uses a GET request to due to browser restriction of
394-
POST-ing to a 3rd party domain.
392+
Writes a single user event from the browser.
393+
394+
For larger user event payload over 16 KB, the POST
395+
method should be used instead, otherwise a 400 Bad
396+
Request error is returned.
395397
396398
This method is used only by the Retail API JavaScript
397399
pixel and Google Tag Manager. Users should not call this

packages/google-cloud-retail/google/cloud/retail_v2/services/user_event_service/transports/rest_base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ def _get_http_options():
118118
"method": "get",
119119
"uri": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect",
120120
},
121+
{
122+
"method": "post",
123+
"uri": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect",
124+
"body": "*",
125+
},
121126
]
122127
return http_options
123128

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
Image,
4646
Interval,
4747
LocalInventory,
48+
PinControlMetadata,
4849
PriceInfo,
4950
Rating,
5051
RecommendationsFilteringOption,
@@ -208,6 +209,7 @@
208209
"Image",
209210
"Interval",
210211
"LocalInventory",
212+
"PinControlMetadata",
211213
"PriceInfo",
212214
"Rating",
213215
"Rule",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ class CatalogAttribute(proto.Message):
134134
135135
[CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
136136
can be pre-loaded by using
137-
[CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute],
138-
[CatalogService.ImportCatalogAttributes][], or
137+
[CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute]
138+
or
139139
[CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
140140
APIs. This field is ``False`` for pre-loaded
141141
[CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s.

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

Lines changed: 126 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"Rating",
4040
"UserInfo",
4141
"LocalInventory",
42+
"PinControlMetadata",
4243
},
4344
)
4445

@@ -56,7 +57,7 @@ class AttributeConfigLevel(proto.Enum):
5657
[Product.attributes][google.cloud.retail.v2.Product.attributes].
5758
CATALOG_LEVEL_ATTRIBUTE_CONFIG (2):
5859
At this level, we honor the attribute configurations set in
59-
[CatalogConfig.attribute_configs][].
60+
``CatalogConfig.attribute_configs``.
6061
"""
6162
ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0
6263
PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1
@@ -270,6 +271,11 @@ class Rule(proto.Message):
270271
Remove an attribute as a facet in the request
271272
(if present).
272273
274+
This field is a member of `oneof`_ ``action``.
275+
pin_action (google.cloud.retail_v2.types.Rule.PinAction):
276+
Pins one or more specified products to a
277+
specific position in the results.
278+
273279
This field is a member of `oneof`_ ``action``.
274280
condition (google.cloud.retail_v2.types.Condition):
275281
Required. The condition that triggers the
@@ -613,6 +619,59 @@ class RemoveFacetAction(proto.Message):
613619
number=1,
614620
)
615621

622+
class PinAction(proto.Message):
623+
r"""Pins one or more specified products to a specific position in the
624+
results.
625+
626+
- Rule Condition: Must specify non-empty
627+
[Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
628+
(for search only) or
629+
[Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
630+
(for browse only), but can't specify both.
631+
632+
- Action Input: mapping of ``[pin_position, product_id]`` pairs
633+
(pin position uses 1-based indexing).
634+
635+
- Action Result: Will pin products with matching ids to the
636+
position specified in the final result order.
637+
638+
Example: Suppose the query is ``shoes``, the
639+
[Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
640+
is ``shoes`` and the pin_map has ``{1, "pid1"}``, then product with
641+
``pid1`` will be pinned to the top position in the final results.
642+
643+
If multiple PinActions are matched to a single request the actions
644+
will be processed from most to least recently updated.
645+
646+
Pins to positions larger than the max allowed page size of 120 are
647+
not allowed.
648+
649+
Attributes:
650+
pin_map (MutableMapping[int, str]):
651+
Required. A map of positions to product_ids.
652+
653+
Partial matches per action are allowed, if a certain
654+
position in the map is already filled that
655+
``[position, product_id]`` pair will be ignored but the rest
656+
may still be applied. This case will only occur if multiple
657+
pin actions are matched to a single request, as the map
658+
guarantees that pin positions are unique within the same
659+
action.
660+
661+
Duplicate product_ids are not permitted within a single pin
662+
map.
663+
664+
The max size of this map is 120, equivalent to the max
665+
`request page
666+
size <https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body>`__.
667+
"""
668+
669+
pin_map: MutableMapping[int, str] = proto.MapField(
670+
proto.INT64,
671+
proto.STRING,
672+
number=1,
673+
)
674+
616675
boost_action: BoostAction = proto.Field(
617676
proto.MESSAGE,
618677
number=2,
@@ -673,6 +732,12 @@ class RemoveFacetAction(proto.Message):
673732
oneof="action",
674733
message=RemoveFacetAction,
675734
)
735+
pin_action: PinAction = proto.Field(
736+
proto.MESSAGE,
737+
number=14,
738+
oneof="action",
739+
message=PinAction,
740+
)
676741
condition: "Condition" = proto.Field(
677742
proto.MESSAGE,
678743
number=1,
@@ -746,6 +811,11 @@ class ColorInfo(proto.Message):
746811
`color <https://support.google.com/merchants/answer/6324487>`__.
747812
Schema.org property
748813
`Product.color <https://schema.org/color>`__.
814+
815+
The colorFamilies field as a system attribute is not a
816+
required field but strongly recommended to be specified.
817+
Google Search models treat this field as more important than
818+
a custom product attribute when specified.
749819
colors (MutableSequence[str]):
750820
The color display names, which may be different from
751821
standard color family names, such as the color aliases used
@@ -918,10 +988,11 @@ class FulfillmentInfo(proto.Message):
918988

919989
class Image(proto.Message):
920990
r"""[Product][google.cloud.retail.v2.Product] image. Recommendations AI
921-
and Retail Search do not use product images to improve prediction
922-
and search results. However, product images can be returned in
923-
results, and are shown in prediction or search previews in the
924-
console.
991+
and Retail Search use product images to improve prediction and
992+
search results. Product images can be returned in results, and are
993+
shown in prediction or search previews in the console. Please try to
994+
provide correct product images and avoid using images with size too
995+
small.
925996
926997
Attributes:
927998
uri (str):
@@ -1253,12 +1324,9 @@ class UserInfo(proto.Message):
12531324
[direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
12541325
is set.
12551326
user_agent (str):
1256-
User agent as included in the HTTP header. Required for
1257-
getting
1258-
[SearchResponse.sponsored_results][google.cloud.retail.v2.SearchResponse.sponsored_results].
1259-
1260-
The field must be a UTF-8 encoded string with a length limit
1261-
of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is
1327+
User agent as included in the HTTP header. The field must be
1328+
a UTF-8 encoded string with a length limit of 1,000
1329+
characters. Otherwise, an INVALID_ARGUMENT error is
12621330
returned.
12631331
12641332
This should not be set when using the client side event
@@ -1305,16 +1373,16 @@ class LocalInventory(proto.Message):
13051373
13061374
Attributes:
13071375
place_id (str):
1308-
The place ID for the current set of inventory
1309-
information.
1376+
Optional. The place ID for the current set of
1377+
inventory information.
13101378
price_info (google.cloud.retail_v2.types.PriceInfo):
1311-
Product price and cost information.
1379+
Optional. Product price and cost information.
13121380
13131381
Google Merchant Center property
13141382
`price <https://support.google.com/merchants/answer/6324371>`__.
13151383
attributes (MutableMapping[str, google.cloud.retail_v2.types.CustomAttribute]):
1316-
Additional local inventory attributes, for example, store
1317-
name, promotion tags, etc.
1384+
Optional. Additional local inventory attributes, for
1385+
example, store name, promotion tags, etc.
13181386
13191387
This field needs to pass all below criteria, otherwise an
13201388
INVALID_ARGUMENT error is returned:
@@ -1335,7 +1403,7 @@ class LocalInventory(proto.Message):
13351403
- The max summed total bytes of custom attribute keys and
13361404
values per product is 5MiB.
13371405
fulfillment_types (MutableSequence[str]):
1338-
Input only. Supported fulfillment types. Valid fulfillment
1406+
Optional. Supported fulfillment types. Valid fulfillment
13391407
type values include commonly used types (such as pickup in
13401408
store and same day delivery), and custom types. Customers
13411409
have to map custom types to their display names before
@@ -1381,4 +1449,45 @@ class LocalInventory(proto.Message):
13811449
)
13821450

13831451

1452+
class PinControlMetadata(proto.Message):
1453+
r"""Metadata for pinning to be returned in the response.
1454+
This is used for distinguishing between applied vs dropped pins.
1455+
1456+
Attributes:
1457+
all_matched_pins (MutableMapping[int, google.cloud.retail_v2.types.PinControlMetadata.ProductPins]):
1458+
Map of all matched pins, keyed by pin
1459+
position.
1460+
dropped_pins (MutableMapping[int, google.cloud.retail_v2.types.PinControlMetadata.ProductPins]):
1461+
Map of pins that were dropped due to overlap
1462+
with other matching pins, keyed by pin position.
1463+
"""
1464+
1465+
class ProductPins(proto.Message):
1466+
r"""List of product ids which have associated pins.
1467+
1468+
Attributes:
1469+
product_id (MutableSequence[str]):
1470+
List of product ids which have associated
1471+
pins.
1472+
"""
1473+
1474+
product_id: MutableSequence[str] = proto.RepeatedField(
1475+
proto.STRING,
1476+
number=1,
1477+
)
1478+
1479+
all_matched_pins: MutableMapping[int, ProductPins] = proto.MapField(
1480+
proto.INT64,
1481+
proto.MESSAGE,
1482+
number=1,
1483+
message=ProductPins,
1484+
)
1485+
dropped_pins: MutableMapping[int, ProductPins] = proto.MapField(
1486+
proto.INT64,
1487+
proto.MESSAGE,
1488+
number=2,
1489+
message=ProductPins,
1490+
)
1491+
1492+
13841493
__all__ = tuple(sorted(__protobuf__.manifest))

0 commit comments

Comments
 (0)