pub struct SlidingWindowMemory { /* private fields */ }Expand description
Wraps any Memory and limits the stored history to the last
max_messages non-system entries (always preserving a leading system
message in addition to that limit).
Implementations§
Trait Implementations§
Source§impl Memory for SlidingWindowMemory
impl Memory for SlidingWindowMemory
Source§fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load all messages for a session.
Source§fn save<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
messages: &'life2 [Message],
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
messages: &'life2 [Message],
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Replace the entire message list for a session.
Source§fn append<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
messages: &'life2 [Message],
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn append<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
messages: &'life2 [Message],
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Append messages to an existing session (creating it if needed).
Auto Trait Implementations§
impl !RefUnwindSafe for SlidingWindowMemory
impl !UnwindSafe for SlidingWindowMemory
impl Freeze for SlidingWindowMemory
impl Send for SlidingWindowMemory
impl Sync for SlidingWindowMemory
impl Unpin for SlidingWindowMemory
impl UnsafeUnpin 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