Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/sglang/srt/function_call/base_format_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def parse_streaming_increment(
self.has_tool_call(current_text)
or (
self.current_tool_id > 0
and current_text.startswith(self.tool_call_separator + "{")
and current_text.startswith(self.tool_call_separator)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider adding a check to ensure self.tool_call_separator is not empty before the startswith call to avoid perpetually parsing subsequent text as a tool call if a subclass were to set self.tool_call_separator to an empty string.

Suggested change
and current_text.startswith(self.tool_call_separator)
and self.tool_call_separator and current_text.startswith(self.tool_call_separator)

)
):
# Only clear buffer if we're sure no tool call is starting
Expand Down
Loading