Discovery Engine V1 API - Class Google::Cloud::DiscoveryEngine::V1::AssistantService::Client (v2.4.0)

Reference documentation and code samples for the Discovery Engine V1 API class Google::Cloud::DiscoveryEngine::V1::AssistantService::Client.

Client for the AssistantService service.

Service for managing Assistant configuration and assisting users.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the AssistantService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all AssistantService clients
::Google::Cloud::DiscoveryEngine::V1::AssistantService::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the AssistantService 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.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#initialize

def initialize() { |config| ... } -> Client

Create a new AssistantService client object.

Yields
  • (config) — Configure the AssistantService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::DiscoveryEngine::V1::AssistantService::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::DiscoveryEngine::V1::AssistantService::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.

Returns
  • (Google::Cloud::Location::Locations::Client)

#logger

def logger() -> Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#stream_assist

def stream_assist(request, options = nil) -> ::Enumerable<::Google::Cloud::DiscoveryEngine::V1::StreamAssistResponse>
def stream_assist(name: nil, query: nil, session: nil, user_metadata: nil, tools_spec: nil, generation_spec: nil) -> ::Enumerable<::Google::Cloud::DiscoveryEngine::V1::StreamAssistResponse>

Assists the user with a query in a streaming fashion.

Overloads
def stream_assist(request, options = nil) -> ::Enumerable<::Google::Cloud::DiscoveryEngine::V1::StreamAssistResponse>
Pass arguments to stream_assist via a request object, either of type StreamAssistRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DiscoveryEngine::V1::StreamAssistRequest, ::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 stream_assist(name: nil, query: nil, session: nil, user_metadata: nil, tools_spec: nil, generation_spec: nil) -> ::Enumerable<::Google::Cloud::DiscoveryEngine::V1::StreamAssistResponse>
Pass arguments to stream_assist 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).
Parameters
  • name (::String) — Required. The resource name of the Assistant. Format: projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}
  • query (::Google::Cloud::DiscoveryEngine::V1::Query, ::Hash) — Optional. Current user query.

    Empty query is only supported if file_ids are provided. In this case, the answer will be generated based on those context files.

  • session (::String) — Optional. The session to use for the request. If specified, the assistant has access to the session history, and the query and the answer are stored there.

    If - is specified as the session ID, or it is left empty, then a new session is created with an automatically generated ID.

    Format: projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}

  • user_metadata (::Google::Cloud::DiscoveryEngine::V1::AssistUserMetadata, ::Hash) — Optional. Information about the user initiating the query.
  • tools_spec (::Google::Cloud::DiscoveryEngine::V1::StreamAssistRequest::ToolsSpec, ::Hash) — Optional. Specification of tools that are used to serve the request.
  • generation_spec (::Google::Cloud::DiscoveryEngine::V1::StreamAssistRequest::GenerationSpec, ::Hash) — Optional. Specification of the generation configuration for the request.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/discovery_engine/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1::AssistantService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1::StreamAssistRequest.new

# Call the stream_assist method to start streaming.
output = client.stream_assist request

# The returned object is a streamed enumerable yielding elements of type
# ::Google::Cloud::DiscoveryEngine::V1::StreamAssistResponse
output.each do |current_response|
  p current_response
end

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)