pub struct RLUCacheMemory { /* private fields */ }Expand description
A memory structure that stores messages in an LRU (Least Recently Used) cache.
Implementations§
Trait Implementations§
Source§impl From<RLUCacheMemory> for Arc<Mutex<dyn Memory>>
Converts RLUCacheMemory into an Arc<Mutex<dyn Memory>>.
impl From<RLUCacheMemory> for Arc<Mutex<dyn Memory>>
Converts RLUCacheMemory into an Arc<Mutex<dyn Memory>>.
Source§fn from(val: RLUCacheMemory) -> Self
fn from(val: RLUCacheMemory) -> Self
Converts to this type from the input type.
Source§impl From<RLUCacheMemory> for Arc<dyn Memory>
Converts RLUCacheMemory into an Arc<dyn Memory>.
impl From<RLUCacheMemory> for Arc<dyn Memory>
Converts RLUCacheMemory into an Arc<dyn Memory>.
Source§fn from(val: RLUCacheMemory) -> Self
fn from(val: RLUCacheMemory) -> Self
Converts to this type from the input type.
Source§impl Memory for RLUCacheMemory
impl Memory for RLUCacheMemory
Source§fn add_message(&mut self, message: Message)
fn add_message(&mut self, message: Message)
Adds a message to the cache, evicting the least recently used message if the cache is full.
Source§fn add_user_message(&mut self, message: &dyn Display)
fn add_user_message(&mut self, message: &dyn Display)
Adds a user (human) message to the memory.
Source§fn add_ai_message(&mut self, message: &dyn Display)
fn add_ai_message(&mut self, message: &dyn Display)
Adds an AI (LLM) message to the memory.
Auto Trait Implementations§
impl Freeze for RLUCacheMemory
impl RefUnwindSafe for RLUCacheMemory
impl Send for RLUCacheMemory
impl Sync for RLUCacheMemory
impl Unpin for RLUCacheMemory
impl UnwindSafe for RLUCacheMemory
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> 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<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 more