Repository navigation
Conversation
Pass an empty prompt with structured messages when the tokenizer template is enabled so backends answer Responses input as chat instead of continuing raw text. Add routing regression tests and document the behavior. Assisted-by: Codex:GPT-6 Signed-off-by: Tzboy <1106535856@qq.com>
tzboy08
force-pushed
the
codex/fix-responses-chat-template
branch
from
November 6, 2026 08:43
58657e9 to
206692c
Compare
…e' into codex/fix-responses-chat-template
…nses-chat-template
Author
|
Hi @mudler, could you take a look at this PR when you have a chance? I’ve synced it with |
This branch has not been 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.
Description
Fixes #13124.
With
template.use_tokenizer_template: true,/v1/responsessends both structured messages and a non-empty flattened prompt. Backends such as vLLM interpret the prompt as a text-completion request and bypass the native chat template, so a greeting such as你好is continued as raw text instead of answered as a chat message.In the shared
ComputeChoicespath, pass an empty backend prompt when tokenizer templates are enabled and messages are present. Keep the structured messages and tool parameters intact, preserve the original prompt for response postprocessing, and retain existing behavior for Go-side templates and text completions without messages.Add endpoint regression coverage for string and message-array inputs, streaming and non-streaming requests, instructions, and the Go-side fallback. Document the Responses chat-template behavior under
docs/content/.Notes for Reviewers
Validation on commit
206692ce91efde6b5deb83e59c6cbc384c6fc358:go test ./core/http/endpoints/openresponses ./core/http/endpoints/openai— both complete packages passed.inference.govia a temporary Go overlay produced the expected four native-template failures; the fallback control passed.git diff --check— passed.The automated tests stub the inference boundary; this review did not run a real Qwen/vLLM model. Deployment observations are recorded in #13124. The separate duplication issue in an older installed vLLM backend is outside this change.
golangci-lintis not installed locally, so lint has not been run. A full product build has not been run.Signed commits
The existing commit includes an
Assisted-by: Codex:GPT-6trailer.