pub struct SessionMemory {
pub max_messages: usize,
pub max_tokens: u32,
/* private fields */
}Expand description
Session memory: message history that persists across runs within a session.
Fields§
§max_messages: usize§max_tokens: u32Implementations§
Source§impl SessionMemory
impl SessionMemory
pub fn new(max_messages: usize, max_tokens: u32) -> Self
pub fn push(&mut self, msg: Message)
pub fn token_count(&self) -> u32
pub fn recent(&self, n: usize) -> Vec<&Message>
pub fn to_vec(&self) -> Vec<Message>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn clear(&mut self)
Trait Implementations§
Source§impl Debug for SessionMemory
impl Debug for SessionMemory
Auto Trait Implementations§
impl Freeze for SessionMemory
impl RefUnwindSafe for SessionMemory
impl Send for SessionMemory
impl Sync for SessionMemory
impl Unpin for SessionMemory
impl UnsafeUnpin for SessionMemory
impl UnwindSafe for SessionMemory
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