Table of Contents

Class ComputeTokensResponse

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

Response for computing tokens.

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

Properties

SdkHttpResponse

Used to retain the full HTTP response.

[JsonPropertyName("sdkHttpResponse")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public HttpResponse? SdkHttpResponse { get; set; }

Property Value

HttpResponse

TokensInfo

Lists of tokens info from the input. A ComputeTokensRequest could have multiple instances with a prompt in each instance. We also need to return lists of tokens info for the request with multiple instances.

[JsonPropertyName("tokensInfo")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<TokensInfo>? TokensInfo { get; set; }

Property Value

List<TokensInfo>

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a ComputeTokensResponse object.

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

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

ComputeTokensResponse

The deserialized ComputeTokensResponse object, or null if deserialization fails.