Skip to content

Conversation

@mshsheikh
Copy link
Contributor

When model_settings.verbosity was set and no output schema was provided, the code previously built response_format = {"verbosity": ...} which is an invalid text payload for the Responses API.

The Responses API expects a text object to include a format field (for plain text use "format": "text").

This patch ensures a valid payload is sent by using:
{"format": "text", "verbosity": }

Impact:

  • Prevents 400/BadRequest errors when callers use verbosity with plain text responses (no JSON schema).
  • Backwards compatible for callers that already use output_schema.

… responses

When model_settings.verbosity was set and no output schema was provided,
the code previously built response_format = {"verbosity": ...} which
is an invalid `text` payload for the Responses API. The Responses API
expects a `text` object to include a `format` field (for plain text use
"format": "text").

This patch ensures a valid payload is sent by using:
  {"format": "text", "verbosity": <value>}

Impact:
- Prevents 400/BadRequest errors when callers use verbosity with plain text
  responses (no JSON schema).
- Backwards compatible for callers that already use output_schema.
Mypy reported a typing error because the `text.format` TypedDict expects an object
(e.g. {"type": "text"}) not a plain string "text". Previously we set
response_format = {"format": "text", "verbosity": ...} which fails type checks.

This change uses the correct format object:
  {"format": {"type": "text"}, "verbosity": <value>}

This resolves the mypy failure and keeps the `text` payload valid for the Responses API.
@seratch
Copy link
Member

seratch commented Oct 30, 2025

When model_settings.verbosity was set and no output schema was provided, the code previously built response_format = {"verbosity": ...} which is an invalid text payload for the Responses API.

I don't think so. The current code works without any issues. You can confirm the behavior by modifying examples.basic.hello_world_gpt_5.

@seratch seratch closed this Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants