pub struct SlidingWindowConversationManager { /* private fields */ }Expand description
Keeps the most recent messages (SlidingWindowConversationManager): after every invocation
it trims history to the window, and on a context-window overflow it truncates the oldest large
tool result or trims the oldest messages. Trimming never starts history on a tool result or
separates a tool use from its result.
Implementations§
Source§impl SlidingWindowConversationManager
impl SlidingWindowConversationManager
Sourcepub fn new(config: SlidingWindowConversationManagerConfig) -> Result<Self>
pub fn new(config: SlidingWindowConversationManagerConfig) -> Result<Self>
Sourcepub fn window_size(&self) -> usize
pub fn window_size(&self) -> usize
The most messages kept in history.
Sourcepub fn should_truncate_results(&self) -> bool
pub fn should_truncate_results(&self) -> bool
Whether overflow recovery truncates tool results first.
Trait Implementations§
Source§impl ConversationManager for SlidingWindowConversationManager
impl ConversationManager for SlidingWindowConversationManager
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,
Truncates the oldest large tool result (overflow recovery only), otherwise trims the oldest messages.
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 SlidingWindowConversationManager
impl RefUnwindSafe for SlidingWindowConversationManager
impl Send for SlidingWindowConversationManager
impl Sync for SlidingWindowConversationManager
impl Unpin for SlidingWindowConversationManager
impl UnsafeUnpin for SlidingWindowConversationManager
impl UnwindSafe for SlidingWindowConversationManager
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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.