pub struct ConversationTokenBufferMemory { /* private fields */ }Expand description
Token-aware buffer memory that respects token limits
Implementations§
Source§impl ConversationTokenBufferMemory
impl ConversationTokenBufferMemory
Sourcepub fn with_config(
buffer_config: BufferMemoryConfig,
token_config: TokenBufferConfig,
) -> Self
pub fn with_config( buffer_config: BufferMemoryConfig, token_config: TokenBufferConfig, ) -> Self
Create a new token buffer memory with custom configuration
Trait Implementations§
Source§impl Memory for ConversationTokenBufferMemory
impl Memory for ConversationTokenBufferMemory
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 ConversationTokenBufferMemory
impl !RefUnwindSafe for ConversationTokenBufferMemory
impl Send for ConversationTokenBufferMemory
impl Sync for ConversationTokenBufferMemory
impl Unpin for ConversationTokenBufferMemory
impl !UnwindSafe for ConversationTokenBufferMemory
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