pub struct Message {
pub role: Option<String>,
pub content: Option<Value>,
pub reasoning_content: Option<String>,
pub audio: Option<AudioContent>,
pub tool_calls: Option<Vec<ToolCallMessage>>,
}Expand description
Notes:
- Depending on the model/mode, only one of
content,audio, ortool_callsmay be set. - Prefer
contentfor final text;reasoning_contentmay contain internal traces (when available).
Assistant message payload
Fields§
§role: Option<String>Role of the message, defaults to “assistant”
content: Option<Value>Current dialog content.
If function/tool calling is used, this may be null; otherwise contains
the inference result. For some models, content may include thinking
traces within <think> tags, with final output outside.
reasoning_content: Option<String>Reasoning chain content (only for specific models)
audio: Option<AudioContent>Audio payload for voice models (glm-4-voice)
tool_calls: Option<Vec<ToolCallMessage>>Generated tool/function calls
Implementations§
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<'v_a> ValidateArgs<'v_a> for Message
impl<'v_a> ValidateArgs<'v_a> for 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