pub struct Compactor { /* private fields */ }Expand description
Compacts context by generating an LLM summary
Implementations§
Source§impl Compactor
impl Compactor
pub fn new(llm: Arc<dyn StreamingModelProvider>) -> Self
Sourcepub async fn compact(
&self,
context: &Context,
) -> Result<CompactionResult, CompactionError>
pub async fn compact( &self, context: &Context, ) -> Result<CompactionResult, CompactionError>
Generate a structured summary of the conversation and return a new compacted context.
This is a pure function that takes a reference to the context and returns a new context with the compacted messages replaced by a summary.
Auto Trait Implementations§
impl Freeze for Compactor
impl !RefUnwindSafe for Compactor
impl Send for Compactor
impl Sync for Compactor
impl Unpin for Compactor
impl UnsafeUnpin for Compactor
impl !UnwindSafe for Compactor
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