Table of Contents

Class CachedContentUsageMetadata

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

Metadata on the usage of the cached content.

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

Properties

AudioDurationSeconds

Duration of audio in seconds. This field is not supported in Gemini API.

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

Property Value

int?

ImageCount

Number of images. This field is not supported in Gemini API.

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

Property Value

int?

TextCount

Number of text characters. This field is not supported in Gemini API.

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

Property Value

int?

TotalTokenCount

Total number of tokens that the cached content consumes.

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

Property Value

int?

VideoDurationSeconds

Duration of video in seconds. This field is not supported in Gemini API.

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

Property Value

int?

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a CachedContentUsageMetadata object.

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

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

CachedContentUsageMetadata

The deserialized CachedContentUsageMetadata object, or null if deserialization fails.