Sliding window context compression configuration.
The SlidingWindow method operates by discarding content at the beginning of the context window. The resulting context will always begin at the start of a USER role turn. System instructions and any prefix turns will always remain at the beginning of the result.
Fields
target_tokens- Target number of tokens to keep. Default is trigger_tokens/2
Example
%SlidingWindow{target_tokens: 8000}
Summary
Functions
Parses from API response.
Creates a new SlidingWindow configuration.
Converts to API format (camelCase).
Types
@type t() :: %Gemini.Types.Live.SlidingWindow{target_tokens: integer() | nil}
Functions
Parses from API response.
Creates a new SlidingWindow configuration.
Converts to API format (camelCase).
Accepts structs, maps with atom keys, or maps with string keys. Uses fetch_value to properly preserve falsey values like 0 or false.