Skip to content

Python Bug: The text parameter was missing when sending to the OpenAI Responses API. #13281

@ymuichiro

Description

@ymuichiro

Summary

The text parameter (ResponseTextConfigParam) is not included in the final request to the OpenAI Responses API, even when set in OpenAIResponsesAgent.

Problem Details

  1. The text parameter is received in the OpenAIResponsesAgent's constructor and stored in agent.text (of type dict[str, Any], default is an empty dict).
  2. The text parameter is merged in ResponsesAgentThreadActions._merge_options().
  3. However, the text key is not added to the options dictionary in _generate_options(), causing it to be missing from the API request.

Steps to Reproduce

agent = OpenAIResponsesAgent(
    ai_model_id="gpt-5",
    client=client,
    text={"format": {"type": "json_schema", "name": "...", "schema": {...}}},
)
# Even when calling agent.get_response(), the text parameter is not sent to the API

Expected Behavior

  • If the text parameter is set, it should be included in the request to the OpenAI Responses API.
  • However, it should not be sent if text is None or an empty dict, or if selection is None.

Scope of Impact

  • All cases using OpenAIResponsesAgent.
  • Particularly affects use cases involving Structured Outputs or JSON Schema.

Related Files

  • responses_agent_thread_actions.py
  • openai_responses_agent.py

Platform

  • Language: Python
  • Source: pip
  • AI model: OpenAI Responses
  • IDE: VS Code
  • OS: Mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpythonPull requests for the Python Semantic Kerneltriage

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions