pub trait Store: Send + Sync {
// Required methods
fn add_memory<'life0, 'async_trait>(
&'life0 self,
fragment: MemoryFragment,
) -> Pin<Box<dyn Future<Output = Result<Thing>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_memory<'life0, 'async_trait>(
&'life0 self,
id: Thing,
) -> Pin<Box<dyn Future<Output = Result<Option<MemoryFragment>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn find_similar<'life0, 'life1, 'async_trait>(
&'life0 self,
embedding: &'life1 [f32],
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<(MemoryFragment, f32)>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn record_access<'life0, 'async_trait>(
&'life0 self,
id: Thing,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait defining the interface for the memory storage layer.
Required Methods§
Sourcefn add_memory<'life0, 'async_trait>(
&'life0 self,
fragment: MemoryFragment,
) -> Pin<Box<dyn Future<Output = Result<Thing>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_memory<'life0, 'async_trait>(
&'life0 self,
fragment: MemoryFragment,
) -> Pin<Box<dyn Future<Output = Result<Thing>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Adds a new memory fragment to the store. Returns the ID (Thing) of the newly created fragment.
Sourcefn get_memory<'life0, 'async_trait>(
&'life0 self,
id: Thing,
) -> Pin<Box<dyn Future<Output = Result<Option<MemoryFragment>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_memory<'life0, 'async_trait>(
&'life0 self,
id: Thing,
) -> Pin<Box<dyn Future<Output = Result<Option<MemoryFragment>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieves a memory fragment by its unique ID.
Sourcefn find_similar<'life0, 'life1, 'async_trait>(
&'life0 self,
embedding: &'life1 [f32],
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<(MemoryFragment, f32)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_similar<'life0, 'life1, 'async_trait>(
&'life0 self,
embedding: &'life1 [f32],
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<(MemoryFragment, f32)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Finds the top_k most similar memory fragments to the given embedding. Returns a list of (MemoryFragment, similarity_score) tuples.