From 39037d258e68da3926d99681ea63e46212e519f9 Mon Sep 17 00:00:00 2001 From: wangln19 <96399074+wangln19@users.noreply.github.com> Date: Thu, 29 Jan 2026 13:57:09 +0800 Subject: [PATCH] Fix tool call indexing double-counting (#33141) Signed-off-by: wanglinian --- vllm/entrypoints/openai/chat_completion/serving.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vllm/entrypoints/openai/chat_completion/serving.py b/vllm/entrypoints/openai/chat_completion/serving.py index aa79e9da3..c5e6c5c6a 100644 --- a/vllm/entrypoints/openai/chat_completion/serving.py +++ b/vllm/entrypoints/openai/chat_completion/serving.py @@ -982,6 +982,7 @@ class OpenAIServingChat(OpenAIServing): index=i, ) function_name_returned[i] = True + history_tool_call_cnt += 1 delta_message = DeltaMessage( tool_calls=[ @@ -1582,7 +1583,7 @@ class OpenAIServingChat(OpenAIServing): generated_id = make_tool_call_id( id_type=self.tool_call_id_type, func_name=tc.name, - idx=history_tool_call_cnt + idx, + idx=history_tool_call_cnt, ) tool_call_class_items.append( tool_call_class(id=generated_id, function=tc) @@ -1617,7 +1618,7 @@ class OpenAIServingChat(OpenAIServing): generated_id = make_tool_call_id( id_type=self.tool_call_id_type, func_name=tool_call.name, - idx=history_tool_call_cnt + idx, + idx=history_tool_call_cnt, ) tool_call_class_items.append( tool_call_class(id=generated_id, function=tool_call) @@ -1665,7 +1666,7 @@ class OpenAIServingChat(OpenAIServing): generated_id = make_tool_call_id( id_type=self.tool_call_id_type, func_name=tc.name, - idx=history_tool_call_cnt + idx, + idx=history_tool_call_cnt, ) tool_call_items.append( tool_call_class(id=generated_id, function=tc)