pub struct MemoryService { /* private fields */ }Expand description
High-level memory use-cases for Alice runtime integration.
Implementations§
Source§impl MemoryService
impl MemoryService
Sourcepub fn new(
store: Arc<dyn MemoryStorePort>,
recall_limit: usize,
weights: HybridWeights,
vector_dimensions: usize,
enable_vector: bool,
) -> Result<Self, MemoryServiceError>
pub fn new( store: Arc<dyn MemoryStorePort>, recall_limit: usize, weights: HybridWeights, vector_dimensions: usize, enable_vector: bool, ) -> Result<Self, MemoryServiceError>
Construct a memory service and initialize store schema.
Sourcepub fn recall_for_turn(
&self,
session_id: &str,
input: &str,
) -> Result<Vec<RecallHit>, MemoryServiceError>
pub fn recall_for_turn( &self, session_id: &str, input: &str, ) -> Result<Vec<RecallHit>, MemoryServiceError>
Recall memory hits relevant to current input.
Sourcepub fn render_recall_context(hits: &[RecallHit]) -> Option<String>
pub fn render_recall_context(hits: &[RecallHit]) -> Option<String>
Render recalled memory as prompt context.
Sourcepub fn persist_turn(
&self,
session_id: &str,
user_input: &str,
assistant_output: &str,
) -> Result<(), MemoryServiceError>
pub fn persist_turn( &self, session_id: &str, user_input: &str, assistant_output: &str, ) -> Result<(), MemoryServiceError>
Persist one turn as a memory entry.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MemoryService
impl !RefUnwindSafe for MemoryService
impl Send for MemoryService
impl Sync for MemoryService
impl Unpin for MemoryService
impl UnsafeUnpin for MemoryService
impl !UnwindSafe for MemoryService
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