pub struct ChatHistory { /* private fields */ }
Implementations§
Source§impl ChatHistory
impl ChatHistory
pub fn new(prompt_message: Option<String>) -> Self
pub fn add_initial_messages(&mut self, messages: Vec<ChatMessage>)
Sourcepub fn summary_needed(
&mut self,
summary_prompt: ChatMessage,
max_length: usize,
summarize_length: usize,
) -> Option<Vec<ChatMessage>>
pub fn summary_needed( &mut self, summary_prompt: ChatMessage, max_length: usize, summarize_length: usize, ) -> Option<Vec<ChatMessage>>
Remove messages to summarize the conversation if it is too long This is a naive implementation that just removes the oldest messages
pub fn add_message(&mut self, message: ChatMessage)
pub fn clear_history(&mut self)
pub fn get_history(&self) -> Vec<ChatMessage>
pub fn set_summary(&mut self, summary_message: String)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChatHistory
impl RefUnwindSafe for ChatHistory
impl Send for ChatHistory
impl Sync for ChatHistory
impl Unpin for ChatHistory
impl UnwindSafe for ChatHistory
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