From 3979a6c7fb2b0239093ac22b7cd660bbb19f2577 Mon Sep 17 00:00:00 2001 From: Sidhartha Reddy Potu Date: Thu, 13 Aug 2026 15:18:19 -0700 Subject: [PATCH 1/2] fix(muse-glimmer): parse required/named tool calls natively Muse Glimmer only ever emits ATEM tool calls. With tool_choice=required or a named tool, the default path forces a JSON-array grammar (via JsonArrayParser) that the model does not emit for tool calls; when it produces its native ATEM block instead, the JSON parser cannot read it and the call leaks to the client as content with zero tool calls. Return True from parses_required_natively() so required/named decode through the native ATEM parser, the same path tool_choice=auto uses. --- .../srt/function_call/muse_glimmer_detector.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/python/sglang/srt/function_call/muse_glimmer_detector.py b/python/sglang/srt/function_call/muse_glimmer_detector.py index 6c9cb02d3015..9b29d8a65760 100644 --- a/python/sglang/srt/function_call/muse_glimmer_detector.py +++ b/python/sglang/srt/function_call/muse_glimmer_detector.py @@ -251,6 +251,18 @@ def _consume_body( def supports_structural_tag(self) -> bool: return False + def parses_required_natively(self) -> bool: + """Muse Glimmer only ever emits ATEM tool calls. + + For ``tool_choice="required"`` / a named tool the default path forces a + JSON-array grammar (via ``JsonArrayParser``) that the model does not emit + for tool calls; when it produces its native ATEM block instead, the JSON + parser cannot read it and the call leaks to the client as content with + zero tool calls. Returning True routes required/named through this + detector's native ATEM parsing, the same path ``auto`` already uses. + """ + return True + def structure_info(self) -> _GetInfoFunc: return lambda name: StructureInfo( begin=f'{FUNCTION_CALLS_OPEN}\n{INVOKE_OPEN} name="{name}">', From baeb20e43c215f6f464591b383c1c79bddd6064b Mon Sep 17 00:00:00 2001 From: Xinyuan Tong Date: Fri, 14 Aug 2026 10:25:49 +0000 Subject: [PATCH 2/2] Trim parses_required_natively docstring --- .../sglang/srt/function_call/muse_glimmer_detector.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/python/sglang/srt/function_call/muse_glimmer_detector.py b/python/sglang/srt/function_call/muse_glimmer_detector.py index 9b29d8a65760..15519c1a9623 100644 --- a/python/sglang/srt/function_call/muse_glimmer_detector.py +++ b/python/sglang/srt/function_call/muse_glimmer_detector.py @@ -252,15 +252,8 @@ def supports_structural_tag(self) -> bool: return False def parses_required_natively(self) -> bool: - """Muse Glimmer only ever emits ATEM tool calls. - - For ``tool_choice="required"`` / a named tool the default path forces a - JSON-array grammar (via ``JsonArrayParser``) that the model does not emit - for tool calls; when it produces its native ATEM block instead, the JSON - parser cannot read it and the call leaks to the client as content with - zero tool calls. Returning True routes required/named through this - detector's native ATEM parsing, the same path ``auto`` already uses. - """ + """The model only ever emits ATEM tool calls, so the JSON-array grammar + the default required/named path forces cannot parse its output.""" return True def structure_info(self) -> _GetInfoFunc: