Skip to main content

Memory

Trait Memory 

Source
pub trait Memory: Send + Sync {
    type Error: Error + 'static + Send + Sync;

    // Required methods
    async fn add(
        &mut self,
        user_input: &str,
        ai_response: &str,
    ) -> Result<(), Self::Error>;
    async fn search(&self, query: &str) -> Result<Vec<ChatMessage>, Self::Error>;
    async fn clear(&mut self) -> Result<(), Self::Error>;
}

Required Associated Types§

Source

type Error: Error + 'static + Send + Sync

Required Methods§

Source

async fn add( &mut self, user_input: &str, ai_response: &str, ) -> Result<(), Self::Error>

Source

async fn search(&self, query: &str) -> Result<Vec<ChatMessage>, Self::Error>

Source

async fn clear(&mut self) -> Result<(), Self::Error>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§