pub enum Message {
User {
name: Option<String>,
content: Vec<MessageContext>,
},
Tool {
tool_call_id: String,
content: Vec<MessageContext>,
},
Assistant {
name: Option<String>,
content: Vec<MessageContext>,
tool_calls: Option<Vec<FunctionCall>>,
},
System {
name: Option<String>,
content: String,
},
Developer {
name: Option<String>,
content: String,
},
}Expand description
Represents a prompt message with different roles.
This enum describes various types of messages used in prompts. It supports user messages, function messages, and assistant messages. Each variant holds the content of the message.
Variants§
User
A message sent by a user. should the name matches the pattern ‘^[a-zA-Z0-9_-]+$’.“
Tool
A message sent by a function, including its name.
Assistant
A message from the assistant. should the name matches the pattern ‘^[a-zA-Z0-9_-]+$’.“
System
A system prompt. should the name matches the pattern ‘^[a-zA-Z0-9_-]+$’.“
Developer
A message from the developer. Treated as a system message in unsupported models. should the name matches the pattern ‘^[a-zA-Z0-9_-]+$’.“
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Message
impl<'de> Deserialize<'de> for Message
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 Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
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