pub struct MemoryItem {
pub key: String,
pub value: MemoryValue,
pub score: f32,
pub metadata: HashMap<String, String>,
pub created_at: u64,
pub last_accessed: u64,
}Expand description
记忆项 (搜索结果)
Fields§
§key: String记忆键
value: MemoryValue记忆值
score: f32相似度分数 (0.0 - 1.0)
metadata: HashMap<String, String>元数据
created_at: u64创建时间
last_accessed: u64最后访问时间
Implementations§
Source§impl MemoryItem
impl MemoryItem
Sourcepub fn new(key: impl Into<String>, value: MemoryValue) -> MemoryItem
pub fn new(key: impl Into<String>, value: MemoryValue) -> MemoryItem
创建新的记忆项
Sourcepub fn with_score(self, score: f32) -> MemoryItem
pub fn with_score(self, score: f32) -> MemoryItem
设置分数
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> MemoryItem
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> MemoryItem
添加元数据
Trait Implementations§
Source§impl Clone for MemoryItem
impl Clone for MemoryItem
Source§fn clone(&self) -> MemoryItem
fn clone(&self) -> MemoryItem
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 MemoryItem
impl Debug for MemoryItem
Source§impl<'de> Deserialize<'de> for MemoryItem
impl<'de> Deserialize<'de> for MemoryItem
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MemoryItem, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MemoryItem, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for MemoryItem
impl Serialize for MemoryItem
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for MemoryItem
impl RefUnwindSafe for MemoryItem
impl Send for MemoryItem
impl Sync for MemoryItem
impl Unpin for MemoryItem
impl UnsafeUnpin for MemoryItem
impl UnwindSafe for MemoryItem
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,
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 moreSource§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage