Skip to main content

ArchivalMemory

Trait ArchivalMemory 

Source
pub trait ArchivalMemory: Send + Sync {
    // Required methods
    fn insert(
        &self,
        text: &str,
        metadata: HashMap<String, Value>,
    ) -> impl Future<Output = Result<String>> + Send;
    fn search(
        &self,
        query: &str,
        top_k: usize,
    ) -> impl Future<Output = Result<Vec<ArchivalRecord>>> + Send;
    fn delete(&self, id: &str) -> impl Future<Output = Result<bool>> + Send;
    fn count(&self) -> impl Future<Output = Result<usize>> + Send;
}
Expand description

Trait for long-term archival fact storage, decoupled from the turn-by-turn conversation log.

Facts are written explicitly via insert and retrieved by relevance via search — never by simply replaying everything in insertion order.

Required Methods§

Source

fn insert( &self, text: &str, metadata: HashMap<String, Value>, ) -> impl Future<Output = Result<String>> + Send

Stores a fact and returns its assigned id.

Source

fn search( &self, query: &str, top_k: usize, ) -> impl Future<Output = Result<Vec<ArchivalRecord>>> + Send

Returns up to top_k facts most relevant to query, ordered by descending relevance.

Source

fn delete(&self, id: &str) -> impl Future<Output = Result<bool>> + Send

Deletes a fact by id. Returns true if it existed.

Source

fn count(&self) -> impl Future<Output = Result<usize>> + Send

Returns the total number of stored facts.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§