You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在OpenAI Response API Create Response中配置结构化输出?

OpenAI Responses API 结构化输出文档问题
  • 在「Create a model response」文档中提到,配置{ "type": "json_schema" }可启用结构化输出,但并未说明如何为输出指定具体的JSON Schema。

配置{ "type": "json_schema" }可启用结构化输出

  • 「Structured model outputs」文档中包含一段使用client.responses.parse的Python示例代码,但Responses API的官方接口中并不存在这个parse方法:
response = client.responses.parse(
    model="gpt-4o-2024-08-06",
    input=[
        {"role": "system", "content": "Extract the event information."},
        {
            "role": "user",
            "content": "Alice and Bob are going to a science fair on Friday.",
        },
    ],
    text_format=CalendarEvent,
)
  • 已有社区反馈指出,Responses API的结构化输出相关文档存在缺失问题。

内容的提问来源于stack exchange,提问作者mon

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.01 13:07:31