pub struct MemoryService { /* private fields */ }Expand description
High-level memory service that can switch between different memory types
Implementations§
Source§impl MemoryService
impl MemoryService
Sourcepub fn new(memory: Arc<dyn Memory>) -> Self
pub fn new(memory: Arc<dyn Memory>) -> Self
Create a new memory service with default configuration
Sourcepub fn with_config(memory: Arc<dyn Memory>, config: MemoryServiceConfig) -> Self
pub fn with_config(memory: Arc<dyn Memory>, config: MemoryServiceConfig) -> Self
Create a new memory service with custom configuration
Sourcepub async fn add_user_message(
&self,
conversation_id: &str,
content: &str,
) -> RragResult<()>
pub async fn add_user_message( &self, conversation_id: &str, content: &str, ) -> RragResult<()>
Add a user message
Sourcepub async fn add_assistant_message(
&self,
conversation_id: &str,
content: &str,
) -> RragResult<()>
pub async fn add_assistant_message( &self, conversation_id: &str, content: &str, ) -> RragResult<()>
Add an assistant message
Sourcepub async fn get_conversation_context(
&self,
conversation_id: &str,
) -> RragResult<String>
pub async fn get_conversation_context( &self, conversation_id: &str, ) -> RragResult<String>
Get formatted conversation for prompts
Sourcepub async fn get_prompt_variables(
&self,
conversation_id: &str,
) -> RragResult<HashMap<String, String>>
pub async fn get_prompt_variables( &self, conversation_id: &str, ) -> RragResult<HashMap<String, String>>
Get memory variables for prompt templates
Sourcepub async fn health_check(&self) -> RragResult<bool>
pub async fn health_check(&self) -> RragResult<bool>
Health check
Auto Trait Implementations§
impl Freeze for MemoryService
impl !RefUnwindSafe for MemoryService
impl Send for MemoryService
impl Sync for MemoryService
impl Unpin 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