pub trait VectorMemory: Memory {
// Required methods
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn similarity_search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
limit: Option<usize>,
threshold: Option<f32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<(MemoryEntry, f32)>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Extended trait for vector-based semantic search
Required Methods§
Sourcefn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate embedding for text
Sourcefn similarity_search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
limit: Option<usize>,
threshold: Option<f32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<(MemoryEntry, f32)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn similarity_search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
limit: Option<usize>,
threshold: Option<f32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<(MemoryEntry, f32)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Semantic similarity search Returns entries with similarity scores (higher = more similar)