pub struct ConversationBufferMemory { /* private fields */ }Expand description
Buffer memory - keeps recent messages in memory
Implementations§
Source§impl ConversationBufferMemory
impl ConversationBufferMemory
Sourcepub fn with_config(config: BufferMemoryConfig) -> Self
pub fn with_config(config: BufferMemoryConfig) -> Self
Create a new buffer memory with custom configuration
Trait Implementations§
Source§impl Default for ConversationBufferMemory
impl Default for ConversationBufferMemory
Source§impl Memory for ConversationBufferMemory
impl Memory for ConversationBufferMemory
Source§fn add_message<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
conversation_id: &'life1 str,
role: &'life2 str,
content: &'life3 str,
) -> Pin<Box<dyn Future<Output = RragResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn add_message<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
conversation_id: &'life1 str,
role: &'life2 str,
content: &'life3 str,
) -> Pin<Box<dyn Future<Output = RragResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Add a message to the conversation
Source§fn add_structured_message<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation_id: &'life1 str,
message: ConversationMessage,
) -> Pin<Box<dyn Future<Output = RragResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_structured_message<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation_id: &'life1 str,
message: ConversationMessage,
) -> Pin<Box<dyn Future<Output = RragResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Add a structured message
Source§fn get_conversation_history<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = RragResult<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_conversation_history<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = RragResult<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get conversation history
Source§fn get_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = RragResult<Vec<ConversationMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = RragResult<Vec<ConversationMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get structured conversation history
Source§fn get_recent_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation_id: &'life1 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = RragResult<Vec<ConversationMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_recent_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation_id: &'life1 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = RragResult<Vec<ConversationMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get recent messages with limit
Source§fn clear_conversation<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = RragResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn clear_conversation<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = RragResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Clear conversation history
Source§fn get_memory_variables<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = RragResult<HashMap<String, String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_memory_variables<'life0, 'life1, 'async_trait>(
&'life0 self,
conversation_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = RragResult<HashMap<String, String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get memory variables for prompt injection
Source§fn save_context<'life0, 'life1, 'async_trait>(
&'life0 self,
_conversation_id: &'life1 str,
_context: HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = RragResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_context<'life0, 'life1, 'async_trait>(
&'life0 self,
_conversation_id: &'life1 str,
_context: HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = RragResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Save arbitrary context
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = RragResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = RragResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Health check
Auto Trait Implementations§
impl Freeze for ConversationBufferMemory
impl !RefUnwindSafe for ConversationBufferMemory
impl Send for ConversationBufferMemory
impl Sync for ConversationBufferMemory
impl Unpin for ConversationBufferMemory
impl !UnwindSafe for ConversationBufferMemory
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