#[non_exhaustive]pub struct CompactionConfig {
pub auto: bool,
pub prune: bool,
pub buffer_tokens: usize,
pub keep_tokens: usize,
pub tail_turns: usize,
pub model: Option<ModelName>,
pub provider: Option<ProviderId>,
pub circuit_breaker_threshold: u32,
}Expand description
Compaction configuration for automatic context compression.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.auto: boolEnable automatic compaction before provider turns. Default: true.
prune: boolEnable old tool output pruning. Default: false.
buffer_tokens: usizeToken headroom between context limit and compaction trigger. Default: 20_000.
keep_tokens: usizeTokens to retain as recent context after compaction. Default: 8_000.
tail_turns: usizeNumber of recent turns to preserve intact. Default: 2.
model: Option<ModelName>Model to use for compaction. Falls back to the run’s model when None.
provider: Option<ProviderId>Provider to use for compaction. Falls back to the run’s provider when None.
circuit_breaker_threshold: u32Number of consecutive compaction failures before the circuit breaker opens.
When open, proactive compaction is skipped. Default: 3.
Implementations§
Source§impl CompactionConfig
impl CompactionConfig
Sourcepub fn with_auto_disabled(self) -> Self
pub fn with_auto_disabled(self) -> Self
Disables automatic compaction.
Sourcepub fn with_prune(self) -> Self
pub fn with_prune(self) -> Self
Enables tool output pruning.
Sourcepub fn with_buffer_tokens(self, tokens: usize) -> Self
pub fn with_buffer_tokens(self, tokens: usize) -> Self
Sets the buffer token count.
Sourcepub fn with_keep_tokens(self, tokens: usize) -> Self
pub fn with_keep_tokens(self, tokens: usize) -> Self
Sets the keep token count.
Sourcepub fn with_tail_turns(self, turns: usize) -> Self
pub fn with_tail_turns(self, turns: usize) -> Self
Sets the number of recent turns to preserve.
Sourcepub fn with_model(self, model: ModelName) -> Self
pub fn with_model(self, model: ModelName) -> Self
Sets the compaction model.
Sourcepub fn with_provider(self, provider: ProviderId) -> Self
pub fn with_provider(self, provider: ProviderId) -> Self
Sets the compaction provider.
Sourcepub fn with_circuit_breaker_threshold(self, threshold: u32) -> Self
pub fn with_circuit_breaker_threshold(self, threshold: u32) -> Self
Sets the circuit breaker failure threshold.
Trait Implementations§
Source§impl Clone for CompactionConfig
impl Clone for CompactionConfig
Source§fn clone(&self) -> CompactionConfig
fn clone(&self) -> CompactionConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more