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

Azure OpenAI Assistants API json_schema响应格式不支持gpt-4o-08-06问题

问题分析与解决方案

问题背景

在瑞典中部部署了gpt-4o-08-06(及同系列mini模型),使用Assistants API调用时指定json_schema类型的response_format,代码如下:

run = ai_client.beta.threads.runs.create_and_poll(
        thread_id=thread_id,
        assistant_id=my_assistant_id,
        model="gpt-4o-08-06",
        response_format={
            "type": "json_schema",
            "json_schema": {"name": "output", "schema": Output.model_json_schema()},
        },
    )

API返回错误:

'error': {'message': "Invalid parameter: 'response_format' of type 'json_schema' is not supported with model version `gpt-4o-08-06`.", 'type': 'invalid_request_error', 'param': 'response_format', 'code': None}}

但Azure OpenAI官方文档显示该模型版本支持此功能。

排查与解决步骤

  • 确认区域功能推送状态:部分Azure区域的功能推送存在延迟,瑞典中部可能暂未完成json_schema格式的功能部署。可尝试在已明确支持的区域(如西欧、美国东部)部署同版本模型进行测试,验证是否为区域问题。
  • 检查SDK版本兼容性:确保使用的azure-openai或openai Python SDK为最新稳定版。旧版本SDK可能未适配gpt-4o-08-06的json_schema参数传递逻辑,执行pip install --upgrade azure-openai更新后重试。
  • 验证参数格式完整性:对比官方示例确认response_format参数结构是否正确,可补充必要字段(如strict属性强制严格匹配),调整示例如下:
    response_format={
        "type": "json_schema",
        "json_schema": {
            "name": "output",
            "schema": Output.model_json_schema(),
            "strict": True
        },
    }
    
  • 通过Azure OpenAI Studio验证:在Azure OpenAI Studio中创建助手,选择相同模型并配置json_schema格式的响应要求,发起测试调用。若Studio中同样报错,说明是模型部署或区域问题;若成功,则排查代码中的参数传递或SDK问题。
  • 提交Azure支持工单:若以上步骤均无法解决,可通过Azure门户提交支持工单,提供错误信息、模型部署详情及测试结果,请求官方排查区域部署的功能异常。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 09:47:41