啟用條件
僅當同時滿足以下兩個條件時:response_format設定為json_schema或json_object- 回應本文是有效的 UTF-8,但包含可修復的 JSON 語法錯誤
修復內容
偵測已修復的回應
限制
- 僅限非串流 — 不適用於串流回應
- 不會修復截斷的輸出
- 僅修復語法錯誤,不修復語意錯誤
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
ARouter 在使用 json_schema 或 json_object 回應格式時,自動修復格式錯誤的 JSON 回應。
response_format 設定為 json_schema 或 json_object| 問題 | 修復後 |
|---|---|
| Markdown 程式碼區塊 | {"key": "value"} |
| 尾隨逗號 | {"a": 1, "b": 2} |
| 未加引號的鍵 | {"key": "value"} |
| 混合文字 + JSON | {"id": 1} |
| 單引號字串 | {"key": "value"} |
{
"choices": [{"message": {"role": "assistant", "content": "{\"name\": \"John Doe\"}"}, "finish_reason": "stop"}],
"x_arouter": {"response_healed": true}
}