Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compactor ¶
type Compactor struct {
sleipnir.BaseMiddleware
// contains filtered or unexported fields
}
Compactor is a ContextRewriter that summarizes old messages when the context window exceeds the threshold. It skips sub-agents (they have isolated histories).
func NewCompactor ¶
NewCompactor constructs a Compactor with the given Config.
func (*Compactor) RewriteBeforeLLMCall ¶
RewriteBeforeLLMCall compacts the message history when the estimated token count exceeds the configured threshold. Sub-agent contexts are skipped.
type Config ¶
type Config struct {
// Provider to use for summarization. Typically a cheap/fast model.
Provider anyllm.Provider
Model string
// Threshold fraction of estimated context window at which to compact.
// 0 → defaults to 0.75.
Threshold float64
// ContextWindow is the estimated total context size in tokens. Default: 100_000.
ContextWindow int
}
Config configures the Compactor middleware.
Click to show internal directories.
Click to hide internal directories.