pub struct MemoryManager { /* private fields */ }Expand description
记忆管理器
核心记忆管理组件,整合向量数据库、图数据库和各种记忆处理算法。
Implementations§
Source§impl MemoryManager
impl MemoryManager
Sourcepub async fn create_memory_from_request(
&self,
request: CreateMemoryRequest,
) -> Result<Memory>
pub async fn create_memory_from_request( &self, request: CreateMemoryRequest, ) -> Result<Memory>
创建新记忆(从请求)
Sourcepub async fn create_memory(&self, memory: &Memory) -> Result<()>
pub async fn create_memory(&self, memory: &Memory) -> Result<()>
创建新记忆(从Memory对象)
Sourcepub async fn retrieve_memories(
&self,
query: &Query,
context: &Context,
) -> Result<Vec<RetrievalResult>>
pub async fn retrieve_memories( &self, query: &Query, context: &Context, ) -> Result<Vec<RetrievalResult>>
检索记忆
Sourcepub async fn update_memory(
&self,
request: UpdateMemoryRequest,
) -> Result<Memory>
pub async fn update_memory( &self, request: UpdateMemoryRequest, ) -> Result<Memory>
更新记忆
Sourcepub async fn delete_memory(
&self,
memory_id: &MemoryId,
soft_delete: bool,
) -> Result<()>
pub async fn delete_memory( &self, memory_id: &MemoryId, soft_delete: bool, ) -> Result<()>
删除记忆
Sourcepub async fn evolve_memories(&self, trigger: EvolutionTrigger) -> Result<u64>
pub async fn evolve_memories(&self, trigger: EvolutionTrigger) -> Result<u64>
演化记忆
Sourcepub async fn get_stats(&self) -> MemoryStats
pub async fn get_stats(&self) -> MemoryStats
获取记忆统计信息
pub async fn generate_embedding(&self, text: &str) -> Result<Vec<f32>>
pub async fn create_connection(&self, connection: &Connection) -> Result<()>
Sourcepub async fn record_interaction(&self, interaction: &Interaction) -> Result<()>
pub async fn record_interaction(&self, interaction: &Interaction) -> Result<()>
记录用户交互
Sourcepub async fn get_connections(
&self,
memory_id: &MemoryId,
) -> Result<Vec<Connection>>
pub async fn get_connections( &self, memory_id: &MemoryId, ) -> Result<Vec<Connection>>
获取记忆的连接
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for MemoryManager
impl !UnwindSafe for MemoryManager
impl Freeze for MemoryManager
impl Send for MemoryManager
impl Sync for MemoryManager
impl Unpin for MemoryManager
impl UnsafeUnpin for MemoryManager
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
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> ⓘ
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