Skip to main content

MemoryStrategy

Trait MemoryStrategy 

Source
pub trait MemoryStrategy: Send + Sync {
    // Required methods
    fn load_context<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        session_id: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn consolidate_turn<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        user_message: &'life1 str,
        assistant_response: &'life2 str,
        provider: &'life3 dyn ModelProvider,
        model: &'life4 str,
        temperature: Option<f64>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
    fn run_governance<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

High-level memory lifecycle policy. Implemented by strategy objects that wrap one or more Memory backends.

Required Methods§

Source

fn load_context<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, query: &'life1 str, session_id: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Load and format relevant memory context for a conversation turn.

Source

fn consolidate_turn<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, user_message: &'life1 str, assistant_response: &'life2 str, provider: &'life3 dyn ModelProvider, model: &'life4 str, temperature: Option<f64>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Consolidate a conversation turn into long-term memory.

Source

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

Run memory governance (cleanup, archiving, background consolidation).

Implementors§