Package com.google.genai.types
Class SlidingWindow
java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.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.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SlidingWindow.Builder
builder()
Instantiates a builder for SlidingWindow.static SlidingWindow
Deserializes a JSON string to a SlidingWindow object.Session reduction target -- how many tokens we should keep.abstract SlidingWindow.Builder
Creates a builder with the same values as this instance.Methods inherited from class com.google.genai.JsonSerializable
stringToJsonNode, toJson
-
Constructor Details
-
SlidingWindow
public SlidingWindow()
-
-
Method Details
-
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 < trigger_tokens. If not set, trigger_tokens/2 is assumed. -
builder
Instantiates a builder for SlidingWindow. -
toBuilder
Creates a builder with the same values as this instance. -
fromJson
Deserializes a JSON string to a SlidingWindow object.
-