pub struct Memory { /* private fields */ }Expand description
Main Memory interface
Implementations§
Source§impl Memory
impl Memory
Sourcepub async fn new(config: MemoryConfig) -> Result<Self, MemoryError>
pub async fn new(config: MemoryConfig) -> Result<Self, MemoryError>
Create a new Memory instance
Sourcepub async fn add(
&self,
messages: impl Into<Messages>,
options: AddOptions,
) -> Result<AddResult, MemoryError>
pub async fn add( &self, messages: impl Into<Messages>, options: AddOptions, ) -> Result<AddResult, MemoryError>
Add memories from messages
Sourcepub async fn search(
&self,
query: &str,
options: SearchOptions,
) -> Result<SearchResult, MemoryError>
pub async fn search( &self, query: &str, options: SearchOptions, ) -> Result<SearchResult, MemoryError>
Search for memories
Sourcepub async fn get(&self, id: &str) -> Result<Option<MemoryRecord>, MemoryError>
pub async fn get(&self, id: &str) -> Result<Option<MemoryRecord>, MemoryError>
Get a memory by ID
Sourcepub async fn get_all(
&self,
options: GetAllOptions,
) -> Result<Vec<MemoryRecord>, MemoryError>
pub async fn get_all( &self, options: GetAllOptions, ) -> Result<Vec<MemoryRecord>, MemoryError>
Get all memories
Sourcepub async fn update(
&self,
id: &str,
content: &str,
) -> Result<MemoryRecord, MemoryError>
pub async fn update( &self, id: &str, content: &str, ) -> Result<MemoryRecord, MemoryError>
Update a memory
Sourcepub async fn history(&self, id: &str) -> Result<Vec<HistoryEntry>, MemoryError>
pub async fn history(&self, id: &str) -> Result<Vec<HistoryEntry>, MemoryError>
Get memory history
Sourcepub async fn reset(&self, options: ResetOptions) -> Result<(), MemoryError>
pub async fn reset(&self, options: ResetOptions) -> Result<(), MemoryError>
Reset all memories
Auto Trait Implementations§
impl Freeze for Memory
impl !RefUnwindSafe for Memory
impl Send for Memory
impl Sync for Memory
impl Unpin for Memory
impl !UnwindSafe for Memory
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more