Candidate

A response candidate generated from the model.

JSON representation
{
  "content": {
    object (Content)
  },
  "finishReason": enum (FinishReason),
  "safetyRatings": [
    {
      object (SafetyRating)
    }
  ],
  "citationMetadata": {
    object (CitationMetadata)
  },
  "tokenCount": integer,
  "groundingAttributions": [
    {
      object (GroundingAttribution)
    }
  ],
  "index": integer
}
Fields
content

object (Content)

Output only. Generated content returned from the model.

finishReason

enum (FinishReason)

Optional. Output only. The reason why the model stopped generating tokens.

If empty, the model has not stopped generating the tokens.

safetyRatings[]

object (SafetyRating)

List of ratings for the safety of a response candidate.

There is at most one rating per category.

citationMetadata

object (CitationMetadata)

Output only. Citation information for model-generated candidate.

This field may be populated with recitation information for any text included in the content. These are passages that are "recited" from copyrighted material in the foundational LLM's training data.

tokenCount

integer

Output only. Token count for this candidate.

groundingAttributions[]

object (GroundingAttribution)

Output only. Attribution information for sources that contributed to a grounded answer.

This field is populated for GenerateAnswer calls.

index

integer

Output only. Index of the candidate in the list of candidates.

FinishReason

Defines the reason why the model stopped generating tokens.

Enums
FINISH_REASON_UNSPECIFIED Default value. This value is unused.
STOP Natural stop point of the model or provided stop sequence.
MAX_TOKENS The maximum number of tokens as specified in the request was reached.
SAFETY The candidate content was flagged for safety reasons.
RECITATION The candidate content was flagged for recitation reasons.
OTHER Unknown reason.

GroundingAttribution

Attribution for a source that contributed to an answer.

JSON representation
{
  "sourceId": {
    object (AttributionSourceId)
  },
  "content": {
    object (Content)
  }
}
Fields
sourceId

object (AttributionSourceId)

Output only. Identifier for the source contributing to this attribution.

content

object (Content)

Grounding source content that makes up this attribution.

AttributionSourceId

Identifier for the source contributing to this attribution.

JSON representation
{

  // Union field source can be only one of the following:
  "groundingPassage": {
    object (GroundingPassageId)
  },
  "semanticRetrieverChunk": {
    object (SemanticRetrieverChunk)
  }
  // End of list of possible types for union field source.
}
Fields

Union field source.

source can be only one of the following:

groundingPassage

object (GroundingPassageId)

Identifier for an inline passage.

semanticRetrieverChunk

object (SemanticRetrieverChunk)

Identifier for a Chunk fetched via Semantic Retriever.

GroundingPassageId

Identifier for a part within a GroundingPassage.

JSON representation
{
  "passageId": string,
  "partIndex": integer
}
Fields
passageId

string

Output only. ID of the passage matching the GenerateAnswerRequest's GroundingPassage.id.

partIndex

integer

Output only. Index of the part within the GenerateAnswerRequest's GroundingPassage.content.

SemanticRetrieverChunk

Identifier for a Chunk retrieved via Semantic Retriever specified in the GenerateAnswerRequest using SemanticRetrieverConfig.

JSON representation
{
  "source": string,
  "chunk": string
}
Fields
source

string

Output only. Name of the source matching the request's SemanticRetrieverConfig.source. Example: corpora/123 or corpora/123/documents/abc

chunk

string

Output only. Name of the Chunk containing the attributed text. Example: corpora/123/documents/abc/chunks/xyz