VectorMemory

Trait VectorMemory 

Source
pub trait VectorMemory: Send + Sync {
    // Required methods
    fn store_text<'life0, 'async_trait>(
        &'life0 self,
        memory_id: String,
        agent_id: String,
        text: String,
        metadata: Option<Value>,
    ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn semantic_search<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        agent_id: &'life1 str,
        query: &'life2 str,
        limit: usize,
        threshold: Option<f32>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn clear<'life0, 'life1, 'async_trait>(
        &'life0 self,
        agent_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

High-level interface for semantic memory operations.

This trait combines embedding generation and vector storage to provide a complete semantic memory system. It handles the conversion of text memories into vector embeddings and provides semantic search capabilities.

Required Methods§

Source

fn store_text<'life0, 'async_trait>( &'life0 self, memory_id: String, agent_id: String, text: String, metadata: Option<Value>, ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stores a text memory by generating its embedding and storing it.

§Arguments
  • memory_id - ID of the associated memory entry
  • agent_id - ID of the agent
  • text - The text content to embed and store
  • metadata - Optional metadata to associate with the vector

Searches for similar memories using semantic search.

§Arguments
  • agent_id - ID of the agent to search within
  • query - The search query text
  • limit - Maximum number of results
  • threshold - Optional minimum similarity threshold
Source

fn clear<'life0, 'life1, 'async_trait>( &'life0 self, agent_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Clears all vector memories for an agent.

Implementors§