pub struct ScopedMemory { /* private fields */ }Expand description
Memory as a pluggable memory system: per turn, injected recall and
the recall tool when the turn may read, the remember tool when it may
write, and run-end fact extraction unless writes are explicit only.
Each session reads and writes the scope its latest turn was given, so a host can map many sessions to one memory (the owner’s direct messages) and keep others apart (each group conversation).
use aidaemon_memory::{HashEmbedder, InMemoryMemoryStore, Memory, ScopedMemory};
let builder = Memory::builder(
std::sync::Arc::new(InMemoryMemoryStore::new()),
std::sync::Arc::new(HashEmbedder::default()),
);
let system = ScopedMemory::new(builder);Implementations§
Source§impl ScopedMemory
impl ScopedMemory
Sourcepub fn new(builder: MemoryBuilder) -> Self
pub fn new(builder: MemoryBuilder) -> Self
Builds the memory from builder, with a scope resolver that follows
the scope each session’s turn was given. Any resolver already set on
builder is replaced.
Sourcepub fn with_project_notes(self, notes: Arc<ProjectNotes>) -> Self
pub fn with_project_notes(self, notes: Arc<ProjectNotes>) -> Self
Show the project’s notes (see crate::project) on turns that work
in a project and may read memory. This system’s own memory is
unchanged: remember keeps writing to the turn’s scope.
Trait Implementations§
Source§impl Clone for ScopedMemory
impl Clone for ScopedMemory
Source§impl MemorySystem for ScopedMemory
impl MemorySystem for ScopedMemory
Source§fn turn<'life0, 'life1, 'async_trait>(
&'life0 self,
turn: &'life1 MemoryTurn,
) -> Pin<Box<dyn Future<Output = MemoryParts> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn turn<'life0, 'life1, 'async_trait>(
&'life0 self,
turn: &'life1 MemoryTurn,
) -> Pin<Box<dyn Future<Output = MemoryParts> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The hooks and tools this memory system adds to
turn.Source§fn guidance(&self) -> Option<String>
fn guidance(&self) -> Option<String>
Standing instructions for the model on how this memory system works.
Memory systems differ, so the host says nothing about remembering
except what this returns. It should not change between turns.
Source§fn absorb_history<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: &'life1 [PastMessage],
) -> Pin<Box<dyn Future<Output = Result<HistoryIntake, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn absorb_history<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: &'life1 [PastMessage],
) -> Pin<Box<dyn Future<Output = Result<HistoryIntake, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Learn from the host’s retained conversations, oldest first, in
batches. This is how a system starts out knowing what a previous one
knew: memory systems share no record format, but any of them can read
a conversation. The host resumes where the last batch ended.
Auto Trait Implementations§
impl !RefUnwindSafe for ScopedMemory
impl !UnwindSafe for ScopedMemory
impl Forget for ScopedMemory
impl Freeze for ScopedMemorywhere
*const ArcInner<Inner> is !null: Freeze,
PhantomData<ArcInner<Inner>>: Freeze,
*const ArcInner<RwLock<SessionScopes>> is !null: Freeze,
PhantomData<ArcInner<RwLock<SessionScopes>>>: Freeze,
*const ArcInner<ProjectNotes> is !null: Freeze,
PhantomData<ArcInner<ProjectNotes>>: Freeze,
impl Move for ScopedMemory
impl Send for ScopedMemory
impl Sync for ScopedMemory
impl Unpin for ScopedMemory
impl UnsafeUnpin for ScopedMemorywhere
*const ArcInner<Inner> is !null: UnsafeUnpin,
PhantomData<ArcInner<Inner>>: UnsafeUnpin,
*const ArcInner<RwLock<SessionScopes>> is !null: UnsafeUnpin,
PhantomData<ArcInner<RwLock<SessionScopes>>>: UnsafeUnpin,
*const ArcInner<ProjectNotes> is !null: UnsafeUnpin,
PhantomData<ArcInner<ProjectNotes>>: UnsafeUnpin,
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