Skip to main content

CoreMemoryStore

Trait CoreMemoryStore 

Source
pub trait CoreMemoryStore: Send + Sync {
    // Required methods
    fn get_all<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<CoreEntry>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
        entry: CoreEntry,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn remove<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn render<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn total_tokens<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for the core memory tier (tiny, always in prompt, ~500 tokens).

Required Methods§

Source

fn get_all<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<CoreEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get all core memory entries for a user.

Source

fn set<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, entry: CoreEntry, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set a core memory entry. Overwrites if key exists.

Source

fn remove<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: &'life1 str, key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Remove a core memory entry by key.

Source

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

Render all core memory entries as a formatted string for system prompt injection.

Source

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

Get total token count of all core memory entries for a user.

Implementors§