pub struct AdvancedMemoryManager { /* private fields */ }Expand description
Advanced Memory Manager
Orchestrates all memory subsystems:
- Working Memory: Recent context
- Episodic Memory: Past conversations
- Semantic Memory: Facts and knowledge
- Summarization: Automatic compression
- Consolidation: Background processing
Implementations§
Source§impl AdvancedMemoryManager
impl AdvancedMemoryManager
Sourcepub async fn new(
backend: Arc<dyn Memory>,
config: MemoryConfig,
) -> Result<Self, String>
pub async fn new( backend: Arc<dyn Memory>, config: MemoryConfig, ) -> Result<Self, String>
Create a new advanced memory manager
Sourcepub async fn store_conversation(
&self,
entry: MemoryEntry,
) -> Result<String, String>
pub async fn store_conversation( &self, entry: MemoryEntry, ) -> Result<String, String>
Store a new conversation
Sourcepub async fn get(&self, id: &str) -> Result<Option<EnhancedMemoryEntry>, String>
pub async fn get(&self, id: &str) -> Result<Option<EnhancedMemoryEntry>, String>
Retrieve a memory by ID
Sourcepub async fn get_working_memory(
&self,
max_tokens: Option<usize>,
) -> Vec<EnhancedMemoryEntry>
pub async fn get_working_memory( &self, max_tokens: Option<usize>, ) -> Vec<EnhancedMemoryEntry>
Get recent working memory
Sourcepub async fn get_episodic_by_time(
&self,
agent_id: &str,
range: TimeRange,
) -> Result<Vec<EnhancedMemoryEntry>, String>
pub async fn get_episodic_by_time( &self, agent_id: &str, range: TimeRange, ) -> Result<Vec<EnhancedMemoryEntry>, String>
Get episodic memories by time range
Sourcepub async fn get_relevant_memories(
&self,
agent_id: &str,
min_score: f32,
limit: usize,
) -> Result<Vec<EnhancedMemoryEntry>, String>
pub async fn get_relevant_memories( &self, agent_id: &str, min_score: f32, limit: usize, ) -> Result<Vec<EnhancedMemoryEntry>, String>
Get relevant memories by score
Sourcepub async fn search(
&self,
agent_id: &str,
query: &str,
) -> Result<Vec<EnhancedMemoryEntry>, String>
pub async fn search( &self, agent_id: &str, query: &str, ) -> Result<Vec<EnhancedMemoryEntry>, String>
Search memories
Sourcepub async fn get_knowledge(&self, entity_name: &str) -> Option<KnowledgeSummary>
pub async fn get_knowledge(&self, entity_name: &str) -> Option<KnowledgeSummary>
Get knowledge about an entity
Sourcepub async fn get_facts_about(&self, subject: &str) -> Vec<Fact>
pub async fn get_facts_about(&self, subject: &str) -> Vec<Fact>
Get all facts about a subject
Sourcepub async fn get_semantic_stats(&self) -> SemanticMemoryStats
pub async fn get_semantic_stats(&self) -> SemanticMemoryStats
Get semantic memory statistics
Sourcepub async fn create_agent_context(
&self,
agent_id: &str,
max_tokens: Option<usize>,
include_semantic: bool,
) -> Result<String, String>
pub async fn create_agent_context( &self, agent_id: &str, max_tokens: Option<usize>, include_semantic: bool, ) -> Result<String, String>
Create a comprehensive context message for the agent
Sourcepub async fn consolidate(
&self,
task: ConsolidationTask,
) -> Result<ConsolidationResult, String>
pub async fn consolidate( &self, task: ConsolidationTask, ) -> Result<ConsolidationResult, String>
Run consolidation tasks
Sourcepub async fn start_background_processing(&self)
pub async fn start_background_processing(&self)
Start background consolidation
Sourcepub async fn stop_background_processing(&self)
pub async fn stop_background_processing(&self)
Stop background consolidation
Sourcepub async fn get_statistics(&self) -> MemoryStatistics
pub async fn get_statistics(&self) -> MemoryStatistics
Get statistics about memory usage
Trait Implementations§
Source§impl Memory for AdvancedMemoryManager
Implement the base Memory trait for compatibility
impl Memory for AdvancedMemoryManager
Implement the base Memory trait for compatibility
Source§fn store<'life0, 'async_trait>(
&'life0 self,
entry: MemoryEntry,
) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store<'life0, 'async_trait>(
&'life0 self,
entry: MemoryEntry,
) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stores a conversation in memory.
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<MemoryEntry>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<MemoryEntry>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves a specific conversation by ID.
Source§fn get_agent_history<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_agent_history<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves all conversations for an agent.
Source§fn get_recent<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: &'life1 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_recent<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: &'life1 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves the most recent N conversations for an agent.
Source§fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
agent_id: &'life1 str,
query: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
agent_id: &'life1 str,
query: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Searches conversations for a query string.
Auto Trait Implementations§
impl Freeze for AdvancedMemoryManager
impl !RefUnwindSafe for AdvancedMemoryManager
impl Send for AdvancedMemoryManager
impl Sync for AdvancedMemoryManager
impl Unpin for AdvancedMemoryManager
impl !UnwindSafe for AdvancedMemoryManager
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> 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