Skip to content

Responses API migration pain: RESPONSES_TOOLS can ignore structured text format and return empty {} tool args #2300

@davidsmv

Description

@davidsmv
  • This is actually a bug report.
  • [ x] I am not getting good LLM Results
  • I have tried asking for help in the community on discord or discussions and have not received a response.
  • I have tried searching the documentation and have not found an answer.

What Model are you using?

  • [ x] gpt-5-nano

Description
Hi Instructor team, thanks for the great library.
OpenAI is recommending migration from Chat Completions to the Responses API (https://developers.openai.com/api/docs/guides/migrate-to-responses) , so we moved our production pipeline accordingly. During that migration, we found a reliability issue in RESPONSES_TOOLS mode.

Environment:

  • instructor==1.14.4
  • OpenAI Python SDK 1.x
  • Azure OpenAI
  • Python 3.11
  • Model: gpt-5-nano

Context:

  • With Chat Completions + Instructor, our Pydantic extraction flow was stable.
  • We migrated because OpenAI guidance suggests using Responses API going forward.
  • In Responses API mode, we now see intermittent empty tool arguments ({}), which causes validation failures.

What we are sending:

  • mode=instructor.Mode.RESPONSES_TOOLS
  • response_model=ResponseModel (Pydantic)
  • text.format set to json_schema (strict true/false depending on schema compatibility)

Observed behavior:

  • Response includes both:
      - forced function tool call for ResponseModel
      - text config present
  • But generation often returns tool call arguments='{}'
  • Instructor then fails Pydantic validation (required fields missing)
  • This appears more often when reasoning tokens are low

Representative failure:

  • ResponseFunctionToolCall(arguments='{}', name='ResponseModel', ...)
  • Validation error similar to:
      - 1 validation error for ResponseModel
      - required top-level field missing (example: data)

Expected behavior:

  • If text.format is provided, either:
      1. it is honored consistently, or
      2. Instructor rejects this combination with a clear error/warning.
  • In RESPONSES_TOOLS, required schema fields should not degrade into empty {} tool args.
  • Migration path from Chat Completions to Responses should preserve structured extraction reliability.

Why this matters:

  • OpenAI recommends Responses API over Chat Completions, but current behavior makes migration risky for schema-driven extraction pipelines.
  • We can’t reliably depend on required structured output if tool args can collapse to {}.
  • The constan retries make the requests too expensive.

Request / possible improvements:

  1. Add a Responses mode that uses text.format as the primary structured output path (no forced function call).
  2. In RESPONSES_TOOLS, harden schema/tool argument enforcement to prevent empty {} when required fields exist.
  3. Add explicit conflict handling for text.format + RESPONSES_TOOLS (document precedence and/or fail fast).
  4. Add retry heuristic for empty tool args when response_model has required fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:criticalCritical issue affecting productionstatus:needs-investigationIssue needs investigation to determine scope

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions