OpenAI 10 月 22 日正式推出 Decisions API 之後,predicate、choice 和 score 三種答案 JSON 該怎麼讀?

截至 2026 年 10 月 24 日:POST /v1/decisions 僅支援 gpt-6-luna,單次最多 400 道題。用 name 對齊 answers;input_json 傳證據;choice 看 confidence,refusal 單獨分支。只按 input_tokens 計費。

先給結論:10 月 22 日正式可用的是專用端點 POST /v1/decisions,模型目前只有 gpt-6-luna。一次請求帶共享的 input 和最多 400 道 questions;響應是 answers 陣列,每道題用你起的 name 對齊。答案不是自由 JSON,而是三種固定形狀之一:predicate 返回 0–1 的 probability,choice 返回你定義的 choice 值並帶 probabilities 與 confidence,score 返回有序等級的機率加權 score。還可能收到 type: refusal,沒有機率欄位。

這篇按 2026 年 10 月 24 日寫,依據 10 月 22 日產品發布與開發者檔案。前天本站寫過《Bedrock 上 Claude 的 output_config.format》。那邊要你自己寫 JSON Schema 並 parse text 塊;Decisions 要的是有界選項,響應欄位由 API 定死,適合路由、打分和 yes/no,不適合長說明或任意巢狀物件。

10 月 22 日 GA 加上了什麼

發布稿把 Decisions API 定位成「有界答案上的快速判斷」:分類、路由、風險打分、語音裡選下一步動作。公測以來補上的能力包括:提示快取、input_json 原生 JSON 證據、每題獨立圖片、單次最多 400 道題(公測是 200)、與 GPT‑Live 的原生整合,以及美國與歐盟的推理駐留。

檔案寫明:同樣用 GPT‑6 Luna,Decisions 比走 Responses API 大約快 10 倍。定價頁寫的是隻按輸入 token 計費(每百萬 0.10 美元,快取輸入每百萬 0.01 美元),不按輸出 token 收費;usage 裡仍可能出現 output_tokens 等欄位,做成本核算時以定價說明為準,不要把輸出 token 再乘一遍價目。

三種 question 型別與 answers 欄位

questions.type適用answers 裡主要讀什麼
predicate條件是否為真(損壞、重複扣款等)probability(0–1),無 confidence
choice無序列舉(部門、意圖示籤)choice、probabilities[]、confidence
score有序等級(嚴重度、滿意度)score(等級索引的加權平均)、各級 probabilities

處理響應時先分支 answer.type。檔案示例對 refusal 單獨列印,不把它當成 probability: 0。

{
  "model": "gpt-6-luna",
  "input": "I was charged twice for my order.",
  "questions": [{
    "type": "choice",
    "name": "department",
    "instructions": "Which department should handle this complaint?",
    "choices": [
      {"value": "billing", "description": "Payments and refunds."},
      {"value": "technical", "description": "Product problems."}
    ]
  }]
}
{
  "answers": [{
    "type": "choice",
    "name": "department",
    "choice": "billing",
    "probabilities": [
      {"value": "billing", "probability": 0.95},
      {"value": "technical", "probability": 0.05}
    ],
    "confidence": 0.95
  }],
  "usage": {
    "input_tokens": 420,
    "input_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0
    }
  }
}

choice 的 value 必須在請求裡事先列出;模型不能發明第四個部門字串。低 confidence 時把單子轉人工,比硬路由更穩。

input_json 怎麼傳證據

不必先把工單和訂單 JSON.stringify 塞進一段 prose。在 user 訊息的 content 里加 type: input_json,物件放在 data。檔案強調:data 裡的鍵(哪怕叫 role 或 image_url)只是普通資料,不會變成另一條訊息,也不會去拉圖片。

{
  "model": "gpt-6-luna",
  "input": [{
    "role": "user",
    "content": [
      {"type": "input_text", "text": "Evaluate the ticket using the order evidence."},
      {
        "type": "input_json",
        "data": {
          "ticket": {"body": "Please refund the duplicate charge."},
          "order": {"charges": [49, 49]}
        }
      }
    ]
  }],
  "questions": [{
    "type": "predicate",
    "name": "duplicate_charge",
    "instructions": "Does the ticket describe a duplicate charge supported by the order?"
  }]
}

