Skip to main content

VectorStore

Trait VectorStore 

Source
pub trait VectorStore: Send + Sync {
    // Required methods
    fn add_documents<'life0, 'life1, 'async_trait>(
        &'life0 self,
        docs: Vec<Document>,
        embeddings: &'life1 dyn Embeddings,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, SynapticError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn similarity_search<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        k: usize,
        embeddings: &'life2 dyn Embeddings,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, SynapticError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn similarity_search_with_score<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        k: usize,
        embeddings: &'life2 dyn Embeddings,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(Document, f32)>, SynapticError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn similarity_search_by_vector<'life0, 'life1, 'async_trait>(
        &'life0 self,
        embedding: &'life1 [f32],
        k: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, SynapticError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn delete<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ids: &'life1 [&'life2 str],
    ) -> Pin<Box<dyn Future<Output = Result<(), SynapticError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
}
Expand description

Trait for vector storage backends.

Required Methods§

Source

fn add_documents<'life0, 'life1, 'async_trait>( &'life0 self, docs: Vec<Document>, embeddings: &'life1 dyn Embeddings, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, SynapticError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Add documents to the store, computing their embeddings.

Search for similar documents by query string.

Source

fn similarity_search_with_score<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, query: &'life1 str, k: usize, embeddings: &'life2 dyn Embeddings, ) -> Pin<Box<dyn Future<Output = Result<Vec<(Document, f32)>, SynapticError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Search with similarity scores (higher = more similar).

Source

fn similarity_search_by_vector<'life0, 'life1, 'async_trait>( &'life0 self, embedding: &'life1 [f32], k: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, SynapticError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Search by pre-computed embedding vector instead of text query.

Source

fn delete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ids: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<(), SynapticError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Delete documents by ID.

Implementors§