pub enum Message {
System {
content: MessageContent,
name: Option<String>,
},
User {
content: MessageContent,
name: Option<String>,
},
Assistant {
content: Option<String>,
audio: Option<AssistantAudio>,
refusal: Option<String>,
name: Option<String>,
prefix: bool,
reasoning_content: Option<String>,
tool_calls: Option<Vec<AssistantToolCall>>,
},
Tool {
content: MessageContent,
tool_call_id: String,
},
Function {
content: String,
name: String,
},
Developer {
content: MessageContent,
name: Option<String>,
},
}Variants§
System
In this case, the role of the message author is system.
The field { role = "system" } is added automatically.
Fields
content: MessageContentThe contents of the system message: plain text, or an array of text content parts.
User
In this case, the role of the message author is user.
The field { role = "user" } is added automatically.
Fields
content: MessageContentThe contents of the user message: plain text, or an array of
multimodal content parts (text, image_url, input_audio,
file).
Assistant
In this case, the role of the message author is assistant.
The field { role = "assistant" } is added automatically.
Fields
content: Option<String>The contents of the assistant message. Required unless tool_calls
or function_call is specified. (Note that function_call is deprecated
in favour of tool_calls.)
audio: Option<AssistantAudio>Data about a previous audio response from the model. Required for multi-turn audio conversations.
prefix: boolDeepSeek (Beta): set this to true to force the model to start its
answer by the content of the supplied prefix in this assistant
message. Requires base_url = "https://api.deepseek.com/beta".
reasoning_content: Option<String>DeepSeek (Beta): used for the thinking mode in the
Chat Prefix Completion
feature as the input for the CoT in the last assistant message.
When using this feature, prefix must be set to true.
tool_calls: Option<Vec<AssistantToolCall>>The tool calls generated by the model, such as function calls.
Tool
In this case, the role of the message author is assistant.
The field { role = "tool" } is added automatically.
Fields
content: MessageContentThe contents of the tool message: plain text, or an array of text content parts.
Function
In this case, the role of the message author is function.
The field { role = "function" } is added automatically.
Fields
Developer
In this case, the role of the message author is developer.
The field { role = "developer" } is added automatically.
Fields
content: MessageContentThe contents of the developer message: plain text, or an array of text content parts.