# Discovery Engine V1 API - Class Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest (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::AnswerQueryRequest.

Request message for
[ConversationalSearchService.AnswerQuery](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-ConversationalSearchService-Client#Google__Cloud__DiscoveryEngine__V1__ConversationalSearchService__Client_answer_query_instance_ "Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client#answer_query (method)")
method.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #answer_generation_spec

    def answer_generation_spec() -> ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::AnswerGenerationSpec

**Returns**

- ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::AnswerGenerationSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-AnswerGenerationSpec)) --- Answer generation specification.

### #answer_generation_spec=

    def answer_generation_spec=(value) -> ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::AnswerGenerationSpec

**Parameter**

- **value** ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::AnswerGenerationSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-AnswerGenerationSpec)) --- Answer generation specification.
**Returns**

- ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::AnswerGenerationSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-AnswerGenerationSpec)) --- Answer generation specification.

### #asynchronous_mode

    def asynchronous_mode() -> ::Boolean

**Returns**

- (::Boolean) --- Deprecated: This field is deprecated. Streaming Answer API will be supported.

  Asynchronous mode control.

  If enabled, the response will be returned with answer/session resource
  name without final answer. The API users need to do the polling to get
  the latest status of answer/session by calling
  [ConversationalSearchService.GetAnswer](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-ConversationalSearchService-Client#Google__Cloud__DiscoveryEngine__V1__ConversationalSearchService__Client_get_answer_instance_ "Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client#get_answer (method)")
  or
  [ConversationalSearchService.GetSession](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-ConversationalSearchService-Client#Google__Cloud__DiscoveryEngine__V1__ConversationalSearchService__Client_get_session_instance_ "Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client#get_session (method)")
  method.

### #asynchronous_mode=

    def asynchronous_mode=(value) -> ::Boolean

**Parameter**

- **value** (::Boolean) --- Deprecated: This field is deprecated. Streaming Answer API will be supported.


  Asynchronous mode control.

  If enabled, the response will be returned with answer/session resource
  name without final answer. The API users need to do the polling to get
  the latest status of answer/session by calling
  [ConversationalSearchService.GetAnswer](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-ConversationalSearchService-Client#Google__Cloud__DiscoveryEngine__V1__ConversationalSearchService__Client_get_answer_instance_ "Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client#get_answer (method)")
  or
  [ConversationalSearchService.GetSession](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-ConversationalSearchService-Client#Google__Cloud__DiscoveryEngine__V1__ConversationalSearchService__Client_get_session_instance_ "Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client#get_session (method)")
  method.
**Returns**

- (::Boolean) --- Deprecated: This field is deprecated. Streaming Answer API will be supported.

  Asynchronous mode control.

  If enabled, the response will be returned with answer/session resource
  name without final answer. The API users need to do the polling to get
  the latest status of answer/session by calling
  [ConversationalSearchService.GetAnswer](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-ConversationalSearchService-Client#Google__Cloud__DiscoveryEngine__V1__ConversationalSearchService__Client_get_answer_instance_ "Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client#get_answer (method)")
  or
  [ConversationalSearchService.GetSession](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-ConversationalSearchService-Client#Google__Cloud__DiscoveryEngine__V1__ConversationalSearchService__Client_get_session_instance_ "Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client#get_session (method)")
  method.

### #end_user_spec

    def end_user_spec() -> ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::EndUserSpec

**Returns**

- ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::EndUserSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-EndUserSpec)) --- Optional. End user specification.

### #end_user_spec=

    def end_user_spec=(value) -> ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::EndUserSpec

**Parameter**

- **value** ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::EndUserSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-EndUserSpec)) --- Optional. End user specification.
**Returns**

- ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::EndUserSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-EndUserSpec)) --- Optional. End user specification.

### #grounding_spec

    def grounding_spec() -> ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::GroundingSpec

**Returns**

- ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::GroundingSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-GroundingSpec)) --- Optional. Grounding specification.

### #grounding_spec=

    def grounding_spec=(value) -> ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::GroundingSpec

**Parameter**

- **value** ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::GroundingSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-GroundingSpec)) --- Optional. Grounding specification.
**Returns**

- ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::GroundingSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-GroundingSpec)) --- Optional. Grounding specification.

### #query

    def query() -> ::Google::Cloud::DiscoveryEngine::V1::Query

**Returns**

- ([::Google::Cloud::DiscoveryEngine::V1::Query](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-Query)) --- Required. Current user query.

### #query=

    def query=(value) -> ::Google::Cloud::DiscoveryEngine::V1::Query

**Parameter**

- **value** ([::Google::Cloud::DiscoveryEngine::V1::Query](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-Query)) --- Required. Current user query.
**Returns**

- ([::Google::Cloud::DiscoveryEngine::V1::Query](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-Query)) --- Required. Current user query.

