VectorStore

Trait VectorStore 

Source
pub trait VectorStore: Send + Sync {
    // Required methods
    fn insert<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
        embedding: Vec<f32>,
        payload: Payload,
    ) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn search<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        embedding: &'life1 [f32],
        limit: usize,
        filters: Option<&'life2 Filters>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>, VectorStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<VectorSearchResult>, VectorStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
        embedding: Option<Vec<f32>>,
        payload: Payload,
    ) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list<'life0, 'life1, 'async_trait>(
        &'life0 self,
        filters: Option<&'life1 Filters>,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>, VectorStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_all<'life0, 'life1, 'async_trait>(
        &'life0 self,
        filters: Option<&'life1 Filters>,
    ) -> Pin<Box<dyn Future<Output = Result<usize, VectorStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn collection_exists<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<bool, VectorStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn create_collection<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for vector storage backends

Required Methods§

Source

fn insert<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, embedding: Vec<f32>, payload: Payload, ) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Insert a record with its embedding

Source

fn search<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, embedding: &'life1 [f32], limit: usize, filters: Option<&'life2 Filters>, ) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>, VectorStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Search for similar vectors

Source

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

Get a single record by ID

Source

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

Delete a record by ID

Source

fn update<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, embedding: Option<Vec<f32>>, payload: Payload, ) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update a record

Source

fn list<'life0, 'life1, 'async_trait>( &'life0 self, filters: Option<&'life1 Filters>, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>, VectorStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List all records with optional filters

Source

fn delete_all<'life0, 'life1, 'async_trait>( &'life0 self, filters: Option<&'life1 Filters>, ) -> Pin<Box<dyn Future<Output = Result<usize, VectorStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete all records matching filters

Source

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

Check if collection/index exists

Source

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

Create collection/index if it doesn’t exist

Implementors§