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§
Required Methods§
sourcefn add_documents(
&mut self,
documents: Vec<DocumentEmbeddings>,
) -> impl Future<Output = Result<(), VectorStoreError>> + Send
fn add_documents( &mut self, documents: Vec<DocumentEmbeddings>, ) -> impl Future<Output = Result<(), VectorStoreError>> + Send
Add a list of documents to the vector store
sourcefn get_document_embeddings(
&self,
id: &str,
) -> impl Future<Output = Result<Option<DocumentEmbeddings>, VectorStoreError>> + Send
fn get_document_embeddings( &self, id: &str, ) -> impl Future<Output = Result<Option<DocumentEmbeddings>, VectorStoreError>> + Send
Get the embeddings of a document by its id
sourcefn get_document<T: for<'a> Deserialize<'a>>(
&self,
id: &str,
) -> impl Future<Output = Result<Option<T>, VectorStoreError>> + Send
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
sourcefn get_document_by_query(
&self,
query: Self::Q,
) -> impl Future<Output = Result<Option<DocumentEmbeddings>, VectorStoreError>> + Send
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.