pub struct MemoryContent {
pub entries: Vec<MemoryEntry>,
}Fields§
§entries: Vec<MemoryEntry>Implementations§
Source§impl MemoryContent
impl MemoryContent
pub fn parse(raw: &str) -> Self
pub fn serialize(&self) -> String
Sourcepub fn expire(&mut self, config: &MemoryExpiryConfig) -> usize
pub fn expire(&mut self, config: &MemoryExpiryConfig) -> usize
Remove entries older than the per-category thresholds defined in config.
Entries with no created_at date are never expired.
Returns the number of entries removed.
Sourcepub fn prefetch(&self, query: &str) -> Vec<&MemoryEntry>
pub fn prefetch(&self, query: &str) -> Vec<&MemoryEntry>
Keyword-match recall: entries whose content contains any significant word
from query. Tokens < 5 alphabetic chars and stop words are excluded to
reduce false positives. Returns at most Self::PREFETCH_LIMIT entries,
newest first.
Sourcepub fn prefetch_for_prompt(&self, query: &str) -> String
pub fn prefetch_for_prompt(&self, query: &str) -> String
Format prefetch hits as a compact block for injection into the user message. Returns empty string when no hits.
Sourcepub fn serialize_for_prompt(&self) -> String
pub fn serialize_for_prompt(&self) -> String
Grouped markdown for the system prompt, wrapped in <untrusted_memory> tags.
Trait Implementations§
Source§impl Clone for MemoryContent
impl Clone for MemoryContent
Source§fn clone(&self) -> MemoryContent
fn clone(&self) -> MemoryContent
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 MemoryContent
impl Debug for MemoryContent
Source§impl Default for MemoryContent
impl Default for MemoryContent
Source§fn default() -> MemoryContent
fn default() -> MemoryContent
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MemoryContent
impl RefUnwindSafe for MemoryContent
impl Send for MemoryContent
impl Sync for MemoryContent
impl Unpin for MemoryContent
impl UnsafeUnpin for MemoryContent
impl UnwindSafe for MemoryContent
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