Unverified Commit 6f4676ef authored by Xinyuan Tong's avatar Xinyuan Tong Committed by GitHub
Browse files

fix: tool parse in large streaming chunk beginning with normal content (#10397)


Co-authored-by: default avatargemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
parent c9ec4cae
...@@ -162,12 +162,9 @@ class BaseFormatDetector(ABC): ...@@ -162,12 +162,9 @@ class BaseFormatDetector(ABC):
try: try:
try: try:
if current_text.startswith(self.bot_token): tool_call_pos = current_text.find(self.bot_token)
start_idx = len(self.bot_token) if tool_call_pos != -1:
elif self.current_tool_id > 0 and current_text.startswith( start_idx = tool_call_pos + len(self.bot_token)
self.tool_call_separator + self.bot_token
):
start_idx = len(self.tool_call_separator + self.bot_token)
elif self.current_tool_id > 0 and current_text.startswith( elif self.current_tool_id > 0 and current_text.startswith(
self.tool_call_separator self.tool_call_separator
): ):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment