Skip to content

Commit 123272b

Browse files
committed
fix mypy error.
Signed-off-by: Asher Zhang <[email protected]>
1 parent c45f97d commit 123272b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

vllm/entrypoints/openai/tool_parsers/hunyuan_a13b_tool_parser.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,11 @@ def extract_tool_calls(
108108
if not potential_tool_calls:
109109
# some text should be filtered out for no function call
110110
# this text is in a13b's chat template.
111-
cleaned_output = content.replace("助手:", "", 1)
111+
if content:
112+
content = content.replace("助手:", "", 1)
112113
return ExtractedToolCallInformation(tools_called=False,
113114
tool_calls=[],
114-
content=cleaned_output)
115+
content=content)
115116

116117
# Parse the potential tool calls as JSON
117118
tool_calls_data = json.loads(potential_tool_calls)
@@ -145,10 +146,15 @@ def extract_tool_calls(
145146
tool_calls.append(tool_call)
146147

147148
logger.debug("exit in last position.")
149+
150+
if content and len(content.strip()) == 0:
151+
# clear the whitespace content.
152+
content = None
153+
148154
return ExtractedToolCallInformation(
149155
tools_called=len(tool_calls) > 0,
150156
tool_calls=tool_calls,
151-
content=content if len(content.strip()) > 0 else None,
157+
content=content,
152158
)
153159

154160
except Exception as e:

0 commit comments

Comments
 (0)