#[non_exhaustive]pub enum ChatRole {
System,
User,
Assistant,
Tool,
}Expand description
The role of a participant in a conversation.
Most conversations follow the pattern System → User → Assistant,
with ChatRole::Tool appearing only when the assistant invokes a
tool and the caller feeds back the result.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
System
Sets behavioral instructions for the assistant. Typically the
first message in a conversation; not all providers surface it as
a discrete message (some use a separate system parameter).
User
A message from the human user.
Assistant
A message generated by the model.
Tool
A tool result fed back to the model after it made a tool call.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ChatRole
impl<'de> Deserialize<'de> for ChatRole
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
impl Copy for ChatRole
impl Eq for ChatRole
impl StructuralPartialEq for ChatRole
Auto Trait Implementations§
impl Freeze for ChatRole
impl RefUnwindSafe for ChatRole
impl Send for ChatRole
impl Sync for ChatRole
impl Unpin for ChatRole
impl UnwindSafe for ChatRole
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.