- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- IAM Permissions
- CheckGroundingSpec
- CheckGroundingFactChunk
- Claim
Performs a grounding check.
HTTP request
POST https://discoveryengine.googleapis.com/v1beta/{groundingConfig=projects/*/locations/*/groundingConfigs/*}:check
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
grounding |
Required. The resource name of the grounding config, such as |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{ "answerCandidate": string, "facts": [ { object ( |
Fields | |
---|---|
answer |
Answer candidate to check. It can have a maximum length of 4096 tokens. |
facts[] |
List of facts for the grounding check. We support up to 200 facts. |
grounding |
Configuration of the grounding check. |
user |
The user labels applied to a resource must meet the following requirements:
See Google Cloud Document for more details. |
Response body
Response message for the GroundedGenerationService.CheckGrounding
method.
If successful, the response body contains data with the following structure:
JSON representation |
---|
{ "citedChunks": [ { object ( |
Fields | |
---|---|
cited |
List of facts cited across all claims in the answer candidate. These are derived from the facts supplied in the request. |
cited |
List of facts cited across all claims in the answer candidate. These are derived from the facts supplied in the request. |
claims[] |
Claim texts and citation info across all claims in the answer candidate. |
support |
The support score for the input answer candidate. Higher the score, higher is the fraction of claims that are supported by the provided facts. This is always set when a response is returned. |
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 groundingConfig
resource:
discoveryengine.groundingConfigs.check
For more information, see the IAM documentation.
CheckGroundingSpec
Specification for the grounding check.
JSON representation |
---|
{ "citationThreshold": number } |
Fields | |
---|---|
citation |
The threshold (in [0,1]) used for determining whether a fact must be cited for a claim in the answer candidate. Choosing a higher threshold will lead to fewer but very strong citations, while choosing a lower threshold may lead to more but somewhat weaker citations. If unset, the threshold will default to 0.6. |
CheckGroundingFactChunk
Fact chunk for grounding check.
JSON representation |
---|
{ "chunkText": string } |
Fields | |
---|---|
chunk |
Text content of the fact chunk. Can be at most 10K characters long. |
Claim
Text and citation info for a claim in the answer candidate.
JSON representation |
---|
{ "claimText": string, "citationIndices": [ integer ], "startPos": integer, "endPos": integer, "groundingCheckRequired": boolean } |
Fields | |
---|---|
claim |
Text for the claim in the answer candidate. Always provided regardless of whether citations or anti-citations are found. |
citation |
A list of indices (into 'citedChunks') specifying the citations associated with the claim. For instance [1,3,4] means that citedChunks[1], citedChunks[3], citedChunks[4] are the facts cited supporting for the claim. A citation to a fact indicates that the claim is supported by the fact. |
start |
Position indicating the start of the claim in the answer candidate, measured in bytes. Note that this is not measured in characters and, therefore, must be rendered in the user interface keeping in mind that some characters may take more than one byte. For example, if the claim text contains non-ASCII characters, the start and end positions vary when measured in characters (programming-language-dependent) and when measured in bytes (programming-language-independent). |
end |
Position indicating the end of the claim in the answer candidate, exclusive, in bytes. Note that this is not measured in characters and, therefore, must be rendered as such. For example, if the claim text contains non-ASCII characters, the start and end positions vary when measured in characters (programming-language-dependent) and when measured in bytes (programming-language-independent). |
grounding |
Indicates that this claim required grounding check. When the system decided this claim doesn't require attribution/grounding check, this field will be set to false. In that case, no grounding check was done for the claim and therefore |