VectorStore

Trait VectorStore 

Source
pub trait VectorStore: Send + Sync {
    // Required methods
    fn load<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(MemoryId, String, Vec<f32>)>, MemoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn save<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        id: &'life1 MemoryId,
        hash: &'life2 str,
        vector: &'life3 [f32],
    ) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn remove<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 MemoryId,
    ) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Somewhere to keep vectors between processes.

Without this the index is rebuilt from nothing on every start, and rebuilding means one embedding round trip per record: 259 ms each, measured, so a 16,000-record corpus is over an hour of wall-clock before the first question can be answered semantically. That is not a slow start, it is an unusable one, and it recurs on every deploy and every replica.

Required Methods§

Source

fn load<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(MemoryId, String, Vec<f32>)>, MemoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Every vector held, as (id, text hash, vector).

Source

fn save<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, id: &'life1 MemoryId, hash: &'life2 str, vector: &'life3 [f32], ) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Persist one vector against the hash of the text that produced it.

Source

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

Forget a record’s vector.

Implementors§