響應仍是 predicate / choice / score 之一,input_json 不改變 answers 的形狀。合併多源證據時,用物件鍵名固定合約,比把 JSON 貼在 markdown 程式碼塊裡更利於快取命中同一字首。

一次 400 道題怎麼對齊 name

共享上下文只傳一次 input,把變長的判斷拆進 questions 陣列。每道題的 name 在響應裡回顯,應用層用 name 建字典,不要假設 answers 順序永遠與請求完全一致(應以檔案保證為準,但日誌裡用 name 最省事)。

單題還可以在 instructions 裡放 input_text 與 input_image 陣列,給每道題不同的對照圖,而 input 裡放共享參考圖。GPT‑Live 則在 session.triggers 裡掛 type: decisions,在轉寫增量時跑 choice,讀 decision.event 裡的選項值驅動表情或路由。

帳單看 input_tokens,別看輸出字數

Decisions 的賣點是高頻小判斷:同一套系統提示和工具定義放進 input,多道題共用,並開啟與 Responses 同族的提示快取(含 30 分鐘與 12 小時寫入規則時,見《12 小時快取 usage》)。留檔建議記:

{
  "endpoint": "decisions",
  "model": "gpt-6-luna",
  "question_count": 12,
  "input_tokens": 9800,
  "cached_tokens": 6400,
  "answers_by_name": {
    "department": {"type": "choice", "choice": "billing", "confidence": 0.95}
  }
}
  • JSON 校驗 — 存檔前確認 answers 是陣列且每項有 type。
  • JSONPath — 例如 $.answers[?(@.name=='department')].confidence。
  • JSON Diff — 對比兩次路由結果,看是 input 變了還是 choices 列表變了。

和 Responses 結構化輸出怎麼分工

開發者檔案寫得很直接:需要 predicate / choice / score 之一時用 Decisions;需要按你自己的 JSON Schema 生成任意欄位或長解釋時用 Responses 的結構化輸出;需要模型發起工具呼叫時用 function calling。把「抽 20 個合約欄位」塞進 Decisions 並不合適;把「是否轉人工」做成 choice 卻很合適。

同一條 Agent 流水線可以混用:Decisions 在熱路徑上選 continue / retry / escalate,Responses 在冷路徑上生成結構化報告 JSON。兩套響應合約不要共用一個 TypeScript 型別。

常見問題 FAQ

Decisions 能換 gpt-6.1-sol 嗎?

檔案寫明目前僅支援 gpt-6-luna。換模型名會 400。發布稿強調的是 Luna 在有界答案上的速度與成本,不是通用聊天檔。

input_json 裡的鍵會當成訊息欄位嗎?

不會。data 是字面 JSON 證據。只有 user 訊息 content 陣列裡的 input_text、input_image、input_json 等部分型別會參與輸入組裝。

answers 裡出現 refusal 算失敗嗎?

算安全或策略上的拒答,不是網路錯誤。程式碼應走降級或人工佇列,不要把它對映成 choice 列表裡的某個 value。

choice 和 score 都有 probabilities,怎麼選型別?

選項沒有順序用 choice,每個 value 互斥。等級有先後(低/中/高)用 score,score 欄位是等級索引的機率加權平均,可落在兩檔之間。

usage 裡有 output_tokens,還要計費嗎?

定價頁寫 Decisions 只收輸入 token。核算成本時用 input_tokens 與 cached_tokens,以官方 pricing 為準,不要按 Chat Completions 的輸出價目乘 output_tokens。

400 道題會超過上下文嗎?

上限是 400 個問題物件,不是 400 倍獨立上下文。共享 input 仍佔 token;題目過多、instructions 過長會擠佔證據。應對齊 name、複用短 instructions,並把大塊 JSON 放進 input_json 而不是每題重複貼上。

總結

10 月 22 日的 Decisions GA,是把 Agent 裡成千上萬次小判斷收成 typed answers。記清 endpoint、gpt-6-luna、每題的 name,以及 predicate / choice / score / refusal 四條分支;結構化證據用 input_json,大物件抽取仍走 Responses。