Fix tool call indexing double-counting (#33141)
Signed-off-by: wanglinian <wanglinian@stu.pku.edu.cn>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user