pub struct InMemoryStore { /* private fields */ }Implementations§
Source§impl InMemoryStore
impl InMemoryStore
pub fn new(max_messages: usize) -> InMemoryStore
pub fn max_messages(&self) -> usize
Trait Implementations§
Source§impl Clone for InMemoryStore
impl Clone for InMemoryStore
Source§fn clone(&self) -> InMemoryStore
fn clone(&self) -> InMemoryStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Memory for InMemoryStore
impl Memory for InMemoryStore
Source§fn add_message<'life0, 'async_trait>(
&'life0 self,
message: ChatMessage,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryStore: 'async_trait,
fn add_message<'life0, 'async_trait>(
&'life0 self,
message: ChatMessage,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryStore: 'async_trait,
Append a message to conversation history.
Source§fn get_messages<'life0, 'async_trait>(
&'life0 self,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChatMessage>, AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryStore: 'async_trait,
fn get_messages<'life0, 'async_trait>(
&'life0 self,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChatMessage>, AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryStore: 'async_trait,
Get messages.
Some(n) returns the most recent N messages.Source§fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryStore: 'async_trait,
fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryStore: 'async_trait,
Remove all messages and reset state.
Source§fn restore<'life0, 'async_trait>(
&'life0 self,
snapshot: MemorySnapshot,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryStore: 'async_trait,
fn restore<'life0, 'async_trait>(
&'life0 self,
snapshot: MemorySnapshot,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryStore: 'async_trait,
Restore from a previously saved snapshot, replacing current state.
Source§fn evict_oldest<'life0, 'async_trait>(
&'life0 self,
count: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChatMessage>, AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryStore: 'async_trait,
fn evict_oldest<'life0, 'async_trait>(
&'life0 self,
count: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChatMessage>, AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryStore: 'async_trait,
Remove the oldest N messages. Returns empty vec by default.
Source§fn snapshot<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<MemorySnapshot, AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn snapshot<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<MemorySnapshot, AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Serialize current state for persistence.
Source§impl Memory for InMemoryStore
impl Memory for InMemoryStore
fn get_context<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ConversationContext, AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn compress<'life0, 'life1, 'async_trait>(
&'life0 self,
_summarizer: Option<&'life1 dyn Summarizer>,
) -> Pin<Box<dyn Future<Output = Result<CompressResult, AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn needs_compression(&self) -> bool
Auto Trait Implementations§
impl Freeze for InMemoryStore
impl !RefUnwindSafe for InMemoryStore
impl Send for InMemoryStore
impl Sync for InMemoryStore
impl Unpin for InMemoryStore
impl UnsafeUnpin for InMemoryStore
impl !UnwindSafe for InMemoryStore
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<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 moreCreates a shared type from an unshared type.