fix: retry without tools when OpenAI-compatible server returns empty response - #13091
fix: retry without tools when OpenAI-compatible server returns empty response#13091thanhnnict 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
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
Hi @continuedev/maintainers, The failing checks ( Could you confirm if these are pre-existing flaky tests or re-run the CI? Thanks! |
|
Hi @sestinj - Friendly ping on this PR. This fixes a real issue we hit in production with NIM (Nemotron Ultra 253B) and vLLM (DeepSeek V4 Flash) serving ~300 developers. The empty response causes blank GUI output which is confusing for users. The fix is minimal (single file, defensive retry) and references the existing issue #5508. Happy to add unit tests or address any feedback if needed. Thanks for your time. |
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