Class LogprobsResultCandidate
-
- All Implemented Interfaces:
public abstract class LogprobsResultCandidate extends JsonSerializable
A single token and its associated log probability.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public abstract classLogprobsResultCandidate.BuilderBuilder for LogprobsResultCandidate.
-
Field Summary
Fields Modifier and Type Field Description public final static StringMAX_READ_LENGTH_PROPERTY
-
Constructor Summary
Constructors Constructor Description LogprobsResultCandidate()
-
Method Summary
Modifier and Type Method Description abstract Optional<Float>logProbability()The log probability of this token. abstract Optional<String>token()The token's string representation. abstract Optional<Integer>tokenId()The token's numerical ID. static LogprobsResultCandidate.Builderbuilder()Instantiates a builder for LogprobsResultCandidate. abstract LogprobsResultCandidate.BuildertoBuilder()Creates a builder with the same values as this instance. static LogprobsResultCandidatefromJson(String jsonString)Deserializes a JSON string to a LogprobsResultCandidate 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
-
logProbability
abstract Optional<Float> logProbability()
The log probability of this token. A higher value indicates that the model was more confident in this token. The log probability can be used to assess the relative likelihood of different tokens and to identify when the model is uncertain.
-
tokenId
abstract Optional<Integer> tokenId()
The token's numerical ID. While the `token` field provides the string representation of the token, the `token_id` is the numerical representation that the model uses internally. This can be useful for developers who want to build custom logic based on the model's vocabulary.
-
builder
static LogprobsResultCandidate.Builder builder()
Instantiates a builder for LogprobsResultCandidate.
-
toBuilder
abstract LogprobsResultCandidate.Builder toBuilder()
Creates a builder with the same values as this instance.
-
fromJson
static LogprobsResultCandidate fromJson(String jsonString)
Deserializes a JSON string to a LogprobsResultCandidate object.
-
-
-
-