pub struct SummarizingCompaction {
pub keep_tail: usize,
pub summarize: Arc<dyn Fn(Vec<Message>) -> Result<String, MachiError> + Send + Sync>,
}Expand description
Summarizing compaction: replace dropped prefix with a single summary message.
The summarize callback is synchronous so strategies stay pure-sync; hosts
that call an LLM inject a precomputed summary or a blocking adapter.
Fields§
§keep_tail: usizeTail size to retain.
summarize: Arc<dyn Fn(Vec<Message>) -> Result<String, MachiError> + Send + Sync>Build a summary for the compacted-away prefix (excluding system).
Trait Implementations§
Source§impl Clone for SummarizingCompaction
impl Clone for SummarizingCompaction
Source§fn clone(&self) -> SummarizingCompaction
fn clone(&self) -> SummarizingCompaction
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 CompactionStrategy for SummarizingCompaction
impl CompactionStrategy for SummarizingCompaction
Source§fn should_compact(&self, messages: &[Message], _token_estimate: u64) -> bool
fn should_compact(&self, messages: &[Message], _token_estimate: u64) -> bool
Whether compaction should run given current size estimates.
Source§fn compact(
&self,
messages: Vec<Message>,
) -> Result<CompactionOutcome, MachiError>
fn compact( &self, messages: Vec<Message>, ) -> Result<CompactionOutcome, MachiError>
Produce a compacted message list. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for SummarizingCompaction
impl !UnwindSafe for SummarizingCompaction
impl Freeze for SummarizingCompaction
impl Send for SummarizingCompaction
impl Sync for SummarizingCompaction
impl Unpin for SummarizingCompaction
impl UnsafeUnpin for SummarizingCompaction
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