Structs§
- AiCompressor
- AI-based compressor using a Provider.
- Compression
Bias - Compression bias - controls what to prioritize during compression.
- Compression
Config - Configuration for context compression.
- Compression
History Entry - Compression history entry for session metadata.
- Compression
Result - Result of a compression operation.
- Summarized
Segment - A segment of conversation history that has been summarized.
Enums§
- Compression
Strategy - Strategy for compressing conversation history.
Constants§
- DEFAULT_
COMPRESSION_ THRESHOLD - Compression trigger threshold (percentage of context window).
- DEFAULT_
COMPRESSOR_ MODEL - Default model for summarization (cost-effective).
- DEFAULT_
TARGET_ RATIO - Target ratio after compression (keep this fraction of tokens).
- MIN_
MESSAGES_ TO_ KEEP - Minimum messages to keep after compression.
Traits§
- Compressor
- Compressor trait for different compression implementations.
Functions§
- build_
summary_ prompt - Build a prompt for AI-based summarization.
- compress_
messages - Compress messages synchronously (for non-AI strategies).
- compress_
messages_ with_ ai - Compress messages with AI summarization (async version).
- compress_
with_ bias - Compress messages with bias - prioritized removal based on configuration.
- estimate_
tokens - Estimate token count for a message (rough approximation).
- estimate_
total_ tokens - Estimate total tokens for a message list.
- format_
tokens - should_
compress - Check if compression should be triggered.