pub struct Conversation { /* private fields */ }Expand description
An ordered list of messages, the thing you actually send.
Thin on purpose: the value is in having one type both the front door and the tool loop can append to without arguing about ownership.
Implementations§
Source§impl Conversation
impl Conversation
pub fn new() -> Conversation
pub fn system(self, text: impl Into<String>) -> Conversation
pub fn user(self, text: impl Into<String>) -> Conversation
pub fn assistant(self, text: impl Into<String>) -> Conversation
pub fn push(&mut self, message: Message)
pub fn extend(&mut self, messages: impl IntoIterator<Item = Message>)
pub fn messages(&self) -> &[Message]
pub fn last(&self) -> Option<&Message>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn into_messages(self) -> Vec<Message>
Trait Implementations§
Source§impl Clone for Conversation
impl Clone for Conversation
Source§impl Debug for Conversation
impl Debug for Conversation
Source§impl Default for Conversation
impl Default for Conversation
Source§impl PartialEq for Conversation
impl PartialEq for Conversation
impl StructuralPartialEq for Conversation
Auto Trait Implementations§
impl Freeze for Conversation
impl RefUnwindSafe for Conversation
impl Send for Conversation
impl Sync for Conversation
impl Unpin for Conversation
impl UnsafeUnpin for Conversation
impl UnwindSafe for Conversation
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