[Bugfix] Fix IndexError when accessing prev_tool_call_arr in OpenAIToolParser (#37958)
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
This commit is contained in:
@@ -1089,6 +1089,7 @@ class OpenAIServingChat(OpenAIServing):
|
||||
# any tokens that were generated but previously
|
||||
# matched by partial json parsing
|
||||
# only happens if we are NOT using structured outputs
|
||||
index = 0
|
||||
auto_tools_called = False
|
||||
if tool_parser:
|
||||
auto_tools_called = len(tool_parser.prev_tool_call_arr) > 0
|
||||
@@ -1097,15 +1098,14 @@ class OpenAIServingChat(OpenAIServing):
|
||||
if auto_tools_called
|
||||
else 0
|
||||
)
|
||||
else:
|
||||
index = 0
|
||||
|
||||
if (
|
||||
should_check = (
|
||||
self._should_check_for_unstreamed_tool_arg_tokens(
|
||||
delta_message, output
|
||||
)
|
||||
and tool_parser
|
||||
):
|
||||
)
|
||||
# only check if there are any tool calls
|
||||
# detected by partial parsing
|
||||
if should_check and tool_parser and auto_tools_called:
|
||||
latest_delta_len = 0
|
||||
if (
|
||||
isinstance(
|
||||
|
||||
Reference in New Issue
Block a user