Trait rig::vector_store::VectorStore

source ·
pub trait VectorStore: Send + Sync {
    type Q;

    // Required methods
    fn add_documents(
        &mut self,
        documents: Vec<DocumentEmbeddings>,
    ) -> impl Future<Output = Result<(), VectorStoreError>> + Send;
    fn get_document_embeddings(
        &self,
        id: &str,
    ) -> impl Future<Output = Result<Option<DocumentEmbeddings>, VectorStoreError>> + Send;
    fn get_document<T: for<'a> Deserialize<'a>>(
        &self,
        id: &str,
    ) -> impl Future<Output = Result<Option<T>, VectorStoreError>> + Send;
    fn get_document_by_query(
        &self,
        query: Self::Q,
    ) -> impl Future<Output = Result<Option<DocumentEmbeddings>, VectorStoreError>> + Send;
}
Expand description

Trait for vector stores

Required Associated Types§

source

type Q

Query type for the vector store

Required Methods§

source

fn add_documents( &mut self, documents: Vec<DocumentEmbeddings>, ) -> impl Future<Output = Result<(), VectorStoreError>> + Send

Add a list of documents to the vector store

source

fn get_document_embeddings( &self, id: &str, ) -> impl Future<Output = Result<Option<DocumentEmbeddings>, VectorStoreError>> + Send

Get the embeddings of a document by its id

source

fn get_document<T: for<'a> Deserialize<'a>>( &self, id: &str, ) -> impl Future<Output = Result<Option<T>, VectorStoreError>> + Send

Get the document by its id and deserialize it into the given type

source

fn get_document_by_query( &self, query: Self::Q, ) -> impl Future<Output = Result<Option<DocumentEmbeddings>, VectorStoreError>> + Send

Get the document by a query and deserialize it into the given type

Object Safety§

This trait is not object safe.

Implementors§