pub struct ConversationBufferWindowMemory { /* private fields */ }Expand description
Implementations§
Source§impl ConversationBufferWindowMemory
impl ConversationBufferWindowMemory
Sourcepub fn new(k: usize) -> Self
pub fn new(k: usize) -> Self
Create new window memory
§Arguments
k- Keep last k rounds (each round includes user message and AI message)
Sourcepub fn with_input_key(self, key: impl Into<String>) -> Self
pub fn with_input_key(self, key: impl Into<String>) -> Self
Set input key name
Sourcepub fn with_output_key(self, key: impl Into<String>) -> Self
pub fn with_output_key(self, key: impl Into<String>) -> Self
Set output key name
Sourcepub fn with_memory_key(self, key: impl Into<String>) -> Self
pub fn with_memory_key(self, key: impl Into<String>) -> Self
Set memory variable name
Sourcepub fn with_return_messages(self, return_messages: bool) -> Self
pub fn with_return_messages(self, return_messages: bool) -> Self
Set whether to return message objects
Sourcepub fn chat_memory(&self) -> &ChatMessageHistory
pub fn chat_memory(&self) -> &ChatMessageHistory
Get chat history
Trait Implementations§
Source§impl BaseChatMemory for ConversationBufferWindowMemory
P0-1: ConversationBufferWindowMemory 实现 BaseChatMemory。
impl BaseChatMemory for ConversationBufferWindowMemory
P0-1: ConversationBufferWindowMemory 实现 BaseChatMemory。
Source§impl BaseMemory for ConversationBufferWindowMemory
impl BaseMemory for ConversationBufferWindowMemory
Source§fn load_memory_variables<'life0, 'life1, 'async_trait>(
&'life0 self,
_inputs: &'life1 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Value>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_memory_variables<'life0, 'life1, 'async_trait>(
&'life0 self,
_inputs: &'life1 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Value>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load memory variables Read more
Source§fn save_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
inputs: &'life1 HashMap<String, String>,
outputs: &'life2 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
inputs: &'life1 HashMap<String, String>,
outputs: &'life2 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Save context Read more
Auto Trait Implementations§
impl Freeze for ConversationBufferWindowMemory
impl RefUnwindSafe for ConversationBufferWindowMemory
impl Send for ConversationBufferWindowMemory
impl Sync for ConversationBufferWindowMemory
impl Unpin for ConversationBufferWindowMemory
impl UnsafeUnpin for ConversationBufferWindowMemory
impl UnwindSafe for ConversationBufferWindowMemory
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