pub struct SummarizingMiddleware { /* private fields */ }Expand description
Compresses the earlier part of a long conversation via LLM summarization.
Implementations§
Source§impl SummarizingMiddleware
impl SummarizingMiddleware
pub fn new(client: Arc<dyn LlmClient>) -> Self
pub fn with_config(self, config: CompressionConfig) -> Self
pub fn with_trigger_tokens(self, tokens: usize) -> Self
pub fn with_keep_last_messages(self, n: usize) -> Self
pub fn with_max_summary_chars(self, chars: usize) -> Self
pub fn config(&self) -> &CompressionConfig
Trait Implementations§
Source§impl Middleware for SummarizingMiddleware
impl Middleware for SummarizingMiddleware
fn on_pre_llm<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut PreLlmCtx,
) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_user_message<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 mut UserMessageCtx,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn on_post_llm<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 mut PostLlmCtx,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Auto Trait Implementations§
impl !Freeze for SummarizingMiddleware
impl !RefUnwindSafe for SummarizingMiddleware
impl !UnwindSafe for SummarizingMiddleware
impl Send for SummarizingMiddleware
impl Sync for SummarizingMiddleware
impl Unpin for SummarizingMiddleware
impl UnsafeUnpin for SummarizingMiddleware
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