pub trait VectorDb: Send + Sync {
Show 14 methods
// Required methods
fn initialize<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn store_knowledge_item<'life0, 'life1, 'async_trait>(
&'life0 self,
item: &'life1 KnowledgeItem,
embedding: Vec<f32>,
) -> Pin<Box<dyn Future<Output = Result<VectorId, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn store_memory_item<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: AgentId,
memory: &'life1 MemoryItem,
embedding: Vec<f32>,
) -> Pin<Box<dyn Future<Output = Result<VectorId, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn batch_store<'life0, 'async_trait>(
&'life0 self,
batch: VectorBatchOperation,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorId>, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn search_knowledge_base<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
query_embedding: Vec<f32>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<KnowledgeItem>, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn semantic_search<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
query_embedding: Vec<f32>,
limit: usize,
threshold: f32,
) -> Pin<Box<dyn Future<Output = Result<Vec<ContextItem>, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn advanced_search<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
query_embedding: Vec<f32>,
filters: HashMap<String, String>,
limit: usize,
threshold: f32,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete_knowledge_item<'life0, 'async_trait>(
&'life0 self,
vector_id: VectorId,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn batch_delete<'life0, 'async_trait>(
&'life0 self,
vector_ids: Vec<VectorId>,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_metadata<'life0, 'async_trait>(
&'life0 self,
vector_id: VectorId,
metadata: HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<VectorDatabaseStats, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn create_index<'life0, 'life1, 'async_trait>(
&'life0 self,
field_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn optimize_collection<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Backend-agnostic vector database trait.
All vector operations go through this trait. Implementations:
LanceDbBackend— embedded, zero-config (default)QdrantClientWrapper— remote, feature-gated behindvector-qdrantNoOpVectorDatabase— fallback when no backend is configured
Required Methods§
Sourcefn initialize<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initialize the backend (create collection/table if needed).
Sourcefn store_knowledge_item<'life0, 'life1, 'async_trait>(
&'life0 self,
item: &'life1 KnowledgeItem,
embedding: Vec<f32>,
) -> Pin<Box<dyn Future<Output = Result<VectorId, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_knowledge_item<'life0, 'life1, 'async_trait>(
&'life0 self,
item: &'life1 KnowledgeItem,
embedding: Vec<f32>,
) -> Pin<Box<dyn Future<Output = Result<VectorId, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store a knowledge item with its embedding vector.
Sourcefn store_memory_item<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: AgentId,
memory: &'life1 MemoryItem,
embedding: Vec<f32>,
) -> Pin<Box<dyn Future<Output = Result<VectorId, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_memory_item<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: AgentId,
memory: &'life1 MemoryItem,
embedding: Vec<f32>,
) -> Pin<Box<dyn Future<Output = Result<VectorId, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store a memory item with its embedding vector.
Sourcefn batch_store<'life0, 'async_trait>(
&'life0 self,
batch: VectorBatchOperation,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorId>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn batch_store<'life0, 'async_trait>(
&'life0 self,
batch: VectorBatchOperation,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorId>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Store multiple items in batch.
Sourcefn search_knowledge_base<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
query_embedding: Vec<f32>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<KnowledgeItem>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn search_knowledge_base<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
query_embedding: Vec<f32>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<KnowledgeItem>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Search the knowledge base by semantic similarity.
Sourcefn semantic_search<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
query_embedding: Vec<f32>,
limit: usize,
threshold: f32,
) -> Pin<Box<dyn Future<Output = Result<Vec<ContextItem>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn semantic_search<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
query_embedding: Vec<f32>,
limit: usize,
threshold: f32,
) -> Pin<Box<dyn Future<Output = Result<Vec<ContextItem>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Semantic similarity search returning context items.
Sourcefn advanced_search<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
query_embedding: Vec<f32>,
filters: HashMap<String, String>,
limit: usize,
threshold: f32,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn advanced_search<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
query_embedding: Vec<f32>,
filters: HashMap<String, String>,
limit: usize,
threshold: f32,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorSearchResult>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Advanced search with metadata filters.
Sourcefn delete_knowledge_item<'life0, 'async_trait>(
&'life0 self,
vector_id: VectorId,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_knowledge_item<'life0, 'async_trait>(
&'life0 self,
vector_id: VectorId,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete a knowledge item by vector ID.
Sourcefn batch_delete<'life0, 'async_trait>(
&'life0 self,
vector_ids: Vec<VectorId>,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn batch_delete<'life0, 'async_trait>(
&'life0 self,
vector_ids: Vec<VectorId>,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete multiple vectors by ID.
Sourcefn update_metadata<'life0, 'async_trait>(
&'life0 self,
vector_id: VectorId,
metadata: HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_metadata<'life0, 'async_trait>(
&'life0 self,
vector_id: VectorId,
metadata: HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update metadata on an existing vector.
Sourcefn get_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<VectorDatabaseStats, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<VectorDatabaseStats, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get statistics about the vector database.
Sourcefn create_index<'life0, 'life1, 'async_trait>(
&'life0 self,
field_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_index<'life0, 'life1, 'async_trait>(
&'life0 self,
field_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create an index on a field.
Sourcefn optimize_collection<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn optimize_collection<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Optimize the collection (compact, reindex, etc.).
Sourcefn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Health check — can the backend be reached?