pub struct SlidingWindowMemory { /* private fields */ }Expand description
A MemoryPolicy that retains only the most recent max_messages entries.
When the window starts mid-conversation, tool results before its first
Message::Assistant have lost their calls. The prefix through the last
such Message::User is demoted, including any accompanying text or
intervening system messages. Whole messages remain in original order in
(kept, demoted); paired results later in the window are left untouched.
Implementations§
Source§impl SlidingWindowMemory
impl SlidingWindowMemory
Sourcepub fn last_messages(n: usize) -> Self
pub fn last_messages(n: usize) -> Self
Keep at most n messages.
Trait Implementations§
Source§impl Clone for SlidingWindowMemory
impl Clone for SlidingWindowMemory
impl Copy for SlidingWindowMemory
Source§impl Debug for SlidingWindowMemory
impl Debug for SlidingWindowMemory
Source§impl MemoryPolicy for SlidingWindowMemory
impl MemoryPolicy for SlidingWindowMemory
Auto Trait Implementations§
impl Freeze for SlidingWindowMemory
impl RefUnwindSafe for SlidingWindowMemory
impl Send for SlidingWindowMemory
impl Sync for SlidingWindowMemory
impl Unpin for SlidingWindowMemory
impl UnsafeUnpin for SlidingWindowMemory
impl UnwindSafe for SlidingWindowMemory
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<P> IntoFilter for Pwhere
P: MemoryPolicy + 'static,
impl<P> IntoFilter for Pwhere
P: MemoryPolicy + 'static,
Source§fn into_filter(self) -> BoxedFilter
fn into_filter(self) -> BoxedFilter
Convert this policy into a filter closure. Read more