Apply guidance for user-specified response_format regardless of tool_choice - #1043
Open
Sayan Shaw (sayanshaw24) wants to merge 2 commits into
Open
Apply guidance for user-specified response_format regardless of tool_choice#1043Sayan Shaw (sayanshaw24) wants to merge 2 commits into
response_format regardless of tool_choice#1043Sayan Shaw (sayanshaw24) wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Sayan Shaw (sayanshaw24)
force-pushed
the
sayanshaw/fix-guidance-gate
branch
from
August 26, 2026 18:51
796b047 to
b62fee5
Compare
Sayan Shaw (sayanshaw24)
force-pushed
the
sayanshaw/fix-guidance-gate
branch
from
August 26, 2026 18:51
b62fee5 to
39c7114
Compare
Sayan Shaw (sayanshaw24)
marked this pull request as ready for review
August 26, 2026 18:55
Contributor
There was a problem hiding this comment.
Pull request overview
Applies explicit structured-output guidance independently of tool-choice mode.
Changes:
- Applies user-provided guidance unconditionally.
- Updates cached-generator guidance handling.
- Adds JSON-schema integration coverage.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
onnx_chat_generator.cc |
Separates explicit guidance from tool grammar. |
chat_session.cc |
Updates guidance-related cache invalidation. |
chat_completions_test.cc |
Tests JSON-schema-constrained output. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Sayan Shaw (sayanshaw24)
requested review from
kunal-vaishnavi and
Nat Kershaw (MSFT) (natke)
August 26, 2026 19:00
Sayan Shaw (sayanshaw24)
enabled auto-merge (squash)
August 27, 2026 00:40
…on for schema changes
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.
Fix: Apply guidance for user-specified
response_formatregardless oftool_choiceFixes #1042
Problem
response_formatwithjson_schemawas silently ignored — the model generated freely without schema constraints. This affected alltool_choicemodes except"required".Root cause:
SetGuidance()was gated behindtool_call_only, which is only true whentool_choice = "required":The guard was added to prevent a CoT multi-turn issue with auto-generated tool grammar, but it inadvertently blocked ALL guidance — including user-explicit
response_format.Fix
Separate user-explicit guidance from auto-generated tool grammar:
response_format) → always appliedAlso updated the cache invalidation check in
chat_session.ccto account for user-specified guidance changes between turns.Changes
onnx_chat_generator.cctool_call_onlychat_session.ccchat_completions_test.ccChatCompletionsWithJsonSchemaGuidance— verifies model output conforms to json_schema when response_format is setTesting