pub struct ChatSession {
pub messages: Vec<ChatMessage>,
pub system_prompt: Option<String>,
}Fields§
§messages: Vec<ChatMessage>§system_prompt: Option<String>Implementations§
Source§impl ChatSession
impl ChatSession
pub fn new() -> Self
pub fn with_system_prompt(self, prompt: impl Into<String>) -> Self
pub fn add_message(&mut self, message: ChatMessage)
pub fn add_user_message(&mut self, content: impl Into<String>)
pub fn add_assistant_message(&mut self, content: impl Into<String>)
pub fn get_messages(&self) -> Vec<ChatMessage>
pub fn clear(&mut self)
Trait Implementations§
Source§impl Clone for ChatSession
impl Clone for ChatSession
Source§fn clone(&self) -> ChatSession
fn clone(&self) -> ChatSession
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ChatSession
impl Debug for ChatSession
Auto Trait Implementations§
impl Freeze for ChatSession
impl RefUnwindSafe for ChatSession
impl Send for ChatSession
impl Sync for ChatSession
impl Unpin for ChatSession
impl UnwindSafe for ChatSession
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