window

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContextCompressor

func NewContextCompressor(opts ...Option) blades.ContextCompressor

NewContextCompressor returns a ContextCompressor that keeps the most recent messages within the configured token or message count limits. Messages are dropped from the front (oldest first) when limits are exceeded.

Types

type Option

type Option func(*contextCompressor)

Option configures a window ContextCompressor.

func WithMaxMessages

func WithMaxMessages(n int) Option

WithMaxMessages sets the maximum number of messages to retain. Oldest messages are dropped first when the limit is exceeded. Default is 100. Set to 0 to disable message count limiting.

func WithMaxTokens

func WithMaxTokens(tokens int64) Option

WithMaxTokens sets the maximum total token budget. Messages are dropped from the front until the budget is met. Default is 0 (no limit).

func WithTokenCounter

func WithTokenCounter(counter blades.TokenCounter) Option

WithTokenCounter sets the TokenCounter used to estimate token usage. Defaults to a character-based counter (1 token ≈ 4 chars).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL