pub struct MemoryEntry {Show 14 fields
pub id: MemoryId,
pub content: String,
pub embedding: Option<Embedding>,
pub memory_type: MemoryType,
pub source: MemorySource,
pub importance: f32,
pub access_count: u64,
pub last_accessed: DateTime<Utc>,
pub created_at: DateTime<Utc>,
pub expires_at: Option<DateTime<Utc>>,
pub agent_id: Option<String>,
pub session_id: Option<String>,
pub metadata: HashMap<String, Value>,
pub tags: Vec<String>,
}Expand description
Memory entry representing a piece of stored knowledge
Fields§
§id: MemoryIdUnique identifier
content: StringThe content/text of this memory
embedding: Option<Embedding>Vector embedding for similarity search
memory_type: MemoryTypeMemory type classification
source: MemorySourceSource of this memory (conversation, document, user input, etc.)
importance: f32Importance score (0.0 - 1.0)
access_count: u64Access count for LRU caching
last_accessed: DateTime<Utc>Last accessed timestamp
created_at: DateTime<Utc>Creation timestamp
expires_at: Option<DateTime<Utc>>Optional expiration
agent_id: Option<String>Associated agent ID
session_id: Option<String>Associated session ID
metadata: HashMap<String, Value>Custom metadata
Tags for filtering
Implementations§
Source§impl MemoryEntry
impl MemoryEntry
Sourcepub fn new(
content: impl Into<String>,
memory_type: MemoryType,
source: MemorySource,
) -> Self
pub fn new( content: impl Into<String>, memory_type: MemoryType, source: MemorySource, ) -> Self
Create a new memory entry
Sourcepub fn with_embedding(self, embedding: Embedding) -> Self
pub fn with_embedding(self, embedding: Embedding) -> Self
Set the embedding
Sourcepub fn with_importance(self, importance: f32) -> Self
pub fn with_importance(self, importance: f32) -> Self
Set importance score
Sourcepub fn with_agent(self, agent_id: impl Into<String>) -> Self
pub fn with_agent(self, agent_id: impl Into<String>) -> Self
Set agent ID
Sourcepub fn with_session(self, session_id: impl Into<String>) -> Self
pub fn with_session(self, session_id: impl Into<String>) -> Self
Set session ID
Sourcepub fn expires_in(self, duration: Duration) -> Self
pub fn expires_in(self, duration: Duration) -> Self
Set expiration
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if expired
Trait Implementations§
Source§impl Clone for MemoryEntry
impl Clone for MemoryEntry
Source§fn clone(&self) -> MemoryEntry
fn clone(&self) -> MemoryEntry
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 MemoryEntry
impl Debug for MemoryEntry
Source§impl<'de> Deserialize<'de> for MemoryEntry
impl<'de> Deserialize<'de> for MemoryEntry
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
Auto Trait Implementations§
impl Freeze for MemoryEntry
impl RefUnwindSafe for MemoryEntry
impl Send for MemoryEntry
impl Sync for MemoryEntry
impl Unpin for MemoryEntry
impl UnwindSafe for MemoryEntry
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 more