From 34b6b8426f9d4eb44fc7922284f54a9f26b0e600 Mon Sep 17 00:00:00 2001 From: Chang Su Date: Mon, 23 Jun 2025 11:15:47 -0700 Subject: [PATCH] feat(func_call): Add more check in `BaseFormatDetector.parse_streaming_increment` (#7479) --- python/sglang/srt/function_call/base_format_detector.py | 4 ++++ test/srt/openai_server/function_call/test_tool_choice.py | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/python/sglang/srt/function_call/base_format_detector.py b/python/sglang/srt/function_call/base_format_detector.py index d1e414df6..3989ec98d 100644 --- a/python/sglang/srt/function_call/base_format_detector.py +++ b/python/sglang/srt/function_call/base_format_detector.py @@ -142,6 +142,10 @@ class BaseFormatDetector(ABC): try: if current_text.startswith(self.bot_token): start_idx = len(self.bot_token) + elif self.current_tool_id > 0 and current_text.startswith( + 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( self.tool_call_separator ): diff --git a/test/srt/openai_server/function_call/test_tool_choice.py b/test/srt/openai_server/function_call/test_tool_choice.py index 29cb76094..a5213007b 100644 --- a/test/srt/openai_server/function_call/test_tool_choice.py +++ b/test/srt/openai_server/function_call/test_tool_choice.py @@ -468,10 +468,7 @@ class TestToolChoiceQwen25(TestToolChoiceLlama32): @classmethod def setUpClass(cls): - cls.flaky_tests = { - "test_multi_tool_scenario_auto", - "test_multi_tool_scenario_required", - } + cls.flaky_tests = {} cls.model = "Qwen/Qwen2.5-7B-Instruct" cls.base_url = DEFAULT_URL_FOR_TEST