pub struct SummarizingConversationManager { /* private fields */ }Expand description
Summarizes the oldest messages when the context overflows (SummarizingConversationManager),
replacing them with one user message that holds the summary.
Implementations§
Source§impl SummarizingConversationManager
impl SummarizingConversationManager
Sourcepub fn new(config: SummarizingConversationManagerConfig) -> Result<Self>
pub fn new(config: SummarizingConversationManagerConfig) -> Result<Self>
Sourcepub fn summary_ratio(&self) -> f64
pub fn summary_ratio(&self) -> f64
The share of the oldest messages summarized per reduction, after clamping.
Trait Implementations§
Source§impl ConversationManager for SummarizingConversationManager
impl ConversationManager for SummarizingConversationManager
Source§fn reduce<'life0, 'life1, 'async_trait>(
&'life0 self,
options: ConversationManagerReduceOptions<'life1>,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn reduce<'life0, 'life1, 'async_trait>(
&'life0 self,
options: ConversationManagerReduceOptions<'life1>,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Summarizes with this model > the agent’s aux model > the agent’s model; the triggering
model is not used. During overflow recovery a failed summary is returned as the error, with
the overflow as its source; during proactive compression it is logged and false returned.
Source§fn compression_threshold(&self) -> Option<f64>
fn compression_threshold(&self) -> Option<f64>
The proactive compression threshold, or
None when only overflow recovery runs: the
ratio of the context window, in (0, 1], at which a model call reduces first. The agent
checks it when the manager is initialized and fails otherwise.Source§fn init_agent<'life0, 'life1, 'async_trait>(
&'life0 self,
_agent: &'life1 mut LocalAgent,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn init_agent<'life0, 'life1, 'async_trait>(
&'life0 self,
_agent: &'life1 mut LocalAgent,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Registers the strategy’s own hooks, after the overflow and compression hooks. Read more
Auto Trait Implementations§
impl !Freeze for SummarizingConversationManager
impl !RefUnwindSafe for SummarizingConversationManager
impl !UnwindSafe for SummarizingConversationManager
impl Send for SummarizingConversationManager
impl Sync for SummarizingConversationManager
impl Unpin for SummarizingConversationManager
impl UnsafeUnpin for SummarizingConversationManager
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.