pub struct Message {
pub role: Role,
pub content: Option<String>,
pub name: Option<String>,
pub tool_call_id: Option<String>,
pub tool_calls: Option<Vec<ToolCall>>,
pub reasoning_content: Option<String>,
pub prefix: Option<bool>,
}Fields§
§role: Roledefault role is User
content: Option<String>content 在 assistant 消息可能为 null(仅 tool_calls 时)
name: Option<String>用于标识用户/函数名称(可选)
tool_call_id: Option<String>当 role = “tool” 时必须提供,关联之前的工具调用 ID
tool_calls: Option<Vec<ToolCall>>当 role = “assistant” 且模型请求调用工具时包含此字段
reasoning_content: Option<String>模型推理过程的内容(仅在响应中可能包含)
prefix: Option<bool>Beta 功能:设置此参数为 true,来强制模型在其回答中以此 assistant 消息中提供的前缀内容开始
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
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