Skip to content

feat(chat): add parallel_tool_calls and max_completion_tokens - #7

Merged
theQuert merged 1 commit into
mainfrom
claude/chat-parallel-tool-calls
Oct 7, 2026
Merged

theQuert merged 1 commit into
mainfrom
claude/chat-parallel-tool-calls

Conversation

@theQuert

@theQuert theQuert commented Oct 7, 2026

Copy link
Copy Markdown
Member

Closes #4.

chat.completions.create() (sync and async, all overloads) now takes:

  • parallel_tool_calls: bool | None
  • max_completion_tokens: int | None

Both are sent as top-level request fields and omitted when unset.

Why this matters: the docs told callers to use extra_body={"parallel_tool_calls": True}, but this SDK sends extra_body as a nested "extra_body" object. It is not merged into the request the way the OpenAI SDK does it, so the flag never reached the top level.

reasoning_effort, modalities and audio already existed, so they are not part of this change.

Proof

  • New tests in tests/test_chat_advanced.py::TestToolCallingParams check the request body for sync, async, and unset.
  • The tests failed before the change and pass after it.
  • Full suite: 97 passed on Python 3.13 and 3.9.
  • ruff check reports the same findings before and after; nothing new.
  • All tests use respx mocks. No live API calls were made.

No version bump or PyPI release. The changelog entry is under "Unreleased".

🤖 Generated with Claude Code

https://claude.ai/code/session_01Uy5vXsRpMhug7v3XwTMZHv

Both are top-level OpenAI chat-completions fields. Until now callers had to
pass them through extra_body, which this SDK sends as a nested extra_body
object rather than merging it into the request.

Closes #4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uy5vXsRpMhug7v3XwTMZHv
@theQuert
theQuert merged commit 1ae006b into main Oct 7, 2026
3 checks passed
@theQuert theQuert mentioned this pull request Oct 7, 2026
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.

chat.completions.create: add parallel_tool_calls (and other current OpenAI params)

1 participant