Class SlidingWindow
Context window will be truncated by keeping only suffix of it. Context window will always be
cut at start of USER role turn. System instructions and
BidiGenerateContentSetup.prefix_turns will not be subject to the sliding window mechanism,
they will always stay at the beginning of context window.
public record SlidingWindow : IEquatable<SlidingWindow>
- Inheritance
-
SlidingWindow
- Implements
- Inherited Members
Properties
TargetTokens
Session reduction target -- how many tokens we should keep. Window shortening operation has some latency costs, so we should avoid running it on every turn. Should be less than trigger_tokens. If not set, trigger_tokens/2 is assumed.
[JsonPropertyName("targetTokens")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonConverter(typeof(StringToNullableLongConverter))]
public long? TargetTokens { get; set; }
Property Value
- long?
Methods
FromJson(string, JsonSerializerOptions?)
Deserializes a JSON string to a SlidingWindow object.
public static SlidingWindow? FromJson(string jsonString, JsonSerializerOptions? options = null)
Parameters
jsonStringstringThe JSON string to deserialize.
optionsJsonSerializerOptionsOptional JsonSerializerOptions.
Returns
- SlidingWindow
The deserialized SlidingWindow object, or null if deserialization fails.