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§
Sourcefn put<'a>(
&'a self,
content: &'a str,
kind: &'a str,
subject: &'a str,
) -> Pin<Box<dyn Future<Output = Result<String, ToolError>> + Send + 'a>>
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.
Sourcefn search<'a>(
&'a self,
query: &'a str,
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryItem>, ToolError>> + Send + 'a>>
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".