Skip to main content

CompactionBackend

Trait CompactionBackend 

Source
pub trait CompactionBackend: Send + Sync {
    // Required method
    fn summarize<'life0, 'async_trait>(
        &'life0 self,
        request: SummaryRequest,
        cancellation: Option<TurnCancellation>,
    ) -> Pin<Box<dyn Future<Output = Result<SummaryResult, CompactionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Provider-backed summarisation service.

Implement this trait to connect a language model (or any other summarisation service) so that strategies like SummarizeOlderStrategy can condense older transcript items into a shorter summary.

§Errors

Implementations should return CompactionError::Failed when summarisation cannot be completed, or CompactionError::Cancelled when the cancellation token is signalled.

Required Methods§

Source

fn summarize<'life0, 'async_trait>( &'life0 self, request: SummaryRequest, cancellation: Option<TurnCancellation>, ) -> Pin<Box<dyn Future<Output = Result<SummaryResult, CompactionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Summarise the given items into a shorter set of replacement items.

§Arguments
  • request - The items to summarise together with session context.
  • cancellation - An optional cancellation token; implementations should check this periodically and bail early when cancelled.
§Errors

Returns CompactionError on failure or cancellation.

Implementors§