Service Client: Google::Cloud::Retail::V2beta::CompletionService::CompletionServiceClient

Client stub representing the remote CompletionService gRPC service. Delegates call dispatching to Google::gRPC::Client.

target

The endpoint target address. Defaults to retail.googleapis.com:443.

credentials

The authentication credentials provider. Defaults to application default credentials via Google::Auth.

NAME

Google::Cloud::Retail::V2beta::CompletionService - Compiled Protocol Buffers messages for google/cloud/retail/v2beta/completion_service.proto

SYNOPSIS

use Google::Cloud::Retail::V2beta::CompletionService;

my $msg = Google::Cloud::Retail::V2beta::CompletionService::CompleteQueryRequest->new({
    catalog => $catalog,
    query => $query,
    visitor_id => $visitor_id,
    language_codes => $language_codes,
});

# Read or update a field
my $val = $msg->catalog();

# Binary wire-format roundtrip
my $bytes   = $msg->serialize();
my $decoded = Google::Cloud::Retail::V2beta::CompletionService::CompleteQueryRequest->parse($bytes);

# Canonical ProtoJSON
my $json = $msg->to_json();

DESCRIPTION

Auto-generated Protobuf message classes compiled from google/cloud/retail/v2beta/completion_service.proto. All message classes inherit from Protobuf::Message and support new(), serialize(), parse(), to_json(), from_json(), to_text(), and to_perl().

MESSAGES

Google::Cloud::Retail::V2beta::CompletionService::CompleteQueryRequest

Autocomplete parameters.

Inherits from Protobuf::Message.

Accessors

  • $msg->catalog() / $msg->catalog($value)

    Type: String

    Required. Catalog for which the completion is performed.

    Full resource name of catalog, such as `projects/*/locations/global/catalogs/default_catalog`.

  • $msg->query() / $msg->query($value)

    Type: String

    Required. The query used to generate suggestions.

    The maximum number of allowed characters is 255.

  • $msg->visitor_id() / $msg->visitor_id($value)

    Type: String

    Recommended field. A unique identifier for tracking visitors. For example, this could be implemented with an HTTP cookie, which should be able to uniquely identify a visitor on a single device. This unique identifier should not change if the visitor logs in or out of the website.

    The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

  • $msg->language_codes() / $msg->language_codes($value)

    Type: String

    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 code, such as "en-US" or "sr-Latn". For more information, see [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum number of language codes is 3.

  • $msg->device_type() / $msg->device_type($value)

    Type: String

    The device type context for completion suggestions. We recommend that you leave this field empty.

    It can apply different suggestions on different device types, e.g. `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device types.

    Supported formats:

    * `UNKNOWN_DEVICE_TYPE`

    * `DESKTOP`

    * `MOBILE`

    * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`.

  • $msg->dataset() / $msg->dataset($value)

    Type: String

    Determines which dataset to use for fetching completion. "user-data" will use the dataset imported through [CompletionService.ImportCompletionData][google.cloud.retail.v2beta.CompletionService.ImportCompletionData]. `cloud-retail` will use the dataset generated by Cloud Retail based on user events. If left empty, completions will be fetched from the `user-data` dataset.

    Current supported values:

    * user-data

    * cloud-retail: This option requires enabling auto-learning function first. See [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset).

  • $msg->max_suggestions() / $msg->max_suggestions($value)

    Type: Int32

    Completion max suggestions. If left unset or set to 0, then will fallback to the configured value [CompletionConfig.max_suggestions][google.cloud.retail.v2beta.CompletionConfig.max_suggestions].

    The maximum allowed max suggestions is 20. If it is set higher, it will be capped by 20.

  • $msg->enable_attribute_suggestions() / $msg->enable_attribute_suggestions($value)

    Type: Bool

    If true, attribute suggestions are enabled and provided in the response.

    This field is only available for the `cloud-retail` dataset.

  • $msg->entity() / $msg->entity($value)

    Type: String

    The entity for customers who run multiple entities, domains, sites, or regions, for example, `Google US`, `Google Ads`, `Waymo`, `google.com`, `youtube.com`, etc. If this is set, it must be an exact match with [UserEvent.entity][google.cloud.retail.v2beta.UserEvent.entity] to get per-entity autocomplete results. This field will be applied to `completion_results` only. It has no effect on the `attribute_results`. Also, this entity should be limited to 256 characters, if too long, it will be truncated to 256 characters in both generation and serving time, and may lead to mis-match. To ensure it works, please set the entity with string within 256 characters.

Google::Cloud::Retail::V2beta::CompletionService::CompleteQueryResponse

Response of the autocomplete query.

Inherits from Protobuf::Message.

Accessors

  • $msg->completion_results() / $msg->completion_results($value)

    Type: Message (Google::Cloud::Retail::V2beta::CompletionService::CompleteQueryResponse::CompletionResult)

    Results of the matching suggestions. The result list is ordered and the first result is top suggestion.

  • $msg->attribution_token() / $msg->attribution_token($value)

    Type: String

    A unique complete token. This should be included in the [UserEvent.completion_detail][google.cloud.retail.v2beta.UserEvent.completion_detail] for search events resulting from this completion, which enables accurate attribution of complete model performance.

  • $msg->recent_search_results() / $msg->recent_search_results($value)

    Type: Message (Google::Cloud::Retail::V2beta::CompletionService::CompleteQueryResponse::RecentSearchResult)

    Deprecated. Matched recent searches of this user. The maximum number of recent searches is 10. This field is a restricted feature. If you want to enable it, contact Retail Search support.

    This feature is only available when [CompleteQueryRequest.visitor_id][google.cloud.retail.v2beta.CompleteQueryRequest.visitor_id] field is set and [UserEvent][google.cloud.retail.v2beta.UserEvent] is imported. The recent searches satisfy the follow rules:

    * They are ordered from latest to oldest.
    
    * They are matched with
    [CompleteQueryRequest.query][google.cloud.retail.v2beta.CompleteQueryRequest.query]
    case insensitively.
    
    * They are transformed to lower case.
    
    * They are UTF-8 safe.

    Recent searches are deduplicated. More recent searches will be reserved when duplication happens.

  • $msg->attribute_results() / $msg->attribute_results($value)

    Type: Message (Google::Cloud::Retail::V2beta::CompletionService::CompleteQueryResponse::AttributeResultsEntry)

    A map of matched attribute suggestions. This field is only available for `cloud-retail` dataset.

    Current supported keys:

    * `brands`

    * `categories`

SEE ALSO

Protobuf, Protobuf::Message, Google::Cloud::Retail::V2beta::CompletionService::Types, https://protobuf.dev/

LICENSE AND COPYRIGHT

Copyright (C) 2026 Google LLC

This program is released under the Apache 2.0 license.