Skip to content

Conversation

maryamfaizan53
Copy link

Summary

Fixes tool_choice handling in the Python SDK Responses API.
Previously, only tool_choice="auto" was accepted. Structured tool choices (e.g. {"type": "code_interpreter"}) were ignored.

Changes

  • Updated ResponsesCreateParams.tool_choice to accept both Literal["auto"] and Dict[str, Any].
  • Added test test_tool_choice_object in tests/test_responses.py.

Why

Result

Now both of these work:

tool_choice="auto"
tool_choice={"type": "code_interpreter"}

@maryamfaizan53 maryamfaizan53 requested a review from a team as a code owner August 28, 2025 22:06
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.

1 participant