AsyncCompactor

Trait AsyncCompactor 

Source
pub trait AsyncCompactor: Compactor {
    // Required method
    fn compact_async<'a>(
        &'a self,
        conversation: Vec<Message>,
        compact_summaries: &'a HashMap<String, String>,
    ) -> Pin<Box<dyn Future<Output = Result<(Vec<Message>, CompactionResult), CompactionError>> + Send + 'a>>;
}
Expand description

Trait for async compaction strategies that require LLM calls. Implementors must also implement Compactor with is_async() -> true.

Required Methods§

Source

fn compact_async<'a>( &'a self, conversation: Vec<Message>, compact_summaries: &'a HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<(Vec<Message>, CompactionResult), CompactionError>> + Send + 'a>>

Performs async compaction that may involve LLM calls. Returns the new conversation and compaction statistics.

Unlike sync compact() which modifies in place, this returns a new conversation because async compaction may replace multiple messages with a single summary.

Implementors§