Skip to main content

VectorDatabase

Trait VectorDatabase 

Source
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§

Source

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

Source

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

Source

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

Source

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

Source

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

Perform semantic search with text query

Advanced search with filters and metadata

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Implementors§