Table of Contents

Class GeminiCandidate

Google Gemini version of ChatChoice. A response candidate generated from the model.

2025-09-24: Updated new properties to match the latest Gemini API.

public class GeminiCandidate
Inheritance
object
GeminiCandidate

Properties

AvgLogprobs

Output only. Average log probability score of the candidate.

public float? AvgLogprobs { get; set; }

Property Value

float?

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.

public CitationMetadata CitationMetadata { get; set; }

Property Value

CitationMetadata

Content

Output only. Generated content returned from the model.

public GeminiContent Content { get; set; }

Property Value

GeminiContent

FinishReason

Optional. Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.

The official Gemini API's class name is "FinishReason", but we use our common enum StopReason here.

public StopReason? FinishReason { get; set; }

Property Value

StopReason?

GroundingAttributions

Output only. Token count for this candidate. This field is populated for GenerateAnswer calls.

public GroundingAttribution[] GroundingAttributions { get; set; }

Property Value

GroundingAttribution[]

GroundingMetadata

Output only. When a response is successfully grounded, the response includes a groundingMetadata field. This structured data is essential for verifying claims and building a rich citation experience in your application.

public GroundingMetadata GroundingMetadata { get; set; }

Property Value

GroundingMetadata

Index

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

public int? Index { get; set; }

Property Value

int?

LogprobsResult

Output only. Log-likelihood scores for the response tokens and top tokens

public LogprobsResult LogprobsResult { get; set; }

Property Value

LogprobsResult

SafetyRatings

List of ratings for the safety of a response candidate. There is at most one rating per category.

public SafetyRating[] SafetyRatings { get; set; }

Property Value

SafetyRating[]

TokenCount

Output only. Token count for this candidate.

public int TokenCount { get; set; }

Property Value

int

UrlContextMetadata

Output only. Metadata related to url context retrieval tool.

public UrlContextMetadata UrlContextMetadata { get; set; }

Property Value

UrlContextMetadata