pub struct EpisodicMemory {
pub config: HorizonConfig,
pub compressor: TemporalCompressor,
/* private fields */
}Expand description
Episodic memory store
Fields§
§config: HorizonConfigConfiguration
compressor: TemporalCompressorCompressor
Implementations§
Source§impl EpisodicMemory
impl EpisodicMemory
Sourcepub fn new(config: HorizonConfig) -> Self
pub fn new(config: HorizonConfig) -> Self
Create new episodic memory with config
Sourcepub fn by_importance(&self) -> Vec<(&Episode, f64)>
pub fn by_importance(&self) -> Vec<(&Episode, f64)>
Get episodes sorted by current importance
Sourcepub fn compress_old(&mut self) -> usize
pub fn compress_old(&mut self) -> usize
Compress old episodes (returns number compressed) - sync fallback using truncation
Sourcepub async fn compress_old_with_llm<L: LlmProvider + EmbeddingProvider>(
&mut self,
llm: &L,
vector_store: Option<&dyn VectorStoreBackend>,
tenant_id: Option<&str>,
) -> usize
pub async fn compress_old_with_llm<L: LlmProvider + EmbeddingProvider>( &mut self, llm: &L, vector_store: Option<&dyn VectorStoreBackend>, tenant_id: Option<&str>, ) -> usize
Compress old episodes using LLM for intelligent summarization Returns the number of episodes that were compressed
Sourcepub async fn summarize_all_with_llm<L: LlmProvider>(
&self,
llm: &L,
) -> Result<String, LlmError>
pub async fn summarize_all_with_llm<L: LlmProvider>( &self, llm: &L, ) -> Result<String, LlmError>
Summarize all episodes into a single context string using LLM Useful for providing memory context to agents
Trait Implementations§
Source§impl Clone for EpisodicMemory
impl Clone for EpisodicMemory
Source§fn clone(&self) -> EpisodicMemory
fn clone(&self) -> EpisodicMemory
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 moreSource§impl Debug for EpisodicMemory
impl Debug for EpisodicMemory
Auto Trait Implementations§
impl Freeze for EpisodicMemory
impl RefUnwindSafe for EpisodicMemory
impl Send for EpisodicMemory
impl Sync for EpisodicMemory
impl Unpin for EpisodicMemory
impl UnwindSafe for EpisodicMemory
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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