pub struct Memory { /* private fields */ }Expand description
Long-term memory for AgentBuilder::memory: agent86’s SQLite memory
database (the same file and schema the CLI uses, so its sessions and facts are
shared), opened once and cheap to clone.
Implementations§
Source§impl Memory
impl Memory
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self, BuildError>
pub fn open(path: impl AsRef<Path>) -> Result<Self, BuildError>
Open (creating if needed) the database at path, embedding with the
offline hashing embedder (hash:256), which needs no model download.
Sourcepub fn open_with(
path: impl AsRef<Path>,
embedder: Arc<dyn Embedder>,
) -> Result<Self, BuildError>
pub fn open_with( path: impl AsRef<Path>, embedder: Arc<dyn Embedder>, ) -> Result<Self, BuildError>
Memory::open with another embedder, such as the sentence-transformers
model crate::memory::embeddings::build_embedder loads. Episodes and facts
written with one embedder are only found again with the same one.
Sourcepub fn in_memory() -> Result<Self, BuildError>
pub fn in_memory() -> Result<Self, BuildError>
A database that lives only as long as this value and its clones.
Sourcepub fn retention(self, episodes: i64, sessions: i64, max_age_days: f64) -> Self
pub fn retention(self, episodes: i64, sessions: i64, max_age_days: f64) -> Self
Keep at most episodes episodes and sessions sessions, and none older
than max_age_days (0 for no age limit), pruned when an agent is built
(1000, 500, and no age limit by default). Pinned entries are kept.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Memory
impl !UnwindSafe for Memory
impl Forget for Memory
impl Freeze for Memory
impl Move for Memory
impl Send for Memory
impl Sync for Memory
impl Unpin for Memory
impl UnsafeUnpin for Memory
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
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> ⓘ
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