pub struct ThresholdCompactor { /* private fields */ }Expand description
Compacts when context usage exceeds a threshold. It identifies turns to keep (most recent N) and applies the configured compaction strategy to older tool results.
Implementations§
Source§impl ThresholdCompactor
impl ThresholdCompactor
Sourcepub fn new(
threshold: f64,
keep_recent_turns: usize,
tool_compaction: ToolCompaction,
) -> Result<Self, CompactorConfigError>
pub fn new( threshold: f64, keep_recent_turns: usize, tool_compaction: ToolCompaction, ) -> Result<Self, CompactorConfigError>
Trait Implementations§
Source§impl Compactor for ThresholdCompactor
impl Compactor for ThresholdCompactor
Source§fn should_compact(&self, context_used: i64, context_limit: i32) -> bool
fn should_compact(&self, context_used: i64, context_limit: i32) -> bool
Returns true if compaction should occur before this LLM call. Read more
Auto Trait Implementations§
impl Freeze for ThresholdCompactor
impl RefUnwindSafe for ThresholdCompactor
impl Send for ThresholdCompactor
impl Sync for ThresholdCompactor
impl Unpin for ThresholdCompactor
impl UnwindSafe for ThresholdCompactor
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more