fix: retry without tools when OpenAI-compatible server returns empty response - #13091
Open
thanhnnict wants to merge 1 commit into
Open
fix: retry without tools when OpenAI-compatible server returns empty response#13091thanhnnict wants to merge 1 commit into
thanhnnict wants to merge 1 commit into
Conversation
…response Some OpenAI-compatible servers (NIM, vLLM, TGI) return content: null with an empty tool_calls array when tools are provided in the request but the model decides not to call any tool. This results in blank responses in the Continue GUI. Fix: detect empty response (content: null + tool_calls: []) and retry the same request without the tools parameter. The model then responds with text content normally. Affected models: - nvidia/nemotron-ultra-253b (NIM) — frequently - deepseek-ai/DeepSeek-V4-Flash (vLLM) — occasionally - Any OpenAI-compatible server with tool support Related: continuedev#5508
Contributor
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
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.
Problem
Some OpenAI-compatible servers (NIM, vLLM, TGI) return
content: nullwith an emptytool_calls: []array when tools are provided in the request but the model decides not to call any tool. This results in blank responses rendered in the Continue GUI.Solution
Detect empty response (
content: null+tool_calls: []) and retry the same request without thetoolsparameter. The model then responds with text content normally.Behavior Matrix
content: "Hello",tool_calls: []content: null,tool_calls: [{...}]content: null,tool_calls: []content: null,tool_calls: []Affected Models
Trade-offs
chatCompletionNonStream(non-streaming path)Related