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

2.8.0 (latest) 2.7.0 2.6.2 2.5.0 2.4.0 2.3.1 2.2.0 2.1.1 2.0.0 1.5.0 1.4.0 1.3.0 1.2.0 1.1.0 1.0.2 0.9.0 0.8.0 0.7.0 0.6.0 0.5.0 0.4.2 0.3.0 0.2.0 0.1.0 Reference documentation and code samples for the Discovery Engine V1 API class Google::Cloud::DiscoveryEngine::V1::AssistantService::Client.

Client for the AssistantService service.


<br />

Service for managing Assistant configuration and assisting users.

## Inherits

- Object

## Includes

- [Google::Cloud::DiscoveryEngine::V1::AssistantService::Paths](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AssistantService-Paths)

## Methods

### .configure

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

Configure the AssistantService Client class.


<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AssistantService-Client-Configuration "Google::Cloud::DiscoveryEngine::V1::AssistantService::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AssistantService-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AssistantService-Client-Configuration))
**Example**

```ruby
# 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AssistantService-Client#Google__Cloud__DiscoveryEngine__V1__AssistantService__Client_configure_class_ "Google::Cloud::DiscoveryEngine::V1::AssistantService::Client.configure (method)").

<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AssistantService-Client-Configuration "Google::Cloud::DiscoveryEngine::V1::AssistantService::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AssistantService-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AssistantService-Client-Configuration))

### #initialize

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

Create a new AssistantService client object.
**Yields**

- (config) --- Configure the AssistantService client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AssistantService-Client-Configuration))
**Returns**

- ([Client](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AssistantService-Client)) --- a new instance of Client
**Example**

```ruby
# 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-StreamAssistRequest "Google::Cloud::DiscoveryEngine::V1::StreamAssistRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::DiscoveryEngine::V1::StreamAssistRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-Assistant "Google::Cloud::DiscoveryEngine::V1::Assistant (class)"). Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}`
- **query** ([::Google::Cloud::DiscoveryEngine::V1::Query](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AssistUserMetadata), ::Hash) --- Optional. Information about the user initiating the query.
- **tools_spec** ([::Google::Cloud::DiscoveryEngine::V1::StreamAssistRequest::ToolsSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/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**

- **response** (::Enumerable\<[::Google::Cloud::DiscoveryEngine::V1::StreamAssistResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-StreamAssistResponse)\>)
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- (::Enumerable\<[::Google::Cloud::DiscoveryEngine::V1::StreamAssistResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-StreamAssistResponse)\>)
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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)