pub struct ChatPrompt { /* private fields */ }Expand description
Prompt for a chat session
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.
Sourcepub fn template_context(self, key: String, value: impl Into<Value>) -> Self
pub fn template_context(self, key: String, value: impl Into<Value>) -> Self
Add to template context
Trait Implementations§
Source§impl Debug for ChatPrompt
impl Debug for ChatPrompt
Source§impl Default for ChatPrompt
impl Default for ChatPrompt
Source§impl<'de> Deserialize<'de> for ChatPrompt
impl<'de> Deserialize<'de> for ChatPrompt
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more