pub struct Memory {
pub id: MemoryId,
pub content: String,
pub memory_type: MemoryType,
pub embedding: Vec<f32>,
pub attributes: MemoryAttributes,
pub connections: MemoryConnections,
pub metadata: MemoryMetadata,
}Expand description
记忆结构定义
表示系统中的一个记忆单元,包含内容、嵌入向量、属性、连接和元数据。
Fields§
§id: MemoryId唯一标识符
content: String记忆内容
memory_type: MemoryType记忆类型
embedding: Vec<f32>语义嵌入向量
attributes: MemoryAttributes记忆属性
connections: MemoryConnections记忆连接
metadata: MemoryMetadata元数据
Implementations§
Source§impl Memory
impl Memory
Sourcepub fn new(
content: String,
memory_type: MemoryType,
embedding: Vec<f32>,
attributes: MemoryAttributes,
) -> Self
pub fn new( content: String, memory_type: MemoryType, embedding: Vec<f32>, attributes: MemoryAttributes, ) -> Self
创建新的记忆
Sourcepub fn update_access(&mut self)
pub fn update_access(&mut self)
更新访问信息
Sourcepub fn matches_filters(&self, filters: &QueryFilters) -> bool
pub fn matches_filters(&self, filters: &QueryFilters) -> bool
检查是否匹配过滤器
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Memory
impl<'de> Deserialize<'de> for Memory
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Memory
Auto Trait Implementations§
impl Freeze for Memory
impl RefUnwindSafe for Memory
impl Send for Memory
impl Sync for Memory
impl Unpin for Memory
impl UnsafeUnpin for Memory
impl UnwindSafe 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
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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