ChatHistoryCompactor

Trait ChatHistoryCompactor 

Source
pub trait ChatHistoryCompactor:
    Send
    + Sync
    + Clone {
    // Required method
    fn compact(
        &self,
        history: &mut Vec<Message>,
        counter: &mut TokenCounter,
        max_tokens: usize,
    );
}
Expand description

Trait for compacting chat history

Required Methods§

Source

fn compact( &self, history: &mut Vec<Message>, counter: &mut TokenCounter, max_tokens: usize, )

Compacts the chat history to fit within a token budget

This method should modify the history in place, removing messages as needed, and updating the token counter.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§