OpenAI DevDay 2026 後 Structured Output 和 Tool Calling 改了什麼?2026 該用 Decisions 還是 text.format
DevDay 沒有發一個「新版 JSON Schema 產品」。官方 recap 的主線是 Decisions 與帶 Computer use 的 Agents API。2026-10-22 Decisions 正式可用後,文件寫得很硬:有界答案用 Decisions;要生成符合你 schema 的物件,用 Responses 的 text.format;要模型請求副作用,用 function calling。本文只寫這三份 JSON 怎麼分,不重講 workflow 分層,也不改寫 keynote 前的預測稿。
閱讀前速覽
| 能力 | DevDay 後官方位置 | 返回什麼 |
|---|---|---|
| Structured Output | Responses:text.format.type=json_schema;不是新 API | 符合 schema 的物件(提取欄位、給 UI 的結構) |
| Tool Calling | Responses:扁平 tools[];output 項 function_call | name + arguments 字串;宿主執行 |
| 有界決策 | POST /v1/decisions;10-22 GA,可帶 input_json | answers:predicate / choice / score,不執行工具 |
| Agent 循環 | Decisions 路由 → Responses 調工具 → 宿主 state | choice 進 facts;Call/Result 仍是 Responses |
| Programmatic Tool Calling | GPT-5.6 起就有;DevDay 課表提到,不是 Structured Output 替代品 | 程式在託管 V8 裡調 allowed_callers 工具 |
事實截至 2026-10-30:DevDay recap、Decisions GA 博文與指南、Responses 遷移 / Structured Outputs / Function calling 文件。A-1042、T-8841、resp_8k1a 為虛構。
改的是分路,不是「更好的 JSON mode」
keynote 前很多人把 Structured Output、Tool Calling、Agent Workflow 寫成同一件事:給模型一份大 schema,讓它既路由又抽欄位又調工具。官方 2026 文件把三件事拆開:
- Structured Output 仍是 Responses。Chat Completions 的
response_format遷到text.format。DevDay recap 沒有把它列為當天新品。 - Tool Calling 在 Responses 裡變成扁平
type/name/parameters;寫回用function_call_output對齊call_id。省略strict時 Responses 會嘗試規範化,失敗則回落到strict: false。 - 有界路由 走 Decisions。10-22 GA 增加原生 JSON 證據(
input_json)、最多 400 題、可把 function_call 歷史當證據。返回的是 typed answers,不是你自定義的業務物件。
當天發了什麼見 DevDay 實發;三層怎麼串見 Workflow 實測;舊欄位怎麼改見 API 遷移。
舊請求形狀 vs text.format vs 扁平工具 vs Decisions
1. 不要再把路由、抽取、工具擠進同一份 Chat Completions 請求。 下面是仍常見、但已不是 DevDay 後主路徑的形狀:
{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "Extract order A-1042 as JSON."}
],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "order_extract",
"strict": true,
"schema": {
"type": "object",
"properties": {
"order_id": { "type": "string" },
"status": { "type": "string" }
},
"required": ["order_id", "status"],
"additionalProperties": false
}
}
},
"tools": [{
"type": "function",
"function": {
"name": "lookup_order",
"parameters": { "type": "object" }
}
}]
}
2. 要生成符合 schema 的物件:Responses + text.format。 官方指南:連工具用 function calling;給使用者/下游一份結構物件用 text.format。
{
"model": "gpt-6-astra",
"input": "Jane paid order A-1042.",
"text": {
"format": {
"type": "json_schema",
"name": "order_extract",
"strict": true,
"schema": {
"type": "object",
"properties": {
"order_id": { "type": "string", "pattern": "^[A-Z]-\\d{4}$" },
"status": { "type": "string", "enum": ["paid", "open"] }
},
"required": ["order_id", "status"],
"additionalProperties": false
}
}
}
}
3. 要副作用:扁平 tools,arguments 先校驗再執行。 續聊帶 previous_response_id,不要把 Decisions 的 answers 整包 stringify 進 prompt。
{
"model": "gpt-6-luna",
"previous_response_id": "resp_8k1a",
"tools": [{
"type": "function",
"name": "lookup_order",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"order_id": { "type": "string", "pattern": "^[A-Z]-\\d{4}$" }
},
"required": ["order_id"],
"additionalProperties": false
}
}],
"input": [{
"role": "user",
"content": [{ "type": "input_text", "text": "Look up A-1042 if needed." }]
}]
}
4. 要分類/路由:Decisions + input_json。 data 裡的鍵不會變成訊息或去拉圖;答案型別仍是你宣告的 question type。
{
"model": "gpt-6-luna",
"input": [{
"role": "user",
"content": [
{ "type": "input_text", "text": "Route using the ticket and order." },
{
"type": "input_json",
"data": {
"ticket": { "body": "Please refund the duplicate charge." },
"order": { "order_id": "A-1042", "charges": [49, 49] }
}
}
]
}],
"questions": [{
"type": "choice",
"name": "route",
"instructions": "Pick the next host action. Do not call tools.",
"choices": [
{ "value": "lookup", "description": "Call lookup_order" },
{ "value": "hold", "description": "Stop for a human" }
]
}]
}
三路對照:生成物件、請求工具、有界答案
把「JSON」當成一個產品名會選錯 API。按返回合約選:
| 你需要 | 用哪個 API | 不要用 |
|---|---|---|
| 抽取欄位 / 給 UI 的物件 | Responses text.format json_schema | Decisions answers 或 json_object 模式充 schema |
| 查庫、退款、寫檔案 | Responses function tools(strict + additionalProperties:false) | 讓 Decisions 去執行 lookup |
| 部門路由 / 是否重複扣費 | Decisions choice 或 predicate | 用大 json_schema 生成 next_action 散文 |
| 多步聚合、過濾工具結果 | programmatic_tool_calling + allowed_callers | 把它當成新的 Structured Output |
| 長任務託管循環 | Agents API(含 Computer use) | 用 Chat Completions messages 冒充 session |
Programmatic Tool Calling 讓模型寫一段在隔離 V8 裡跑的 JavaScript 去協調工具;應用仍要執行客戶端工具。它解決的是控制流,不是「輸出必須符合我的業務 schema」。
從舊 Chat Completions 遷到分路
staging 用虛構訂單跑通後再接生產票:
- 列出三種輸出。物件 / 工具參數 / 有界列舉,各寫一份 schema 或 choices 列表。
- 物件路徑改 text.format。刪掉 Responses 請求裡的 response_format。
- 工具改扁平定義。補 additionalProperties:false 與 required;需要非嚴格時顯式 strict:false。
- 路由改 Decisions。證據用 input_json;choice 寫入宿主 facts,再發 Responses 工具請求。
- 寫回對齊 call_id。不要用舊的 role:tool 訊息形狀。
Agents 託管路徑把 Call/Result 換成 session 事件,但「Decisions 不執行工具」這條不變。
把 schema、arguments、answers 攤開看
90% 的「模型亂輸出 JSON」是把三路混在一次請求裡,不是 Luna 不會填欄位。
- 用 格式化 展開 arguments 與 text.format 結果;用 Schema 校驗 校驗工具 parameters 與抽取 schema。
- 用 JSON Diff 對比遷移前後請求:response_format 是否還在、tools 是否仍套 function 一層。
- 用 JSONPath 從 Decisions answers 取 name=route 的 choice,確認沒有當成 order 物件。
- 五段循環欄位見 Agent JSON State。
- JSONSort 本地處理;不要上傳真實工單或金鑰。
三份 JSON 能分別透過 Schema,你才算遷完,而不是「看起來都是 JSON」。
常見誤區
- 以為 DevDay 發了新 Structured Outputs API。recap 沒列;能力仍在 Responses。
- 用 Decisions 生成訂單物件。answers 只有 probability / choice / score。
- Responses 裡繼續寫 response_format。遷移指南明確改 text.format。
- 工具仍套 function.function 兩層。Responses 是內部 tagged 扁平形狀。
- 省略 strict 卻假定永遠嚴格。schema 不相容時會回落到 strict:false。
- 把 Programmatic Tool Calling 當 schema 門。它協調呼叫;業務物件仍要 text.format 或宿主校驗。
FAQ
json_object 模式還能用嗎?
能產出合法 JSON,但不保證符合你的 schema。能走 json_schema 的 text.format 就不要退回 json_object。
Decisions 的 input_json 會替代 Structured Output 嗎?
不會。input_json 是證據;答案形狀仍由 question type 決定,不會變成你自定義的物件。
Chat Completions 的 function 定義要立刻刪嗎?
繼續用 Completions 可以暫時保留外層 function 包裝;一旦切 Responses,按遷移指南改扁平定義與 call_id 寫回。
和 Workflow / State 兩篇有何區別?
那兩篇講怎麼串循環、怎麼存宿主 state。本篇只回答:三份 JSON 合約分別落在哪個官方 API。
Programmatic Tool Calling 是 DevDay 新品嗎?
文件把它標在 GPT-5.6 工具指南;DevDay 課表「Stop Overpaying」提到它。不要寫成 9 月 29 日才出現的 Structured Output。
結論
DevDay 2026 之後,Structured Output 和 Tool Calling 沒有合併成一個更大的 schema:物件走 text.format,副作用走扁平 function,有界選擇題走 Decisions。10 月 22 日 GA 只是把路由這條路修硬了,不是讓 Decisions 去生成業務 JSON。
先畫三張合約,再改欄位名。模型仍然只填 JSON;執行和下一跳永遠是宿主的事。
延伸閱讀
- DevDay 2026 實發清單 Decisions 預覽、Agents Computer use
- Agent Workflow 實測 路由 / 執行 / 託管三層
- API 遷移 text.format 與 call_id
- Agent JSON State Request → Call → Result → State
- 全部文章 更多 JSON 與 AI 開發筆記
更新記錄: 首次發布