@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / a32783bb35
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 6, 00:45 UTC

[Bugfix] Fix IndexError when accessing prev_tool_call_arr in OpenAIToolParser (#37958)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>

Chauncey committed Mar 25, 2026 at 12:06 UTC a32783bb35c6120df88d57609c8e454f9131f0a1
1 file changed +6 -6
vllm/entrypoints/openai/chat_completion/serving.py
+6 -6
@@ -1089,6 +1089,7 @@ class OpenAIServingChat(OpenAIServing):
1089 # any tokens that were generated but previously
1090 # matched by partial json parsing
1091 # only happens if we are NOT using structured outputs
1092 + index = 0
1093 auto_tools_called = False
1094 if tool_parser:
1095 auto_tools_called = len(tool_parser.prev_tool_call_arr) > 0
@@ -1097,15 +1098,14 @@ class OpenAIServingChat(OpenAIServing):
1098 if auto_tools_called
1099 else 0
1100 )
1100 - else:
1101 - index = 0
1102 -
1103 - if (
1101 + should_check = (
1102 self._should_check_for_unstreamed_tool_arg_tokens(
1103 delta_message, output
1104 )
1107 - and tool_parser
1108 - ):
1105 + )
1106 + # only check if there are any tool calls
1107 + # detected by partial parsing
1108 + if should_check and tool_parser and auto_tools_called:
1109 latest_delta_len = 0
1110 if (
1111 isinstance(