### #query_understanding_spec

    def query_understanding_spec() -> ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::QueryUnderstandingSpec

**Returns**

- ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::QueryUnderstandingSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-QueryUnderstandingSpec)) --- Query understanding specification.

### #query_understanding_spec=

    def query_understanding_spec=(value) -> ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::QueryUnderstandingSpec

**Parameter**

- **value** ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::QueryUnderstandingSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-QueryUnderstandingSpec)) --- Query understanding specification.
**Returns**

- ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::QueryUnderstandingSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-QueryUnderstandingSpec)) --- Query understanding specification.

### #related_questions_spec

    def related_questions_spec() -> ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::RelatedQuestionsSpec

**Returns**

- ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::RelatedQuestionsSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-RelatedQuestionsSpec)) --- Related questions specification.

### #related_questions_spec=

    def related_questions_spec=(value) -> ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::RelatedQuestionsSpec

**Parameter**

- **value** ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::RelatedQuestionsSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-RelatedQuestionsSpec)) --- Related questions specification.
**Returns**

- ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::RelatedQuestionsSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-RelatedQuestionsSpec)) --- Related questions specification.

### #safety_spec

    def safety_spec() -> ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::SafetySpec

**Returns**

- ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::SafetySpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-SafetySpec)) --- Model specification.

### #safety_spec=

    def safety_spec=(value) -> ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::SafetySpec

**Parameter**

- **value** ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::SafetySpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-SafetySpec)) --- Model specification.
**Returns**

- ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::SafetySpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-SafetySpec)) --- Model specification.

### #search_spec

    def search_spec() -> ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::SearchSpec

**Returns**

- ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::SearchSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-SearchSpec)) --- Search specification.

### #search_spec=

    def search_spec=(value) -> ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::SearchSpec

**Parameter**

- **value** ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::SearchSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-SearchSpec)) --- Search specification.
**Returns**

- ([::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::SearchSpec](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest/Google-Cloud-DiscoveryEngine-V1-AnswerQueryRequest-SearchSpec)) --- Search specification.

### #serving_config

    def serving_config() -> ::String

**Returns**

- (::String) --- Required. The resource name of the Search serving config, such as `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`, or `projects/*/locations/global/collections/default_collection/dataStores/*/servingConfigs/default_serving_config`. This field is used to identify the serving configuration name, set of models used to make the search.

### #serving_config=

    def serving_config=(value) -> ::String

**Parameter**

- **value** (::String) --- Required. The resource name of the Search serving config, such as `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`, or `projects/*/locations/global/collections/default_collection/dataStores/*/servingConfigs/default_serving_config`. This field is used to identify the serving configuration name, set of models used to make the search.
**Returns**

- (::String) --- Required. The resource name of the Search serving config, such as `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`, or `projects/*/locations/global/collections/default_collection/dataStores/*/servingConfigs/default_serving_config`. This field is used to identify the serving configuration name, set of models used to make the search.

### #session

    def session() -> ::String

**Returns**

- (::String) --- The session resource name. Not required.

  When session field is not set, the API is in sessionless mode.

  We support auto session mode: users can use the wildcard symbol `-` as
  session ID. A new ID will be automatically generated and assigned.

### #session=

    def session=(value) -> ::String

**Parameter**

- **value** (::String) --- The session resource name. Not required.


  When session field is not set, the API is in sessionless mode.

  We support auto session mode: users can use the wildcard symbol `-` as
  session ID. A new ID will be automatically generated and assigned.
**Returns**

- (::String) --- The session resource name. Not required.

  When session field is not set, the API is in sessionless mode.

  We support auto session mode: users can use the wildcard symbol `-` as
  session ID. A new ID will be automatically generated and assigned.

### #user_labels

    def user_labels() -> ::Google::Protobuf::Map{::String => ::String}

**Returns**

- (::Google::Protobuf::Map{::String =\> ::String}) --- 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](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
  for more details.

### #user_labels=

    def user_labels=(value) -> ::Google::Protobuf::Map{::String => ::String}

**Parameter**

- **value** (::Google::Protobuf::Map{::String =\> ::String}) --- 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](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
  for more details.
**Returns**

- (::Google::Protobuf::Map{::String =\> ::String}) --- 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](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
  for more details.

### #user_pseudo_id

    def user_pseudo_id() -> ::String

**Returns**

- (::String) --- 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 field should NOT have a fixed value such as `unknown_visitor`.

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

### #user_pseudo_id=

    def user_pseudo_id=(value) -> ::String

**Parameter**

- **value** (::String) --- 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 field should NOT have a fixed value such as `unknown_visitor`.

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

- (::String) --- 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 field should NOT have a fixed value such as `unknown_visitor`.

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