Reference documentation and code samples for the Retail V2 API class Google::Cloud::Retail::V2::ConversationalSearchService::Client.
Client for the ConversationalSearchService service.
Service for retail conversational search.
This feature is only available for users who have Retail Conversational Search enabled. Enable Retail Conversational Search on Cloud Console before using this feature.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the ConversationalSearchService Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all ConversationalSearchService clients ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the ConversationalSearchService Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#conversational_search
def conversational_search(request, options = nil) -> ::Enumerable<::Google::Cloud::Retail::V2::ConversationalSearchResponse>
def conversational_search(placement: nil, branch: nil, query: nil, page_categories: nil, conversation_id: nil, search_params: nil, visitor_id: nil, user_info: nil, conversational_filtering_spec: nil, user_labels: nil, safety_settings: nil) -> ::Enumerable<::Google::Cloud::Retail::V2::ConversationalSearchResponse>
Performs a conversational search.
This feature is only available for users who have Conversational Search enabled.
def conversational_search(request, options = nil) -> ::Enumerable<::Google::Cloud::Retail::V2::ConversationalSearchResponse>
conversational_search
via a request object, either of type
Google::Cloud::Retail::V2::ConversationalSearchRequest or an equivalent Hash.
- request (::Google::Cloud::Retail::V2::ConversationalSearchRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def conversational_search(placement: nil, branch: nil, query: nil, page_categories: nil, conversation_id: nil, search_params: nil, visitor_id: nil, user_info: nil, conversational_filtering_spec: nil, user_labels: nil, safety_settings: nil) -> ::Enumerable<::Google::Cloud::Retail::V2::ConversationalSearchResponse>
conversational_search
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
placement (::String) — Required. The resource name of the search engine placement, such as
projects/*/locations/global/catalogs/default_catalog/placements/default_search
orprojects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config
This field is used to identify the serving config name and the set of models that will be used to make the search. -
branch (::String) — Required. The branch resource name, such as
projects/*/locations/global/catalogs/default_catalog/branches/0
.Use "default_branch" as the branch ID or leave this field empty, to search products under the default branch.
-
query (::String) — Optional. Raw search query to be searched for.
If this field is empty, the request is considered a category browsing request.
-
page_categories (::Array<::String>) — Optional. The categories associated with a category page. Must be set for
category navigation queries to achieve good search quality. The format
should be the same as
UserEvent.page_categories;
To represent full path of category, use '>' sign to separate different hierarchies. If '>' is part of the category name, replace it with other character(s).
Category pages include special pages such as sales or promotions. For instance, a special sale page may have the category hierarchy: "pageCategories" : ["Sales > 2017 Black Friday Deals"].
- conversation_id (::String) — Optional. This field specifies the conversation id, which maintains the state of the conversation between client side and server side. Use the value from the previous ConversationalSearchResponse.conversation_id. For the initial request, this should be empty.
- search_params (::Google::Cloud::Retail::V2::ConversationalSearchRequest::SearchParams, ::Hash) — Optional. Search parameters.
-
visitor_id (::String) — Required. 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.
This should be the same identifier as UserEvent.visitor_id.
The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.
- user_info (::Google::Cloud::Retail::V2::UserInfo, ::Hash) — Optional. User information.
- conversational_filtering_spec (::Google::Cloud::Retail::V2::ConversationalSearchRequest::ConversationalFilteringSpec, ::Hash) — Optional. This field specifies all conversational filtering related parameters.
-
user_labels (::Hash{::String => ::String}) — Optional. The user labels applied to a resource must meet the following
requirements:
- Each resource can have multiple labels, up to a maximum of 64.
- Each label must be a key-value pair.
- Keys have a minimum length of 1 character and a maximum length of 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.
- Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
- The key portion of a label must be unique. However, you can use the same key with multiple resources.
- Keys must start with a lowercase letter or international character.
See Google Cloud Document for more details.
- safety_settings (::Array<::Google::Cloud::Retail::V2::SafetySetting, ::Hash>) — Optional. The safety settings to be applied to the generated content.
- (response, operation) — Access the result along with the RPC operation
- response (::Enumerable<::Google::Cloud::Retail::V2::ConversationalSearchResponse>)
- operation (::GRPC::ActiveCall::Operation)
- (::Enumerable<::Google::Cloud::Retail::V2::ConversationalSearchResponse>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/retail/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Retail::V2::ConversationalSearchService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Retail::V2::ConversationalSearchRequest.new # Call the conversational_search method to start streaming. output = client.conversational_search request # The returned object is a streamed enumerable yielding elements of type # ::Google::Cloud::Retail::V2::ConversationalSearchResponse output.each do |current_response| p current_response end
#initialize
def initialize() { |config| ... } -> Client
Create a new ConversationalSearchService client object.
- (config) — Configure the ConversationalSearchService client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config| config.timeout = 10.0 end
#location_client
def location_client() -> Google::Cloud::Location::Locations::Client
Get the associated client for mix-in of the Locations.
- (Google::Cloud::Location::Locations::Client)
#logger
def logger() -> Logger
The logger used for request/response debug logging.
- (Logger)
#universe_domain
def universe_domain() -> String
The effective universe domain
- (String)