Table of Contents

Class LogprobsResultCandidate

Namespace
Google.GenAI.Types
Assembly
Google.GenAI.dll

A single token and its associated log probability.

public record LogprobsResultCandidate : IEquatable<LogprobsResultCandidate>
Inheritance
LogprobsResultCandidate
Implements
Inherited Members

Properties

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.

[JsonPropertyName("logProbability")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? LogProbability { get; set; }

Property Value

double?

Token

The token's string representation.

[JsonPropertyName("token")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Token { get; set; }

Property Value

string

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.

[JsonPropertyName("tokenId")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? TokenId { get; set; }

Property Value

int?

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a LogprobsResultCandidate object.

public static LogprobsResultCandidate? FromJson(string jsonString, JsonSerializerOptions? options = null)

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

LogprobsResultCandidate

The deserialized LogprobsResultCandidate object, or null if deserialization fails.