Method: projects.locations.collections.dataStores.servingConfigs.answer
Stay organized with collections
Save and categorize content based on your preferences.
HTTP request
POST https://discoveryengine.googleapis.com/v1/{servingConfig=projects/*/locations/*/collections/*/dataStores/*/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 )
},
"groundingSpec": {
object (GroundingSpec )
},
"answerGenerationSpec": {
object (AnswerGenerationSpec )
},
"searchSpec": {
object (SearchSpec )
},
"queryUnderstandingSpec": {
object (QueryUnderstandingSpec )
},
"asynchronousMode": boolean,
"userPseudoId": string,
"userLabels": {
string: string,
...
},
"endUserSpec": {
object (EndUserSpec )
}
} |
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.
|
groundingSpec |
object (GroundingSpec )
Optional. Grounding specification.
|
answerGenerationSpec |
object (AnswerGenerationSpec )
Answer generation specification.
|
searchSpec |
object (SearchSpec )
servingConfigs.search specification.
|
queryUnderstandingSpec |
object (QueryUnderstandingSpec )
Query understanding specification.
|
asynchronousMode (deprecated) |
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 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.
|
userLabels |
map (key: string, value: 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 for more details.
|
endUserSpec |
object (EndUserSpec )
Optional. End user specification.
|
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.
IAM Permissions
Requires the following IAM permission on the servingConfig
resource:
discoveryengine.servingConfigs.answer
For more information, see the IAM documentation.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-03-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-03 UTC."],[[["The `POST` request to `https://discoveryengine.googleapis.com/v1/{servingConfig=projects/*/locations/*/collections/*/dataStores/*/servingConfigs/*}:answer` utilizes gRPC Transcoding syntax to query the answer."],["The `servingConfig` path parameter is a required string that specifies the resource name of the serving configuration to be used, 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`."],["The request body, which is required, includes various fields like `query` (required), `session` (optional), `safetySpec`, `relatedQuestionsSpec`, and others, allowing for detailed customization of the answer generation process."],["To successfully use the API, the request must include the `discoveryengine.servingConfigs.answer` IAM permission and the `https://www.googleapis.com/auth/cloud-platform` OAuth scope."],["The `userPseudoId` field, which is contained within the request body, is a required string field that is a unique identifier for tracking visitors and must be a UTF-8 encoded string with a length limit of 128 characters."]]],[]]