pub trait LocalMemory {
// Required methods
async fn remember(
&self,
scope: &MemoryScope,
payload: Vec<u8>,
) -> Result<MemoryId, LaserError>;
async fn recall(
&self,
scope: &MemoryScope,
query: &MemoryQuery,
) -> Result<Vec<MemoryItem>, LaserError>;
async fn improve(
&self,
scope: &MemoryScope,
feedback: Feedback,
) -> Result<MemoryId, LaserError>;
async fn forget(
&self,
scope: &MemoryScope,
id: MemoryId,
) -> Result<(), LaserError>;
// Provided method
fn append(
&self,
scope: &MemoryScope,
id: MemoryId,
kind: MemoryKind,
payload: Vec<u8>,
) -> impl Future<Output = Result<MemoryId, LaserError>>
where Self: Sync { ... }
}Expand description
Agent memory: remember / recall / improve / forget. (Memory is the
Send variant.)
Required Methods§
Sourceasync fn remember(
&self,
scope: &MemoryScope,
payload: Vec<u8>,
) -> Result<MemoryId, LaserError>
async fn remember( &self, scope: &MemoryScope, payload: Vec<u8>, ) -> Result<MemoryId, LaserError>
Append payload to the memory under scope. The body is opaque bytes,
so encode it with whatever codec you like before calling.
async fn recall( &self, scope: &MemoryScope, query: &MemoryQuery, ) -> Result<Vec<MemoryItem>, LaserError>
Sourceasync fn improve(
&self,
scope: &MemoryScope,
feedback: Feedback,
) -> Result<MemoryId, LaserError>
async fn improve( &self, scope: &MemoryScope, feedback: Feedback, ) -> Result<MemoryId, LaserError>
Record feedback on a recalled item, the log-native signal a ranking
backend folds into future recall. Returns the feedback record’s id.
async fn forget( &self, scope: &MemoryScope, id: MemoryId, ) -> Result<(), LaserError>
Provided Methods§
Sourcefn append(
&self,
scope: &MemoryScope,
id: MemoryId,
kind: MemoryKind,
payload: Vec<u8>,
) -> impl Future<Output = Result<MemoryId, LaserError>>where
Self: Sync,
fn append(
&self,
scope: &MemoryScope,
id: MemoryId,
kind: MemoryKind,
payload: Vec<u8>,
) -> impl Future<Output = Result<MemoryId, LaserError>>where
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".