Method: projects.locations.collections.engines.servingConfigs.answer

Answer query method.

HTTP request

POST https://discoveryengine.googleapis.com/v1beta/{servingConfig=projects/*/locations/*/collections/*/engines/*/servingConfigs/*}:answer

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
servingConfig

string

Required. The resource name of the servingConfigs.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.

Request body

The request body contains data with the following structure:

JSON representation
{
  "query": {
    object (Query)
  },
  "session": string,
  "safetySpec": {
    object (SafetySpec)
  },
  "relatedQuestionsSpec": {
    object (RelatedQuestionsSpec)
  },
  "answerGenerationSpec": {
    object (AnswerGenerationSpec)
  },
  "searchSpec": {
    object (SearchSpec)
  },
  "queryUnderstandingSpec": {
    object (QueryUnderstandingSpec)
  },
  "asynchronousMode": boolean,
  "userPseudoId": string
}
Fields
query

object (Query)

Required. Current user query.

session

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.

safetySpec

object (SafetySpec)

Model specification.

relatedQuestionsSpec

object (RelatedQuestionsSpec)

Related questions specification.

answerGenerationSpec

object (AnswerGenerationSpec)

Answer generation specification.

searchSpec

object (SearchSpec)

servingConfigs.search specification.

queryUnderstandingSpec

object (QueryUnderstandingSpec)

Query understanding specification.

asynchronousMode

boolean

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 or ConversationalSearchService.GetSession method.

userPseudoId

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.

Response body

If successful, the response body contains an instance of AnswerQueryResponse.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.