Table of Contents

Class ContextWindowCompressionConfig

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

Enables context window compression -- mechanism managing model context window so it does not exceed given length.

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

Properties

SlidingWindow

Sliding window compression mechanism.

[JsonPropertyName("slidingWindow")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public SlidingWindow? SlidingWindow { get; set; }

Property Value

SlidingWindow

TriggerTokens

Number of tokens (before running turn) that triggers context window compression mechanism.

[JsonPropertyName("triggerTokens")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonConverter(typeof(StringToNullableLongConverter))]
public long? TriggerTokens { get; set; }

Property Value

long?

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a ContextWindowCompressionConfig object.

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

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

ContextWindowCompressionConfig

The deserialized ContextWindowCompressionConfig object, or null if deserialization fails.