pub trait VectorDatabase: Send + Sync {
Show 13 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;
}Expand description
Vector database operations trait
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 vector database connection and collection
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
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 memory item with embedding
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,
Batch store multiple items for performance
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 for similar knowledge items
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,
Perform semantic search with text query
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 filters and metadata
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 knowledge item by 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,
Batch delete multiple items
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 knowledge item metadata
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 collection statistics
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 index for better performance
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 collection for better search performance