pub struct CompactionConfig {
pub keep_recent: usize,
pub max_batch: usize,
pub target_ratio: f32,
pub summary_max_tokens: usize,
pub temperature: f32,
pub timeout: Duration,
pub custom_instruction: Option<String>,
}Expand description
Compaction configuration for LLM-based compaction
Fields§
§keep_recent: usizeHow many recent messages to always keep (not compacted)
max_batch: usizeMaximum number of old messages to include in one summarization batch
target_ratio: f32Target compaction ratio (0.0 to 1.0) - e.g., 0.5 means reduce to 50%
summary_max_tokens: usizeMaximum tokens for the summary response
temperature: f32Temperature for summarization (lower = more focused)
timeout: DurationTimeout for LLM compaction requests
custom_instruction: Option<String>Custom instruction for the summarizer
Implementations§
Source§impl CompactionConfig
impl CompactionConfig
Sourcepub fn with_keep_recent(self, count: usize) -> Self
pub fn with_keep_recent(self, count: usize) -> Self
Set how many recent messages to always keep
Sourcepub fn with_max_batch(self, count: usize) -> Self
pub fn with_max_batch(self, count: usize) -> Self
Set maximum batch size for summarization
Sourcepub fn with_target_ratio(self, ratio: f32) -> Self
pub fn with_target_ratio(self, ratio: f32) -> Self
Set target compaction ratio (0.0 to 1.0)
Sourcepub fn with_summary_max_tokens(self, tokens: usize) -> Self
pub fn with_summary_max_tokens(self, tokens: usize) -> Self
Set maximum tokens for summary
Sourcepub fn with_temperature(self, temp: f32) -> Self
pub fn with_temperature(self, temp: f32) -> Self
Set temperature for summarization
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set timeout for LLM requests
Sourcepub fn with_custom_instruction(self, instruction: impl Into<String>) -> Self
pub fn with_custom_instruction(self, instruction: impl Into<String>) -> Self
Set custom instruction for the summarizer
Trait Implementations§
Source§impl Clone for CompactionConfig
impl Clone for CompactionConfig
Source§fn clone(&self) -> CompactionConfig
fn clone(&self) -> CompactionConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CompactionConfig
impl Debug for CompactionConfig
Auto Trait Implementations§
impl Freeze for CompactionConfig
impl RefUnwindSafe for CompactionConfig
impl Send for CompactionConfig
impl Sync for CompactionConfig
impl Unpin for CompactionConfig
impl UnsafeUnpin for CompactionConfig
impl UnwindSafe for CompactionConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more