pub struct AgentMemory { /* private fields */ }Expand description
Agent memory
Implementations§
Source§impl AgentMemory
impl AgentMemory
pub fn new(config: MemoryConfig) -> Self
Sourcepub async fn add_message(&self, message: Message) -> Result<(), MemoryError>
pub async fn add_message(&self, message: Message) -> Result<(), MemoryError>
Add a message to memory
Sourcepub async fn get_history(&self) -> Result<Vec<Message>, MemoryError>
pub async fn get_history(&self) -> Result<Vec<Message>, MemoryError>
Get message history
Sourcepub async fn get_last_n(&self, n: usize) -> Result<Vec<Message>, MemoryError>
pub async fn get_last_n(&self, n: usize) -> Result<Vec<Message>, MemoryError>
Get last N messages
Sourcepub async fn clear(&self) -> Result<(), MemoryError>
pub async fn clear(&self) -> Result<(), MemoryError>
Clear memory
Auto Trait Implementations§
impl Freeze for AgentMemory
impl !RefUnwindSafe for AgentMemory
impl Send for AgentMemory
impl Sync for AgentMemory
impl Unpin for AgentMemory
impl UnsafeUnpin for AgentMemory
impl !UnwindSafe for AgentMemory
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