Skip to content

fix: pass config params to structured_output in OpenAIResponsesModel#1910

Open
Di-Is wants to merge 2 commits intostrands-agents:mainfrom
Di-Is:fix/structured-output-params
Open

fix: pass config params to structured_output in OpenAIResponsesModel#1910
Di-Is wants to merge 2 commits intostrands-agents:mainfrom
Di-Is:fix/structured-output-params

Conversation

@Di-Is
Copy link

@Di-Is Di-Is commented Mar 15, 2026

Description

OpenAIResponsesModel.structured_output() silently drops all config params (max_output_tokens, reasoning, instructions, etc.) because it only extracts ["input"] from the _format_request() result.

This fix builds parse_kwargs from the full _format_request() output, excluding model/input (already handled explicitly) and stream (hardcoded as True by _format_request(), incompatible with parse()). Other params pass through directly, letting the API/SDK validate incompatible combinations.

Resolves: #1908

Related Issues

#1908

Documentation PR

N/A

Type of Change

Bug fix

Testing

  • test_structured_output_passes_config_params — verifies max_output_tokens and reasoning are forwarded, stream is excluded
  • test_structured_output_passes_instructions — verifies system_prompt is forwarded as instructions
  • Verified with live API calls against gpt-5.4 that responses.parse() correctly accepts max_output_tokens, reasoning, and instructions

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Di-Is Di-Is force-pushed the fix/structured-output-params branch from 97470ae to 571d507 Compare March 15, 2026 09:29
@github-actions github-actions bot added size/s and removed size/s labels Mar 15, 2026
@Di-Is Di-Is requested a deployment to manual-approval March 15, 2026 09:29 — with GitHub Actions Waiting
@Di-Is Di-Is requested a deployment to manual-approval March 15, 2026 09:29 — with GitHub Actions Waiting
@github-actions github-actions bot added size/s and removed size/s labels Mar 15, 2026
@Di-Is Di-Is requested a deployment to manual-approval March 15, 2026 10:05 — with GitHub Actions Waiting
@Di-Is Di-Is requested a deployment to manual-approval March 15, 2026 10:05 — with GitHub Actions Waiting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] OpenAIResponsesModel.structured_output() drops config params (temperature, reasoning, etc.)

1 participant