pub struct MemoryStack { /* private fields */ }Expand description
Full 4-layer memory stack.
Implementations§
Source§impl MemoryStack
impl MemoryStack
pub fn new(db: AimemDb, embedder: Arc<dyn Embedder>, cfg: &Config) -> Self
Sourcepub async fn wake_up(&self, wing: Option<&str>) -> Result<String, LayerError>
pub async fn wake_up(&self, wing: Option<&str>) -> Result<String, LayerError>
Generate wake-up context: L0 (identity) + L1 (essential story). ~600-900 tokens total. Inject into system prompt or first message.
Sourcepub async fn recall(
&self,
wing: Option<&str>,
room: Option<&str>,
) -> Result<String, LayerError>
pub async fn recall( &self, wing: Option<&str>, room: Option<&str>, ) -> Result<String, LayerError>
On-demand L2 retrieval filtered by wing/room.
Sourcepub async fn search(
&self,
query: &str,
wing: Option<&str>,
room: Option<&str>,
) -> Result<String, LayerError>
pub async fn search( &self, query: &str, wing: Option<&str>, room: Option<&str>, ) -> Result<String, LayerError>
Deep L3 semantic search.
Sourcepub async fn file_drawer(
&self,
wing: &str,
room: &str,
content: String,
parts: Vec<ContentPart>,
agent: &str,
) -> Result<String, LayerError>
pub async fn file_drawer( &self, wing: &str, room: &str, content: String, parts: Vec<ContentPart>, agent: &str, ) -> Result<String, LayerError>
File a new memory (drawer) into the L1-L3 store. This handles embedding generation and DB insertion automatically.
Sourcepub async fn file_text(
&self,
wing: &str,
room: &str,
content: impl Into<String>,
agent: &str,
) -> Result<String, LayerError>
pub async fn file_text( &self, wing: &str, room: &str, content: impl Into<String>, agent: &str, ) -> Result<String, LayerError>
File a plain-text memory without manually constructing a parts vector.
Sourcepub async fn status(&self) -> Result<Value, LayerError>
pub async fn status(&self) -> Result<Value, LayerError>
Status of the whole stack.
Trait Implementations§
Source§impl Clone for MemoryStack
impl Clone for MemoryStack
Source§fn clone(&self) -> MemoryStack
fn clone(&self) -> MemoryStack
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MemoryStack
impl !RefUnwindSafe for MemoryStack
impl Send for MemoryStack
impl Sync for MemoryStack
impl Unpin for MemoryStack
impl UnsafeUnpin for MemoryStack
impl !UnwindSafe for MemoryStack
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more