Fix Inkling tool-call parsing recovery, content handling, and streaming (#32861)
This commit is contained in:
@@ -15,6 +15,7 @@ from sglang.srt.function_call.hunyuan_detector import resolve_hunyuan_tokens
|
||||
from sglang.srt.parser.harmony_parser import HarmonyParser
|
||||
from sglang.srt.parser.inkling_tokenizer import (
|
||||
CONTENT_INVOKE_TOOL_JSON,
|
||||
CONTENT_INVOKE_TOOL_TEXT,
|
||||
CONTENT_MODEL_END_SAMPLING,
|
||||
CONTENT_TEXT,
|
||||
CONTENT_THINKING,
|
||||
@@ -862,12 +863,12 @@ class InklingDetector(BaseReasoningFormatDetector):
|
||||
# a real header can only follow an end token. Preserve it
|
||||
# instead of rerouting the rest of the block into a header.
|
||||
emit(token)
|
||||
elif token == CONTENT_INVOKE_TOOL_JSON:
|
||||
elif token in (CONTENT_INVOKE_TOOL_JSON, CONTENT_INVOKE_TOOL_TEXT):
|
||||
# Preserve the tool-invocation framing (json and headerless raw
|
||||
# text) in content so the tool-call detector receives it.
|
||||
flush_reasoning()
|
||||
if self._kind == "header":
|
||||
content.extend(
|
||||
(MESSAGE_MODEL, self._pending_header, CONTENT_INVOKE_TOOL_JSON)
|
||||
)
|
||||
content.extend((MESSAGE_MODEL, self._pending_header, token))
|
||||
self._pending_header = ""
|
||||
else:
|
||||
content.append(token)
|
||||
|
||||
Reference in New Issue
Block a user