pub trait VectorStore: StorageBackend {
Show 13 methods
// Required methods
fn ensure_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
dimension: usize,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list_collections<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn collection_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn upsert<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
document: VectorDocument,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn upsert_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
documents: Vec<VectorDocument>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<VectorDocument>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn delete_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
ids: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
query_embedding: &'life2 [f32],
limit: usize,
filter: Option<VectorFilter>,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn count<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn collection_info<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<CollectionInfo>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn search_with_threshold<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
query_embedding: &'life2 [f32],
limit: usize,
min_score: f32,
filter: Option<VectorFilter>,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
VectorStore trait - semantic memory
Provides vector similarity search for RAG and long-term memory.
Required Methods§
Sourcefn ensure_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
dimension: usize,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ensure_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
dimension: usize,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a collection if it doesn’t exist
§Arguments
collection- Collection namedimension- Vector dimension (must match embeddings)
Sourcefn delete_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a collection and all its documents
Sourcefn list_collections<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_collections<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all collections
Sourcefn collection_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn collection_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a collection exists
Sourcefn upsert<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
document: VectorDocument,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn upsert<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
document: VectorDocument,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Upsert a document (insert or update)
If a document with the same ID exists, it is replaced.
Sourcefn upsert_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
documents: Vec<VectorDocument>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn upsert_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
documents: Vec<VectorDocument>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Upsert multiple documents atomically
Sourcefn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<VectorDocument>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<VectorDocument>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get a document by ID
Sourcefn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Delete a document by ID
Sourcefn delete_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
ids: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
ids: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Delete multiple documents by ID
Sourcefn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
query_embedding: &'life2 [f32],
limit: usize,
filter: Option<VectorFilter>,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
query_embedding: &'life2 [f32],
limit: usize,
filter: Option<VectorFilter>,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn count<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn count<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Count documents in a collection
Sourcefn collection_info<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<CollectionInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn collection_info<'life0, 'life1, 'async_trait>(
&'life0 self,
collection: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<CollectionInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get collection info (dimension, count, etc.)
Provided Methods§
Sourcefn search_with_threshold<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
query_embedding: &'life2 [f32],
limit: usize,
min_score: f32,
filter: Option<VectorFilter>,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn search_with_threshold<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
query_embedding: &'life2 [f32],
limit: usize,
min_score: f32,
filter: Option<VectorFilter>,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Search with score threshold
Only returns results with score >= min_score.