Skip to main content

MemoryBackend

Trait MemoryBackend 

Source
pub trait MemoryBackend:
    Send
    + Sync
    + Debug {
    // Required methods
    fn put<'a>(
        &'a self,
        content: &'a str,
        kind: &'a str,
        subject: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<String, ToolError>> + Send + 'a>>;
    fn search<'a>(
        &'a self,
        query: &'a str,
        k: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryItem>, ToolError>> + Send + 'a>>;
    fn list<'a>(
        &'a self,
        subject: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryItem>, ToolError>> + Send + 'a>>;
    fn delete<'a>(
        &'a self,
        id: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<(), ToolError>> + Send + 'a>>;
}
Expand description

Memory backend for the memory_* tools. The composition root implements this, bridging to oxi_sdk::ports::MemoryStore + EmbeddingProvider.

Required Methods§

Source

fn put<'a>( &'a self, content: &'a str, kind: &'a str, subject: &'a str, ) -> Pin<Box<dyn Future<Output = Result<String, ToolError>> + Send + 'a>>

Store a memory item, returning its new ID.

Source

fn search<'a>( &'a self, query: &'a str, k: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryItem>, ToolError>> + Send + 'a>>

Semantic-search stored memories, returning up to k matches.

Source

fn list<'a>( &'a self, subject: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryItem>, ToolError>> + Send + 'a>>

List memory items for the given subject.

Source

fn delete<'a>( &'a self, id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), ToolError>> + Send + 'a>>

Delete the memory item with the given ID.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§