pub struct SummaryHistoryCompaction {
pub keep_recent: usize,
pub max_summary_input_tokens: usize,
pub summary_output_tokens: usize,
}Expand description
Compacts by asking the model to summarise old messages, keeping the most recent N.
Fields§
§keep_recent: usizeHow many most-recent messages to keep verbatim. Everything older may be summarised.
max_summary_input_tokens: usizeMaximum input budget for the summarisation provider call.
summary_output_tokens: usizeOutput budget reserved for the summarisation provider call.
Trait Implementations§
Source§impl Debug for SummaryHistoryCompaction
impl Debug for SummaryHistoryCompaction
Source§impl HistoryCompactionStrategy for SummaryHistoryCompaction
impl HistoryCompactionStrategy for SummaryHistoryCompaction
Source§fn compact<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 mut Vec<Message>,
provider: &'life2 dyn ModelProvider,
) -> Pin<Box<dyn Future<Output = Result<bool, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn compact<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 mut Vec<Message>,
provider: &'life2 dyn ModelProvider,
) -> Pin<Box<dyn Future<Output = Result<bool, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Attempt to compact
messages if they exceed a budget. Read moreAuto Trait Implementations§
impl Freeze for SummaryHistoryCompaction
impl RefUnwindSafe for SummaryHistoryCompaction
impl Send for SummaryHistoryCompaction
impl Sync for SummaryHistoryCompaction
impl Unpin for SummaryHistoryCompaction
impl UnsafeUnpin for SummaryHistoryCompaction
impl UnwindSafe for SummaryHistoryCompaction
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