Skip to content

Handle textual responses when tool_calls is empty - #1351

Open
IloDan wants to merge 1 commit into
ShishirPatil:mainfrom
IloDan:fix/empty-tool-calls-text-response
Open

Handle textual responses when tool_calls is empty#1351
IloDan wants to merge 1 commit into
ShishirPatil:mainfrom
IloDan:fix/empty-tool-calls-text-response

Conversation

@IloDan

@IloDan IloDan commented Jul 30, 2026

Copy link
Copy Markdown

Problem

Some OpenAI-compatible APIs return message.tool_calls as an empty list
for final textual responses.

The previous parser only fell back to message.content when iterating
over tool_calls raised an exception. With tool_calls=[], it instead
produced model_responses=[] and discarded the valid textual response.

Fix

  • Normalize message.tool_calls with message.tool_calls or []
  • Preserve message.content when no tool calls are present
  • Stop the function-call loop when a final textual response is received

Validation

Tested with Qwen3-8B through a vLLM OpenAI-compatible endpoint on BFCL v4
memory subsets.

Before the fix, all memory subset scores were 0.

After the fix:

  • memory_kv: 4.52%
  • memory_rec_sum: 29.03%
  • memory_vector: 9.68%
  • average memory accuracy: 14.41%

This is close to the 14.62% reported for Qwen3-8B FC on the BFCL leaderboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant