pub struct SlidingWindowMemory { /* private fields */ }Expand description
A MemoryPolicy that retains only the most recent max_messages entries.
When the window starts mid-conversation, a leading orphan tool-result
message (a Message::User whose first content is a tool result without
its preceding Message::Assistant tool call) is dropped to preserve the
tool-call/result pairing required by most providers.
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
Source§fn clone(&self) -> SlidingWindowMemory
fn clone(&self) -> SlidingWindowMemory
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SlidingWindowMemory
impl Debug for SlidingWindowMemory
Source§impl MemoryPolicy for SlidingWindowMemory
impl MemoryPolicy for SlidingWindowMemory
impl Copy 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