pub struct ChatMessage {
pub role: MessageRole,
pub content: String,
pub reasoning: Option<String>,
pub name: Option<String>,
pub tool_calls: Option<Vec<ChatToolCall>>,
pub tool_call_id: Option<String>,
pub function_call: Option<ChatFunctionCall>,
}Expand description
Chat message
Fields§
§role: MessageRoleMessage role
content: StringMessage content. Accepts either a plain string or the OpenAI
“typed parts” array form ([{"type":"text","text":"..."}])
— both shapes deserialize into a single String. Non-text parts
fail deserialization so multimodal input is rejected instead of
silently dropped.
reasoning: Option<String>vLLM-compatible parsed reasoning text. When Ferrum parses
<think>...</think>, content contains only the final visible
answer and this field contains the reasoning block text.
Historical input also accepts reasoning_content. A string in
reasoning takes precedence, including an empty string; missing or
null reasoning falls back to the alias. Output uses only reasoning.
name: Option<String>Message name (for function calls)
tool_calls: Option<Vec<ChatToolCall>>Assistant tool calls.
tool_call_id: Option<String>Tool response correlation id.
function_call: Option<ChatFunctionCall>Legacy assistant function call.
Trait Implementations§
Source§impl Clone for ChatMessage
impl Clone for ChatMessage
Source§fn clone(&self) -> ChatMessage
fn clone(&self) -> ChatMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more