pub trait VectorStore:
Send
+ Sync
+ 'static {
// Required methods
fn add_documents<'life0, 'async_trait>(
&'life0 self,
documents: Vec<Document>,
embeddings: Option<Vec<Embedding>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn similarity_search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
k: usize,
filter: Option<HashMap<String, Value>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn similarity_search_by_embedding<'life0, 'life1, 'async_trait>(
&'life0 self,
query_embedding: &'life1 Embedding,
k: usize,
filter: Option<HashMap<String, Value>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete<'life0, 'async_trait>(
&'life0 self,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn add_texts<'life0, 'async_trait>(
&'life0 self,
texts: Vec<String>,
metadatas: Option<Vec<HashMap<String, Value>>>,
embeddings: Option<Vec<Embedding>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn embedding_model(&self) -> Option<&dyn Embeddings> { ... }
}
Expand description
Base trait for all vector stores
Required Methods§
Sourcefn add_documents<'life0, 'async_trait>(
&'life0 self,
documents: Vec<Document>,
embeddings: Option<Vec<Embedding>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_documents<'life0, 'async_trait>(
&'life0 self,
documents: Vec<Document>,
embeddings: Option<Vec<Embedding>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add documents to the vector store
Sourcefn similarity_search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
k: usize,
filter: Option<HashMap<String, Value>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn similarity_search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
k: usize,
filter: Option<HashMap<String, Value>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Search for similar documents
Sourcefn similarity_search_by_embedding<'life0, 'life1, 'async_trait>(
&'life0 self,
query_embedding: &'life1 Embedding,
k: usize,
filter: Option<HashMap<String, Value>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn similarity_search_by_embedding<'life0, 'life1, 'async_trait>(
&'life0 self,
query_embedding: &'life1 Embedding,
k: usize,
filter: Option<HashMap<String, Value>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Search for similar documents by embedding
Sourcefn delete<'life0, 'async_trait>(
&'life0 self,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete<'life0, 'async_trait>(
&'life0 self,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete documents by IDs
Provided Methods§
Sourcefn add_texts<'life0, 'async_trait>(
&'life0 self,
texts: Vec<String>,
metadatas: Option<Vec<HashMap<String, Value>>>,
embeddings: Option<Vec<Embedding>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_texts<'life0, 'async_trait>(
&'life0 self,
texts: Vec<String>,
metadatas: Option<Vec<HashMap<String, Value>>>,
embeddings: Option<Vec<Embedding>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add texts to the vector store
Sourcefn is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if the store is empty
Sourcefn embedding_model(&self) -> Option<&dyn Embeddings>
fn embedding_model(&self) -> Option<&dyn Embeddings>
Get the embedding model used by this store