{
  "id": "llm/function-call-json-mode-conflict",
  "signature": "openai.BadRequestError: 'response_format' parameter is not supported when using 'tools' parameter",
  "signature_zh": "openai.BadRequestError：在使用'tools'参数时不支持'response_format'参数",
  "regex": ".*response_format.*not supported.*tools.*",
  "domain": "llm",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "OpenAI API enforces mutual exclusivity between structured output via response_format and function/tool calling; both cannot be specified in the same request.",
  "root_cause_type": "generic",
  "root_cause_zh": "OpenAI API 强制要求通过 response_format 进行结构化输出与函数/工具调用互斥，同一请求中不能同时指定两者。",
  "versions": [
    {
      "version": "openai>=1.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gpt-4-turbo-2024-04-09",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gpt-4o-2024-05-13",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "LLM cannot reliably execute tool calls without explicit tools parameter; output format may not match expected schema",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "response_format enforces strict output schema; tool calls have reserved structure that conflicts with arbitrary schemas",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Older API versions may lack the feature entirely or have different buggy behavior; not a sustainable fix",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use function calling with a single tool that wraps the desired structured output: define a function with the output schema as its parameters, and parse the function call arguments as the structured result.",
      "success_rate": 0.85,
      "how": "Use function calling with a single tool that wraps the desired structured output: define a function with the output schema as its parameters, and parse the function call arguments as the structured result.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use JSON mode with response_format and handle tool calls manually via prompt engineering: include tool descriptions in the system message and parse the LLM's natural language response to extract tool calls.",
      "success_rate": 0.7,
      "how": "Use JSON mode with response_format and handle tool calls manually via prompt engineering: include tool descriptions in the system message and parse the LLM's natural language response to extract tool calls.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using OpenAI Python SDK v1.x, pass tools=None explicitly when using response_format, and manage tool logic separately in a post-processing step.",
      "success_rate": 0.8,
      "how": "If using OpenAI Python SDK v1.x, pass tools=None explicitly when using response_format, and manage tool logic separately in a post-processing step.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "使用单个工具的函数调用包装所需的结构化输出：定义一个函数，其参数为输出模式，并将函数调用参数解析为结构化结果。",
    "使用带有 response_format 的 JSON 模式，通过提示工程手动处理工具调用：在系统消息中包含工具描述，并解析 LLM 的自然语言响应以提取工具调用。",
    "如果使用 OpenAI Python SDK v1.x，在使用 response_format 时显式传递 tools=None，并在后处理步骤中单独管理工具逻辑。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://platform.openai.com/docs/guides/structured-outputs/supported-models",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2024-04-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}