Expand description
Context window compression and summarization utilities.
Provides strategies for keeping LLM conversation context within token budget limits by dropping, summarizing, or windowing older messages.
Structs§
- Compression
Result - Summary of what happened during a compression pass.
- Context
Budget - Tracks token usage against a fixed budget.
- Context
Compressor - Applies a
CompressionStrategyto a slice of messages. - Message
- A single message in a conversation context.
Enums§
- Compression
Strategy - Strategy used when compressing a context window.
Functions§
- estimate_
tokens - Rough token estimate: word count × 1.3 + punctuation count.
- importance_
score - Compute an importance score for a message based on recency and role.