Skip to main content

HistoryCompactionStrategy

Trait HistoryCompactionStrategy 

Source
pub trait HistoryCompactionStrategy:
    Send
    + Sync
    + Debug {
    // Required method
    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;
}
Expand description

Strategy for compacting conversation history when tokens exceed a budget.

Required Methods§

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,

Attempt to compact messages if they exceed a budget.

Returns true if compaction occurred, false otherwise.

Implementors§