Repository navigation
Honor parallel_tool_calls=false in Chat Completions and Responses - #1181
Open
Sayan Shaw (sayanshaw24) wants to merge 1 commit into
Open
Sayan Shaw (sayanshaw24) wants to merge 1 commit into
Sayan Shaw (sayanshaw24) wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
It changes core streaming and guided-retry state machines, and the native test suites have not yet run successfully.
0 open findings
What changed in this PR
Enforces parallel_tool_calls=false across Chat Completions and Responses while preserving existing parallel behavior when omitted or enabled.
Changes:
- Propagates the option into request-scoped tool-call context.
- Stops publication and generation after the first accepted tool call.
- Adds converter, turn-guard, streaming, and guided-retry coverage.
| File | Description |
|---|---|
sdk_v2/cpp/src/contracts/chat_completions_converter.cc |
Maps the Chat Completions option. |
sdk_v2/cpp/src/inferencing/generative/openresponses/response_converter.cc |
Maps the Responses option. |
sdk_v2/cpp/src/inferencing/generative/toolcalling/tool_call_context.h |
Stores the request-scoped setting. |
sdk_v2/cpp/src/inferencing/generative/chat/chat_transcript.h |
Ends serial turns after one call. |
sdk_v2/cpp/src/inferencing/generative/chat/chat_session.cc |
Applies the limit across generation paths. |
sdk_v2/cpp/test/internal_api/chat_completions_converter_test.cc |
Tests Chat Completions mapping. |
sdk_v2/cpp/test/internal_api/response_converter_test.cc |
Tests Responses mapping. |
sdk_v2/cpp/test/internal_api/chat/chat_transcript_test.cc |
Tests serial turn guarding. |
sdk_v2/cpp/test/internal_api/chat/chat_session_test.cc |
Tests both APIs, streaming, chunking, and retry. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Honor
parallel_tool_calls=falsein Chat Completions and ResponsesWhy
Foundry Local accepts
parallel_tool_callsin both API request formats, but the flag did not affect generation: a request specifyingfalsecould still return and stream multiple tool calls. This matters for coding clients that execute one call at a time and expect the response to respect that choice.What changed
parallel_tool_callsvalue from Chat Completions and Responses into the request-scoped tool context. An omitted value retains the existing parallel behavior.false, publish the first completed tool call and end the assistant turn. Drop subsequent calls, text, or reasoning already decoded in the same fragment, and cancel unfinished backend generation.truerequests able to return adjacent calls as before.Tests and validation
clang-clin C++20 mode. Editor diagnostics, changed-line formatting, andgit diff --checkare clean.Scope
This enforces at most one published call when the flag is
false. It does not change the model's chat template or prevent the model from generating additional tokens before a completed call reaches the parser. The marker-delimited guidance work in ORT GenAI is separate.