generative-ai-python

google.generativeai.protos.Candidate

A response candidate generated from the model.

`index` `int` Output only. Index of the candidate in the list of response candidates.
`content` `google.ai.generativelanguage.Content` Output only. Generated content returned from the model.
`finish_reason` `google.ai.generativelanguage.Candidate.FinishReason` Optional. Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating tokens.
`safety_ratings` `MutableSequence[google.ai.generativelanguage.SafetyRating]` List of ratings for the safety of a response candidate. There is at most one rating per category.
`citation_metadata` `google.ai.generativelanguage.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.
`token_count` `int` Output only. Token count for this candidate.
`grounding_attributions` `MutableSequence[google.ai.generativelanguage.GroundingAttribution]` Output only. Attribution information for sources that contributed to a grounded answer. This field is populated for ``GenerateAnswer`` calls.
`grounding_metadata` `google.ai.generativelanguage.GroundingMetadata` Output only. Grounding metadata for the candidate. This field is populated for ``GenerateContent`` calls.
`avg_logprobs` `float` Output only.
`logprobs_result` `google.ai.generativelanguage.LogprobsResult` Output only. Log-likelihood scores for the response tokens and top tokens

Child Classes

class FinishReason