訊息
彙總聊天、工具呼叫和用量統計中常見物件。
訊息物件
| 欄位 | 類型 | 說明 |
|---|---|---|
role | string | 訊息角色 |
content | string/array | 文字或多模態內容 |
name | string | 可選名稱 |
tool_calls | array | assistant 發起的工具呼叫 |
tool_call_id | string | tool 訊息關聯的呼叫 ID |
內容片段
| 類型 | 說明 |
|---|---|
text | 文字輸入 |
image_url | 圖片 URL 或 base64 圖片 |
input_audio | 音訊輸入,包含 data 和 format |
file | 檔案輸入,取決於模型和頻道 |
多模態範例
json
{
"role": "user",
"content": [
{"type": "text", "text": "描述这张图片"},
{"type": "image_url", "image_url": {"url": "https://example.com/image.png"}}
]
}圖片、音訊和檔案的欄位格式不是所有模型都支援。呼叫前請確認模型能力、檔案大小和上游頻道限制。
