pub trait Memory: Send {
// Required methods
fn remember(
&self,
scope: &MemoryScope,
payload: Vec<u8>,
) -> impl Future<Output = Result<MemoryId, LaserError>> + Send;
fn recall(
&self,
scope: &MemoryScope,
query: &MemoryQuery,
) -> impl Future<Output = Result<Vec<MemoryItem>, LaserError>> + Send;
fn improve(
&self,
scope: &MemoryScope,
feedback: Feedback,
) -> impl Future<Output = Result<MemoryId, LaserError>> + Send;
fn forget(
&self,
scope: &MemoryScope,
id: MemoryId,
) -> impl Future<Output = Result<(), LaserError>> + Send;
// Provided method
fn append(
&self,
scope: &MemoryScope,
id: MemoryId,
kind: MemoryKind,
payload: Vec<u8>,
) -> impl Future<Output = Result<MemoryId, LaserError>> + Send
where Self: Sync { ... }
}Expand description
Agent memory: remember / recall / improve / forget. (Memory is the
Send variant.)
Required Methods§
Sourcefn remember(
&self,
scope: &MemoryScope,
payload: Vec<u8>,
) -> impl Future<Output = Result<MemoryId, LaserError>> + Send
fn remember( &self, scope: &MemoryScope, payload: Vec<u8>, ) -> impl Future<Output = Result<MemoryId, LaserError>> + Send
Append payload to the memory under scope. The body is opaque bytes,
so encode it with whatever codec you like before calling.
fn recall( &self, scope: &MemoryScope, query: &MemoryQuery, ) -> impl Future<Output = Result<Vec<MemoryItem>, LaserError>> + Send
Sourcefn improve(
&self,
scope: &MemoryScope,
feedback: Feedback,
) -> impl Future<Output = Result<MemoryId, LaserError>> + Send
fn improve( &self, scope: &MemoryScope, feedback: Feedback, ) -> impl Future<Output = Result<MemoryId, LaserError>> + Send
Record feedback on a recalled item, the log-native signal a ranking
backend folds into future recall. Returns the feedback record’s id.
fn forget( &self, scope: &MemoryScope, id: MemoryId, ) -> impl Future<Output = Result<(), LaserError>> + Send
Provided Methods§
Sourcefn append(
&self,
scope: &MemoryScope,
id: MemoryId,
kind: MemoryKind,
payload: Vec<u8>,
) -> impl Future<Output = Result<MemoryId, LaserError>> + Sendwhere
Self: Sync,
fn append(
&self,
scope: &MemoryScope,
id: MemoryId,
kind: MemoryKind,
payload: Vec<u8>,
) -> impl Future<Output = Result<MemoryId, LaserError>> + Sendwhere
Self: Sync,
Append a typed item. Custom backends can keep their remember fallback.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".