pub struct MemoryEntry {
pub id: String,
pub content: String,
pub embedding: Option<Vec<f32>>,
pub memory_type: MemoryType,
pub metadata: HashMap<String, Value>,
pub created_at: DateTime<Utc>,
pub last_accessed: Option<DateTime<Utc>>,
pub importance: f32,
pub access_count: u32,
}Expand description
Memory entry
Fields§
§id: StringUnique identifier
content: StringMemory content
embedding: Option<Vec<f32>>Embedding vector (for similarity search)
memory_type: MemoryTypeMemory type
metadata: HashMap<String, Value>Additional metadata
created_at: DateTime<Utc>Creation timestamp
last_accessed: Option<DateTime<Utc>>Last access timestamp
importance: f32Importance score (0.0 - 1.0)
access_count: u32Access count (for recency weighting)
Implementations§
Source§impl MemoryEntry
impl MemoryEntry
Sourcepub fn with_type(self, memory_type: MemoryType) -> Self
pub fn with_type(self, memory_type: MemoryType) -> Self
Set memory type
Sourcepub fn with_embedding(self, embedding: Vec<f32>) -> Self
pub fn with_embedding(self, embedding: Vec<f32>) -> Self
Set embedding
Sourcepub fn with_importance(self, importance: f32) -> Self
pub fn with_importance(self, importance: f32) -> Self
Set importance
Sourcepub fn with_metadata(self, key: impl Into<String>, value: Value) -> Self
pub fn with_metadata(self, key: impl Into<String>, value: Value) -> Self
Add metadata
Sourcepub fn record_access(&mut self)
pub fn record_access(&mut self)
Record access (updates access count and timestamp)
Sourcepub fn relevance_score(&self) -> f32
pub fn relevance_score(&self) -> f32
Calculate relevance score based on importance, recency, and access frequency
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 UnsafeUnpin 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