Fix tool call indexing double-counting (#33141)

Signed-off-by: wanglinian <wanglinian@stu.pku.edu.cn>
This commit is contained in:
wangln19
2026-01-29 13:57:09 +08:00
committed by GitHub
parent 51550179fc
commit 39037d258e

View File

@@ -982,6 +982,7 @@ class OpenAIServingChat(OpenAIServing):
index=i, index=i,
) )
function_name_returned[i] = True function_name_returned[i] = True
history_tool_call_cnt += 1
delta_message = DeltaMessage( delta_message = DeltaMessage(
tool_calls=[ tool_calls=[
@@ -1582,7 +1583,7 @@ class OpenAIServingChat(OpenAIServing):
generated_id = make_tool_call_id( generated_id = make_tool_call_id(
id_type=self.tool_call_id_type, id_type=self.tool_call_id_type,
func_name=tc.name, func_name=tc.name,
idx=history_tool_call_cnt + idx, idx=history_tool_call_cnt,
) )
tool_call_class_items.append( tool_call_class_items.append(
tool_call_class(id=generated_id, function=tc) tool_call_class(id=generated_id, function=tc)
@@ -1617,7 +1618,7 @@ class OpenAIServingChat(OpenAIServing):
generated_id = make_tool_call_id( generated_id = make_tool_call_id(
id_type=self.tool_call_id_type, id_type=self.tool_call_id_type,
func_name=tool_call.name, func_name=tool_call.name,
idx=history_tool_call_cnt + idx, idx=history_tool_call_cnt,
) )
tool_call_class_items.append( tool_call_class_items.append(
tool_call_class(id=generated_id, function=tool_call) tool_call_class(id=generated_id, function=tool_call)
@@ -1665,7 +1666,7 @@ class OpenAIServingChat(OpenAIServing):
generated_id = make_tool_call_id( generated_id = make_tool_call_id(
id_type=self.tool_call_id_type, id_type=self.tool_call_id_type,
func_name=tc.name, func_name=tc.name,
idx=history_tool_call_cnt + idx, idx=history_tool_call_cnt,
) )
tool_call_items.append( tool_call_items.append(
tool_call_class(id=generated_id, function=tc) tool_call_class(id=generated_id, function=tc)