Skip to main content

VectorStore

Trait VectorStore 

Source
pub trait VectorStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn upsert<'life0, 'life1, 'async_trait>(
        &'life0 self,
        entry: &'life1 MemoryEntry,
        vector: Vec<f32>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn search<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query_vec: Vec<f32>,
        query_text: &'life1 str,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn remove<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_all<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Persistent store for MemoryEntry items with optional semantic search.

All methods are async and must not panic; they return Result so the caller can log warnings and continue rather than crashing the agent loop.

Required Methods§

Source

fn upsert<'life0, 'life1, 'async_trait>( &'life0 self, entry: &'life1 MemoryEntry, vector: Vec<f32>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Persist a memory entry. If an entry with the same id already exists it should be overwritten.

Source

fn search<'life0, 'life1, 'async_trait>( &'life0 self, query_vec: Vec<f32>, query_text: &'life1 str, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve up to limit entries whose vector is closest to query_vec (cosine similarity). If query_vec is empty, fall back to returning recent entries in insertion order.

Source

fn remove<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove the entry with the given id. No-op if not found.

Source

fn list_all<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return all entries in insertion order.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§