Class Candidate

  • All Implemented Interfaces:

    
    public abstract class Candidate
    extends JsonSerializable
                        

    A response candidate generated from the model.

    • Constructor Detail

      • Candidate

        Candidate()
    • Method Detail

      • finishReason

         abstract Optional<FinishReason> finishReason()

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

      • avgLogprobs

         abstract Optional<Double> avgLogprobs()

        Output only. The average log probability of the tokens in this candidate. This is a length-normalized score that can be used to compare the quality of candidates of different lengths. A higher average log probability suggests a more confident and coherent response.

      • index

         abstract Optional<Integer> index()

        Output only. The 0-based index of this candidate in the list of generated responses. This is useful for distinguishing between multiple candidates when `candidate_count` >1.

      • logprobsResult

         abstract Optional<LogprobsResult> logprobsResult()

        Output only. The detailed log probability information for the tokens in this candidate. This is useful for debugging, understanding model uncertainty, and identifying potential "hallucinations".