pub struct ContextCompressor<F, Fut>{Show 21 fields
pub context_length: usize,
pub summarize_callback: F,
pub threshold_percent: f64,
pub protect_first_n: usize,
pub protect_last_n: usize,
pub summary_target_ratio: f64,
pub abort_on_summary_failure: bool,
pub threshold_tokens: usize,
pub tail_token_budget: usize,
pub max_summary_tokens: usize,
pub compression_count: usize,
pub last_prompt_tokens: usize,
pub last_completion_tokens: usize,
pub previous_summary: Option<String>,
pub last_compression_savings_pct: f64,
pub ineffective_compression_count: usize,
pub summary_failure_cooldown_until: f64,
pub last_summary_error: Option<String>,
pub last_summary_dropped_count: usize,
pub last_summary_fallback_used: bool,
pub last_compress_aborted: bool,
}Fields§
§context_length: usize§summarize_callback: F§threshold_percent: f64§protect_first_n: usize§protect_last_n: usize§summary_target_ratio: f64§abort_on_summary_failure: bool§threshold_tokens: usize§tail_token_budget: usize§max_summary_tokens: usize§compression_count: usize§last_prompt_tokens: usize§last_completion_tokens: usize§previous_summary: Option<String>§last_compression_savings_pct: f64§ineffective_compression_count: usize§summary_failure_cooldown_until: f64§last_summary_error: Option<String>§last_summary_dropped_count: usize§last_summary_fallback_used: bool§last_compress_aborted: boolImplementations§
Source§impl<F, Fut> ContextCompressor<F, Fut>
impl<F, Fut> ContextCompressor<F, Fut>
pub fn new( context_length: usize, summarize_callback: F, threshold_percent: Option<f64>, protect_first_n: Option<usize>, protect_last_n: Option<usize>, summary_target_ratio: Option<f64>, abort_on_summary_failure: Option<bool>, ) -> Self
pub fn on_session_reset(&mut self)
pub fn should_compress(&self, prompt_tokens: Option<usize>) -> bool
pub fn has_content_to_compress(&self, messages: &[Message]) -> bool
pub async fn compress( &mut self, messages: &[Message], current_tokens: Option<usize>, focus_topic: Option<&str>, force: bool, ) -> Vec<Message>
Auto Trait Implementations§
impl<F, Fut> Freeze for ContextCompressor<F, Fut>where
F: Freeze,
impl<F, Fut> RefUnwindSafe for ContextCompressor<F, Fut>where
F: RefUnwindSafe,
impl<F, Fut> Send for ContextCompressor<F, Fut>
impl<F, Fut> Sync for ContextCompressor<F, Fut>
impl<F, Fut> Unpin for ContextCompressor<F, Fut>where
F: Unpin,
impl<F, Fut> UnsafeUnpin for ContextCompressor<F, Fut>where
F: UnsafeUnpin,
impl<F, Fut> UnwindSafe for ContextCompressor<F, Fut>where
F: UnwindSafe,
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