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。