Class LogprobsResult
-
- All Implemented Interfaces:
public abstract class LogprobsResult extends JsonSerializable
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 Modifier and Type Class Description public abstract classLogprobsResult.BuilderBuilder for LogprobsResult.
-
Field Summary
Fields Modifier and Type Field Description public final static StringMAX_READ_LENGTH_PROPERTY
-
Constructor Summary
Constructors Constructor Description LogprobsResult()
-
Method Summary
Modifier and Type Method Description abstract Optional<List<LogprobsResultCandidate>>chosenCandidates()A list of the chosen candidate tokens at each decoding step. abstract Optional<List<LogprobsResultTopCandidates>>topCandidates()A list of the top candidate tokens at each decoding step. abstract Optional<Float>logProbabilitySum()Sum of log probabilities for all tokens. static LogprobsResult.Builderbuilder()Instantiates a builder for LogprobsResult. abstract LogprobsResult.BuildertoBuilder()Creates a builder with the same values as this instance. static LogprobsResultfromJson(String jsonString)Deserializes a JSON string to a LogprobsResult object. -
Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
chosenCandidates
abstract Optional<List<LogprobsResultCandidate>> 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
abstract Optional<List<LogprobsResultTopCandidates>> 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.
-
logProbabilitySum
abstract Optional<Float> logProbabilitySum()
Sum of log probabilities for all tokens. This field is not supported in Vertex AI.
-
builder
static LogprobsResult.Builder builder()
Instantiates a builder for LogprobsResult.
-
toBuilder
abstract LogprobsResult.Builder toBuilder()
Creates a builder with the same values as this instance.
-
fromJson
static LogprobsResult fromJson(String jsonString)
Deserializes a JSON string to a LogprobsResult object.
-
-
-
-