#[non_exhaustive]pub enum Message {
Human {
id: Option<String>,
name: Option<String>,
content: MessageContent,
additional_kwargs: HashMap<String, Value>,
},
AI {
id: Option<String>,
name: Option<String>,
content: MessageContent,
tool_calls: Vec<ToolCall>,
invalid_tool_calls: Vec<InvalidToolCall>,
usage: Option<UsageMetadata>,
response_metadata: Option<HashMap<String, Value>>,
additional_kwargs: HashMap<String, Value>,
},
System {
id: Option<String>,
name: Option<String>,
content: MessageContent,
additional_kwargs: HashMap<String, Value>,
},
Tool {
id: Option<String>,
name: Option<String>,
content: MessageContent,
tool_call_id: String,
status: ToolStatus,
artifact: Option<Value>,
additional_kwargs: HashMap<String, Value>,
},
Chat {
id: Option<String>,
name: Option<String>,
role: String,
content: MessageContent,
additional_kwargs: HashMap<String, Value>,
},
}Expand description
A single unit of conversation.
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.
Human
A human message.
Fields
§
content: MessageContentMessage content.
AI
An AI message.
Fields
§
content: MessageContentMessage content.
§
invalid_tool_calls: Vec<InvalidToolCall>Invalid tool calls attempted by the model.
§
usage: Option<UsageMetadata>Token usage statistics.
System
A system message.
Fields
§
content: MessageContentMessage content.
Tool
A tool response message.
Chat
A generic chat message with custom role.
Implementations§
Source§impl Message
impl Message
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
Source§impl MessageLike for Message
impl MessageLike for Message
Source§fn to_message(&self) -> Message
fn to_message(&self) -> Message
Convert to a
Message.Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin 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