pub struct ChatPrompt {
pub messages: Vec<Message>,
pub format: Format,
}
Expand description
Prompt
Fields§
§messages: Vec<Message>
Messages
format: Format
Requested output format
Implementations§
Source§impl ChatPrompt
impl ChatPrompt
Sourcepub fn message(self, role: Role, content: impl Into<String>) -> Self
pub fn message(self, role: Role, content: impl Into<String>) -> Self
Create a new message, from the given role and content.
Sourcepub fn message_opt(self, role: Role, content: Option<String>) -> Self
pub fn message_opt(self, role: Role, content: Option<String>) -> Self
Create a new message, from the given role and content. Ignore if content is null.
Sourcepub fn user(self, content: impl Into<String>) -> Self
pub fn user(self, content: impl Into<String>) -> Self
Create a new prompt, from the given string.
Sourcepub fn system_opt(self, content: Option<String>) -> Self
pub fn system_opt(self, content: Option<String>) -> Self
Set the system hint.
Sourcepub fn assistant_opt(self, content: Option<String>) -> Self
pub fn assistant_opt(self, content: Option<String>) -> Self
Set the system hint.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChatPrompt
impl RefUnwindSafe for ChatPrompt
impl Send for ChatPrompt
impl Sync for ChatPrompt
impl Unpin for ChatPrompt
impl UnwindSafe for ChatPrompt
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