相關文檔:即時(Qwen-Omni-Realtime)。
error
服務端返回的錯誤資訊。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_RoUu4T8yExPMI37GKwaOC",
"type": "error",
"error": {
"type": "invalid_request_error",
"code": "invalid_value",
"message": "Invalid modalities: ['audio']. Supported combinations are: ['text'] and ['audio', 'text'].",
"param": "session.modalities"
}
}
|
|
type string
事件類型,固定為error。
|
|
error object
錯誤的詳細資料。
屬性
param string
與錯誤相關的參數,如session.modalities。
|
session.created
用戶端串連後,服務端返回的第一個事件,包含本次串連的預設配置資訊。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_RdvlSpbBb2ssyBjYrDHjt",
"type": "session.created",
"session": {
"object": "realtime.session",
"model": "qwen3-omni-flash-realtime",
"modalities": [
"text",
"audio"
],
"voice": "Cherry",
"input_audio_format": "pcm",
"output_audio_format": "pcm",
"input_audio_transcription": {
"model": "qwen3-asr-flash-realtime"
},
"turn_detection": {
// 取值為server_vad或semantic_vad(僅qwen3.5-omni-realtime支援)
"type": "server_vad",
"threshold": 0.5,
"prefix_padding_ms": 300,
"silence_duration_ms": 800,
"create_response": true,
"interrupt_response": true
},
"enable_search": false,
"search_options": {},
"tools": [],
"temperature": 0.8,
"id": "sess_Ov7GOXoNXhNjlxXtOGKQS"
}
}
|
|
type string
事件類型,固定為session.created。
|
|
session object
會話的配置資訊。
屬性
object string
固定為realtime.session。
modalities array
模型輸出模態設定。
input_audio_format string
使用者輸入音訊格式,當前僅支援設為pcm。輸入音頻要求為16 kHz採樣率的PCM音頻流。
output_audio_format string
模型輸出音訊格式,當前僅支援設為pcm。輸出音頻為24 kHz採樣率的PCM音頻流。當前不支援自訂輸出採樣率。
input_audio_transcription object
語音轉錄的配置。
屬性
model string
語音轉錄模型,固定為qwen3-asr-flash-realtime,不支援修改。
turn_detection object
語音活動檢測(VAD)的配置。
屬性
type string
VAD類型。取值:server_vad(預設值)或 semantic_vad。詳情請參見用戶端事件。
silence_duration_ms integer
檢測語音停止的靜音期間。
idle_timeout_ms integer
靜默逾時時間(毫秒)。僅在 server_vad 模式下,使用 qwen3.5-omni-plus-realtime 或 qwen3.5-omni-flash-realtime 模型時返回。
enable_search boolean
是否啟用連網搜尋功能。僅 Qwen3.5-Omni-Realtime 模型支援。
search_options object
連網搜尋選項配置。
temperature float
模型的溫度參數。
|
session.updated
收到使用者的 session.update 請求後,若處理成功,則返回此事件;若出錯,則返回 error 事件。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_X1HsXS4b4uptp6yo1LgKd",
"type": "session.updated",
"session": {
"id": "sess_Aih6vAcY5Ddt6jwFx1tCa",
"object": "realtime.session",
"model": "qwen3-omni-flash-realtime",
"modalities": [
"text",
"audio"
],
"instructions": "你是個人助理小雲,請你準確且友好地解答使用者的問題,始終以樂於助人的態度回應。",
"voice": "Cherry",
"input_audio_format": "pcm",
"output_audio_format": "pcm",
"input_audio_transcription": {
"model": "qwen3-asr-flash-realtime"
},
"turn_detection": {
// 取值為server_vad或semantic_vad(僅qwen3.5-omni-realtime支援)
"type": "server_vad",
"threshold": 0.1,
"prefix_padding_ms": 500,
"silence_duration_ms": 900,
"create_response": true,
"interrupt_response": true
},
"enable_search": true,
"search_options": {
"enable_source": true
},
"tools": [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "當你想查詢指定城市的天氣時非常有用。",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "城市名稱"}
},
"required": ["location"]
}
}
}
],
"temperature": 0.8,
"max_response_output_token": "inf",
"max_tokens": 16384,
"repetition_penalty": 1.05,
"presence_penalty": 0.0,
"top_k": 50,
"top_p": 1.0,
"seed":-1
}
}
|
|
type string
事件類型,固定為session.updated。
|
|
session object
會話的配置資訊。
屬性
temperature float
模型的溫度參數。
modalities array
模型輸出模態設定。
instructions string
模型的目標與角色。
input_audio_format string
使用者輸入音訊格式,當前僅支援設為pcm。輸入音頻要求為16 kHz採樣率的PCM音頻流。
output_audio_format string
模型輸出音訊格式,當前僅支援設為pcm。輸出音頻為24 kHz採樣率的PCM音頻流。當前不支援自訂輸出採樣率。
input_audio_transcription object
語音轉錄的配置。
屬性
model string
語音轉錄模型,固定為qwen3-asr-flash-realtime,不支援修改。
turn_detection object
語音活動檢測(VAD)的配置。
屬性
type string
VAD類型。取值:server_vad(預設值)或 semantic_vad。詳情請參見用戶端事件。
silence_duration_ms integer
檢測語音停止的靜音期間。
idle_timeout_ms integer
靜默逾時時間(毫秒)。僅在 server_vad 模式下,使用 qwen3.5-omni-plus-realtime 或 qwen3.5-omni-flash-realtime 模型時返回。
enable_search boolean(可選)
是否啟用連網搜尋功能。僅 Qwen3.5-Omni-Realtime 模型支援。
search_options object(可選)
連網搜尋選項配置。
top_k integer
模型產生過程中,採樣候選集的大小。
max_tokens integer
模型在本次請求返回的最大 Token 數。
repetition_penalty float
控制模型產生時,連續序列中的重複度。
presence_penalty float
控制模型在產生內容時的重複度。
seed integer
模型在每次請求時,運行結果一致性程度。
|
input_audio_buffer.speech_started
在 VAD 模式下,當服務端在音頻緩衝區中檢測到語音開始時,會返回此事件。
若服務端尚未檢測到語音,則每次向緩衝區添加音頻時都可能觸發此事件。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_Pvp8nEhsQuGCQbFJ9x58n",
"type": "input_audio_buffer.speech_started",
"audio_start_ms": 3647,
"item_id": "item_YbAiGvK2H7YaS34o4R6Ba"
}
|
|
type string
事件類型,固定為input_audio_buffer.speech_started。
|
|
audio_start_ms integer
從音頻開始寫入緩衝區到首次檢測到語音所經過的毫秒數。
|
|
item_id string
語音停止時將建立的使用者訊息項的 ID。
使用者訊息項用於將使用者輸入追加到對話歷史,供模型後續推理與產生使用。
|
input_audio_buffer.speech_stopped
在 VAD 模式下,當音頻緩衝區中檢測到語音結束時,服務端會返回此事件。
同時,服務端還會返回一個 conversation.item.created 事件,以建立對應的使用者訊息項。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_UhQiqNVRsgUiq4KUS5Xb5",
"type": "input_audio_buffer.speech_stopped",
"audio_end_ms": 4453,
"item_id": "item_YbAiGvK2H7YaS34o4R6Ba"
}
|
|
type string
事件類型,固定為input_audio_buffer.speech_stopped。
|
|
audio_end_ms integer
語音停止時刻距會話開始經過的毫秒數。
|
|
item_id string
將建立的使用者訊息項的 ID。
|
input_audio_buffer.committed
當輸入音頻緩衝區被提交時返回此事件。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_Iy6sUzL1nmdFgshFYxJEz",
"type": "input_audio_buffer.committed",
"item_id": "item_YbAiGvK2H7YaS34o4R6Ba"
}
|
|
type string
事件類型,固定為input_audio_buffer.committed。
|
|
item_id string
將建立的使用者訊息項的 ID。
|
input_audio_buffer.cleared
用戶端發送input_audio_buffer.clear事件後,服務端將返回此事件。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_RoUu4T8yExPMI37GKwaOC",
"type": "input_audio_buffer.cleared"
}
|
|
type string
事件類型,固定為input_audio_buffer.cleared。
|
conversation.item.created
當對話項建立時返回此事件。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_JEfkrr9gO3Ny7Xcv9bGVd",
"type": "conversation.item.created",
"item": {
"id": "item_YbAiGvK2H7YaS34o4R6Ba",
"object": "realtime.item",
"type": "message",
"status": "in_progress",
"role": "assistant",
"content": [
{
"type": "input_audio"
}
]
}
}
// 工具調用情境
{
"event_id": "event_S1hkaIQgcuQD8OEdOpGHQ",
"type": "conversation.item.created",
"item": {
"id": "item_FEG9qJGNkPcdf4et3p7BV",
"object": "realtime.item",
"type": "function_call",
"status": "in_progress",
"call_id": "call_bc0a7fb7235840f69ecfe4",
"name": "get_current_weather",
"arguments": ""
}
}
|
|
type string
事件類型,固定為conversation.item.created。
|
|
item object
要添加到對話中的項。
屬性
object string
始終為 realtime.item 。
content string
訊息的內容。當 type 為 message 時存在。
type string
對話項的類型。可選值為 message(常規訊息)或 function_call(工具調用)。
name string
當 type 為 function_call 時,被調用的函數名稱。
call_id string
當 type 為 function_call 時,本次函數調用的唯一 ID。
arguments string
當 type 為 function_call 時,函數調用的參數(JSON 字串)。
|
conversation.item.input_audio_transcription.delta
開啟輸入音頻轉錄後,此事件會在使用者說話過程中高頻發送,用於展示即時識別的中間結果。您可以通過拼接 text + stash 擷取當前最完整的句子預覽。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_C7jzoeSFuiwOZS6tR14yx",
"type": "conversation.item.input_audio_transcription.delta",
"item_id": "item_ThVYhLHOdeXb4bBSvzSFF",
"content_index": 0,
"text": "",
"stash": "今天天氣怎麼樣?",
"language": "zh",
"emotion": "neutral",
"obfuscation": "ABEXGYmxdmc97u"
}
在任何時刻,要擷取當前最完整的句子預覽,都需要將這兩個欄位拼接起來:即時預覽句子 = text + stash。
點擊查看樣本
假設使用者正在說:"今天天氣不錯,陽光明媚。"
以下是您可能會收到的事件流以及如何解讀它們:
|
時間點
|
使用者說話進度
|
API 響應 (text 和 stash)
|
用戶端 UI 應顯示 (text + stash)
|
|
T1
|
"今天……"
|
text: ""
stash: "今天"
|
今天
|
|
T2
|
"……天氣……"
|
text: ""
stash: "今天天氣"
|
今天天氣
|
|
T3
|
"……不錯"
|
text: "今天"
stash: "天氣不錯"
|
今天天氣不錯
(注意,"今天"已被確認並移入text)
|
|
T4
|
(短暫停頓)
|
text: "今天天氣不錯,"
stash: ""
|
今天天氣不錯,
(前半句完全確認)
|
|
T5
|
"……陽光……"
|
text: "今天天氣不錯,"
stash: "陽光"
|
今天天氣不錯,陽光
|
|
T6
|
"……明媚。"
|
text: "今天天氣不錯,"
stash: "陽光明媚。"
|
今天天氣不錯,陽光明媚。
|
|
T7
|
(結束說話)
|
-
|
使用 conversation.item.input_audio_transcription.completed 的 transcript 內容作為最終結果。
|
|
|
type string
事件類型,固定為conversation.item.input_audio_transcription.delta。
|
|
item_id string
關聯的對話項 ID。
|
|
content_index integer
包含音訊內容部分的索引。
|
|
text string
已確認的文本首碼。這是當前句子中,模型已確認不會再變更的部分。
|
|
stash string
預識別的文本尾碼。這是緊跟在已確認部分之後,模型仍在處理、可能會被修正的臨時草稿。
|
|
language string
被識別音訊語種。
|
|
emotion string
被識別音訊情感。可選值:neutral(平靜)、happy(愉快)、sad(悲傷)、angry(憤怒)、surprised(驚訝)、disgusted(厭惡)、fearful(恐懼)。
|
conversation.item.input_audio_transcription.completed
此事件表示使用者音頻寫入緩衝區後產生的轉錄結果。其轉錄由內建的語音辨識模型(固定為 qwen3-asr-flash-realtime)處理,不支援修改。
語音辨識模型產生的轉錄文本可能與 Qwen-Omni-Realtime 模型的理解存在差異,僅供參考。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_FrrZcxiDfTB9LD9p4pVng",
"type": "conversation.item.input_audio_transcription.completed",
"item_id": "item_YbAiGvK2H7YaS34o4R6Ba",
"content_index": 0,
"transcript": "喂,你好。"
}
|
|
type string
事件類型,固定為conversation.item.input_audio_transcription.completed。
|
|
item_id string
使用者訊息項的 ID。
|
|
content_index integer
當前固定為0。
|
|
transcript string
轉錄的常值內容。
|
conversation.item.input_audio_transcription.failed
啟用輸入音頻轉錄後,若使用者音頻轉錄失敗,服務端會返回此事件。此事件獨立於 error 事件,便於用戶端識別。
|
event_id string
本次事件唯一識別碼。
|
{
"type": "conversation.item.input_audio_transcription.failed",
"item_id": "<item_id>",
"content_index": 0,
"error": {
"code": "<code>",
"message": "<message>",
"param": "<param>"
}
}
|
|
type string
事件類型,固定為conversation.item.input_audio_transcription.failed。
|
|
item_id string
使用者訊息項的 ID。
|
|
content_index integer
當前固定為0。
|
|
error object
錯誤資訊。
|
response.created
當服務端產生新的模型響應時,會返回此事件。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_XuDavMzQN3KKepqGu3KRh",
"type": "response.created",
"response": {
"id": "resp_HaVOPdbmX6vifiV5pAfJY",
"object": "realtime.response",
"conversation_id": "conv_FjJaccpnvwHNo9cPVuzGc",
"status": "in_progress",
"modalities": [
"text",
"audio"
],
"voice": "Cherry",
"output_audio_format": "pcm",
"output": []
}
}
|
|
type string
事件類型,固定為response.created。
|
|
response object
響應對象。
屬性
conversation_id string
當前會話的唯一ID。
object string
物件類型,此事件下固定為realtime.response。
status string
響應的狀態。在[completed, failed, in_progress, or incomplete]範圍內。
|
response.done
響應產生完成後,服務端會返回此事件。事件中的 response 對象包含除原始音頻資料外的全部輸出項。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_CSaxRRYLvbrfexDXAEuDG",
"type": "response.done",
"response": {
"id": "resp_HaVOPdbmX6vifiV5pAfJY",
"object": "realtime.response",
"conversation_id": "conv_FjJaccpnvwHNo9cPVuzGc",
"status": "completed",
"modalities": [
"text",
"audio"
],
"voice": "Cherry",
"output_audio_format": "pcm",
"output": [
{
"id": "item_Ls6MtCUWO7LM4E59QziNv",
"object": "realtime.item",
"type": "message",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "audio",
"transcript": "你好呀!有什麼我可以幫你的嗎?"
}
]
}
],
"usage": {
"total_tokens": 377,
"input_tokens": 336,
"output_tokens": 41,
"input_tokens_details": {
"text_tokens": 228,
"audio_tokens": 108
},
"output_tokens_details": {
"text_tokens": 9,
"audio_tokens": 32
},
"plugins": {
"search": {
"count": 1,
"strategy": "agent"
}
}
}
}
}
// 工具調用情境
{
"event_id": "event_T1EFAJp43X2DWtDRmxTtx",
"type": "response.done",
"response": {
"id": "resp_TucN5QgymL5MA8vkJvFlS",
"object": "realtime.response",
"conversation_id": "conv_SEDZESRlefT8WvLSmEn6E",
"status": "completed",
"modalities": ["text", "audio"],
"voice": "Ethan",
"output_audio_format": "pcm",
"output": [
{
"id": "item_FEG9qJGNkPcdf4et3p7BV",
"object": "realtime.item",
"type": "function_call",
"status": "completed",
"call_id": "call_bc0a7fb7235840f69ecfe4",
"name": "get_current_weather",
"arguments": " {\"location\": \"杭州\"}"
}
],
"usage": {
"total_tokens": 567,
"input_tokens": 524,
"output_tokens": 43,
"input_tokens_details": {
"text_tokens": 487,
"audio_tokens": 37
},
"output_tokens_details": {
"text_tokens": 43
}
}
}
}
|
|
type string
事件類型,固定為response.done。
|
|
response object
響應對象。
屬性
conversation_id string
當前會話的唯一ID。
object string
物件類型,此事件下固定為realtime.response。
output object
響應的輸出。
屬性
type string
輸出項的類型,可選值為 message(常規訊息)或 function_call(工具調用)。
object string
輸出項的物件類型,當前固定為realtime.item。
content array
輸出項的內容。當 type 為 message 時存在。
屬性
type string
輸出內容的類型。輸出為純文字時,為text;輸出包含音頻時,為audio。
transcript string
音頻轉錄為文字後的內容。
name string
當 type 為 function_call 時,被調用的函數名稱。
call_id string
當 type 為 function_call 時,函數調用的唯一 ID。
arguments string
當 type 為 function_call 時,函數調用的完整參數(JSON 字串)。
usage object
本次響應的 Token 消耗資訊。
屬性
total_tokens integer
本次響應消耗的總 Token 數。
input_tokens integer
輸入 Token 數。
output_tokens integer
輸出 Token 數。
input_tokens_details object
輸入 Token 的分項詳情,包含 text_tokens(文本 Token 數)和 audio_tokens(音頻 Token 數)。
output_tokens_details object
輸出 Token 的分項詳情,包含 text_tokens(文本 Token 數)和 audio_tokens(音頻 Token 數)。
plugins object(可選)
外掛程式使用計量資訊。啟用連網搜尋(enable_search)時返回。
|
response.text.delta
當輸出模態僅包含文本,且模型增量產生新的文本時,服務端將返回此事件。
|
event_id string
本次事件唯一識別碼。
|
{
"delta": "喂",
"event_id": "event_TH49MauuPmRo1RGaMSlP7",
"type": "response.text.delta",
"response_id": "resp_PrRSvPVpnCExdUOGHHLuP",
"item_id": "item_L8IRm9kRXFpxoOjDqDC96",
"output_index": 0,
"content_index": 0
}
|
|
type string
事件類型,固定為response.text.delta。
|
|
delta string
返回的增量文本。
|
|
response_id string
回複的ID。
|
|
item_id string
訊息項ID,可以關聯同一個訊息項。
|
|
output_index integer
響應中輸出項的索引, 目前固定為 0。
|
|
content_index integer
響應中輸出項中內部部分的索引, 目前固定為 0。
|
response.text.done
當輸出模態僅包含文本,且模型產生的文本結束時,服務端將返回此事件。
當響應中斷、不完整或取消時,也會返回此事件。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_B1lIeE2Nac33zn5V7h2mm",
"type": "response.text.done",
"response_id": "resp_B1lIdtjF4Noqpn5NOjznj",
"item_id": "item_B1lIdJsAJlJiFs8ztWpJt",
"output_index": 0,
"content_index": 0,
"text": "How can I assist you today?"
}
|
|
type string
事件類型,固定為response.text.done。
|
|
response_id string
響應的ID。
|
|
item_id string
訊息項ID。
|
|
output_indexinteger
響應輸出項的索引。
|
|
content_indexinteger
響應輸出項的索引。
|
|
text string
模型輸出的完整文本。
|
response.audio.delta
當輸出模態包含音頻,且模型增量產生新的音頻資料時,服務端將返回此事件。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_B1osWMZBtrEQbiIwW0qHQ",
"type": "response.audio.delta",
"response_id": "resp_P79OOMs8LnrXVpiIHUCKR",
"item_id": "item_OFaPGtzfWCPyGzxnuEX9i",
"output_index": 0,
"content_index": 0,
"delta": "{base64 audio}"
}
|
|
type string
事件類型,固定為response.audio.delta。
|
|
response_id string
響應的ID。
|
|
item_id string
訊息項ID。
|
|
output_indexinteger
響應輸出項的索引。
|
|
content_indexinteger
響應輸出項的索引。
|
|
delta string
模型增量輸出的音頻資料,使用Base64編碼。
|
response.audio.done
當輸出模態包含音頻,且模型完成組建音頻資料時,服務端將返回此事件。
當響應中斷、不完整或取消時,也會返回此事件。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_Le1TDl7VfyHQxl47DtGxI",
"type": "response.audio.done",
"response_id": "resp_HaVOPdbmX6vifiV5pAfJY",
"item_id": "item_Ls6MtCUWO7LM4E59QziNv",
"output_index": 0,
"content_index": 0
}
|
|
type string
事件類型,固定為response.audio.done。
|
|
response_id string
響應的ID。
|
|
item_id string
訊息項ID。
|
|
output_indexinteger
響應輸出項的索引。
|
|
content_indexinteger
響應輸出項的索引。
|
response.audio_transcript.delta
當輸出模態包含音頻,且模型增量產生新的音頻對應的文本時,服務端將返回 response.audio_transcript.delta 事件。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_BksW7fOwnyavZdDxIzZYM",
"type": "response.audio_transcript.delta",
"response_id": "resp_HaVOPdbmX6vifiV5pAfJY",
"item_id": "item_Ls6MtCUWO7LM4E59QziNv",
"output_index": 0,
"content_index": 0,
"delta": "有什麼"
}
|
|
type string
事件類型,固定為response.audio_transcript.delta。
|
|
response_id string
響應的ID。
|
|
item_id string
訊息項ID。
|
|
output_indexinteger
響應輸出項的索引。
|
|
content_indexinteger
響應輸出項的索引。
|
|
delta string
增量文本。
|
response.audio_transcript.done
當輸出模態包含音頻,且模型完成音頻轉錄後,服務端將返回 response.audio_transcript.done 事件。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_X49tL2WerT4WjxcmH16lS",
"type": "response.audio_transcript.done",
"response_id": "resp_HaVOPdbmX6vifiV5pAfJY",
"item_id": "item_Ls6MtCUWO7LM4E59QziNv",
"output_index": 0,
"content_index": 0,
"transcript": "你好呀!有什麼我可以幫你的嗎?"
}
|
|
type string
事件類型,固定為response.audio_transcript.done。
|
|
response_id string
響應的ID。
|
|
item_id string
訊息項ID。
|
|
output_indexinteger
響應輸出項的索引。
|
|
content_indexinteger
響應輸出項的索引。
|
|
transcript string
完整文本。
|
response.function_call_arguments.delta
當模型以流式方式產生函數調用的參數字串時,每產生一段新內容,服務端推送一次本事件。用戶端應按接收順序將各事件中的 delta 欄位拼接,得到與當前進度一致的參數文本;完整內容以隨後的 response.function_call_arguments.done 為準。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_SlKoJyEbPEqLq14DSM1u5",
"type": "response.function_call_arguments.delta",
"response_id": "resp_JnTOsWXlFhKcFohZbtfz6",
"item_id": "item_Rhcms7CauTNsQprV5S4Hr",
"output_index": 0,
"call_id": "call_2be200f4cafe419b9530dd",
"delta": " {\"location\": \"北京\"}"
}
|
|
type string
事件類型,固定為response.function_call_arguments.delta。
|
|
response_id string
響應的ID。
|
|
item_id string
訊息項ID。
|
|
output_indexinteger
該響應中輸出項的索引。
|
|
call_id string
本次函數調用的唯一 ID,與同一輪中的 done 事件保持一致。
|
|
delta string
本段新增的參數字串片段(增量)。需按順序拼接。
|
response.function_call_arguments.done
函數調用參數已全部產生完畢。本事件中的 arguments 為完整的參數字串。用戶端可在收到本事件後解析參數並調用本地工具函數;應以本事件中的完整 arguments 為準,而非 delta 拼接結果。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_X6suLyuL5agdH7r6koesM",
"type": "response.function_call_arguments.done",
"response_id": "resp_JnTOsWXlFhKcFohZbtfz6",
"item_id": "item_Rhcms7CauTNsQprV5S4Hr",
"output_index": 0,
"name": "get_current_weather",
"call_id": "call_2be200f4cafe419b9530dd",
"arguments": " {\"location\": \"北京\"}"
}
|
|
type string
事件類型,固定為response.function_call_arguments.done。
|
|
response_id string
響應的ID。
|
|
item_id string
訊息項ID。
|
|
output_indexinteger
該響應中輸出項的索引。
|
|
call_id string
本次函數調用的唯一 ID。
|
|
name string
被調用的函數名稱。
|
|
arguments string
函數調用的完整參數,一般以 JSON 字串形式表示。
|
response.output_item.added
在響應產生過程中建立新專案時,服務端返回此事件。項目類型可以是 message(常規訊息)或 function_call(工具調用)。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_DsCO341DEVtiATtCB6BUY",
"type": "response.output_item.added",
"response_id": "resp_HaVOPdbmX6vifiV5pAfJY",
"output_index": 0,
"item": {
"id": "item_Ls6MtCUWO7LM4E59QziNv",
"object": "realtime.item",
"type": "message",
"status": "in_progress",
"role": "assistant",
"content": []
}
}
// 工具調用情境
{
"event_id": "event_HXmKt5pGoiRtXx7Hq7zpN",
"type": "response.output_item.added",
"response_id": "resp_TucN5QgymL5MA8vkJvFlS",
"output_index": 0,
"item": {
"id": "item_FEG9qJGNkPcdf4et3p7BV",
"object": "realtime.item",
"type": "function_call",
"status": "in_progress",
"call_id": "call_bc0a7fb7235840f69ecfe4",
"name": "get_current_weather",
"arguments": ""
}
}
|
|
type string
事件類型,固定為response.output_item.added。
|
|
response_id string
響應的ID。
|
|
output_indexinteger
響應輸出項的索引。
|
|
itemobject
輸出項資訊。
屬性
object string
始終為 realtime.item 。
content string
訊息的內容。當 type 為 message 時存在。
type string
輸出項的類型。可選值為 message(常規訊息)或 function_call(工具調用)。
name string
當 type 為 function_call 時,被調用的函數名稱。
call_id string
當 type 為 function_call 時,本次函數調用的唯一 ID。
arguments string
當 type 為 function_call 時,函數調用的參數(JSON 字串)。在 added 事件中初始為空白字串。
|
response.output_item.done
當新的專案輸出完成時,服務端返回此事件。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_MEu5nlLw1LsOguHiehIP8",
"type": "response.output_item.done",
"response_id": "resp_HaVOPdbmX6vifiV5pAfJY",
"output_index": 0,
"item": {
"id": "item_Ls6MtCUWO7LM4E59QziNv",
"object": "realtime.item",
"type": "message",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "audio",
"text": "你好呀!有什麼我可以幫你的嗎?"
}
]
}
}
// 工具調用情境
{
"event_id": "event_FHspdfAnCyjuME3mmAwSY",
"type": "response.output_item.done",
"response_id": "resp_TucN5QgymL5MA8vkJvFlS",
"output_index": 0,
"item": {
"id": "item_FEG9qJGNkPcdf4et3p7BV",
"object": "realtime.item",
"type": "function_call",
"status": "completed",
"call_id": "call_bc0a7fb7235840f69ecfe4",
"name": "get_current_weather",
"arguments": " {\"location\": \"杭州\"}"
}
}
|
|
type string
事件類型,固定為response.output_item.done。
|
|
response_id string
響應的ID。
|
|
output_indexinteger
響應輸出項的索引。
|
|
itemobject
輸出項資訊。
屬性
object string
始終為 realtime.item 。
content string
訊息的內容。當 type 為 message 時存在。
type string
輸出項的類型。可選值為 message(常規訊息)或 function_call(工具調用)。
name string
當 type 為 function_call 時,被調用的函數名稱。
call_id string
當 type 為 function_call 時,本次函數調用的唯一 ID。
arguments string
當 type 為 function_call 時,函數調用的完整參數(JSON 字串)。
|
response.content_part.added
在響應產生過程中,向助手訊息項中添加新內容部分時,服務端返回此事件。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_AVBOmrgY3C8bjlRajfSUT",
"type": "response.content_part.added",
"response_id": "resp_HaVOPdbmX6vifiV5pAfJY",
"item_id": "item_Ls6MtCUWO7LM4E59QziNv",
"output_index": 0,
"content_index": 0,
"part": {
"type": "audio",
"text": ""
}
}
|
|
type string
事件類型,固定為response.content_part.added。
|
|
response_id string
響應的ID。
|
|
item_id string
訊息項ID。
|
|
output_indexinteger
響應輸出項的索引,目前固定為 0。
|
|
content_indexinteger
響應輸出項中內部部分的索引, 目前固定為 0。
|
|
partobject
輸出項資訊。
|
response.content_part.done
在助手訊息項中的內容部分完成串流時,服務端返回此事件。
|
event_id string
本次事件唯一識別碼。
|
{
"event_id": "event_Il8HD19v58Qr5IBkw7LtN",
"type": "response.content_part.done",
"response_id": "resp_HaVOPdbmX6vifiV5pAfJY",
"item_id": "item_Ls6MtCUWO7LM4E59QziNv",
"output_index": 0,
"content_index": 0,
"part": {
"type": "audio",
"text": "你好呀!有什麼我可以幫你的嗎?"
}
}
|
|
type string
事件類型,固定為response.content_part.done。
|
|
response_id string
響應的ID。
|
|
item_id string
訊息項ID。
|
|
output_indexinteger
響應輸出項的索引,目前固定為 0。
|
|
content_indexinteger
該項內容數組中內容部分的索引,目前固定為 0。
|
|
partobject
輸出項資訊。
|