Package com.google.genai.types
Class LogprobsResult
java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.LogprobsResult
The log probabilities of the tokens generated by the model. This is useful for understanding the
model's confidence in its predictions and for debugging. For example, you can use log
probabilities to identify when the model is making a less confident prediction or to explore
alternative responses that the model considered. A low log probability can also indicate that the
model is "hallucinating" or generating factually incorrect information.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class com.google.genai.JsonSerializable
MAX_READ_LENGTH_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LogprobsResult.Builderbuilder()Instantiates a builder for LogprobsResult.abstract Optional<List<LogprobsResultCandidate>>A list of the chosen candidate tokens at each decoding step.static LogprobsResultDeserializes a JSON string to a LogprobsResult object.abstract LogprobsResult.BuilderCreates a builder with the same values as this instance.abstract Optional<List<LogprobsResultTopCandidates>>A list of the top candidate tokens at each decoding step.Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString
-
Constructor Details
-
LogprobsResult
public LogprobsResult()
-
-
Method Details
-
chosenCandidates
A list of the chosen candidate tokens at each decoding step. The length of this list is equal to the total number of decoding steps. Note that the chosen candidate might not be in `top_candidates`. -
topCandidates
A list of the top candidate tokens at each decoding step. The length of this list is equal to the total number of decoding steps. -
builder
Instantiates a builder for LogprobsResult. -
toBuilder
Creates a builder with the same values as this instance. -
fromJson
Deserializes a JSON string to a LogprobsResult object.
-