[Bugfix] Implicitly close DeepSeek DSML parameters (#54838)

Signed-off-by: sfeng33 <4florafeng@gmail.com>
This commit is contained in:
Flora Feng
2026-09-02 14:13:36 +08:00
committed by GitHub
parent 3976eada8b
commit 300f688321
4 changed files with 90 additions and 1 deletions
+19
View File
@@ -181,6 +181,25 @@ class TestInitialState:
class TestStreaming:
def test_split_parameter_start_is_buffered(self, mock_tokenizer, mock_request):
chunks = [
DSML_FUNC_START,
f"{DSML_INVOKE_PREFIX}edit{DSML_INVOKE_NAME_END}",
f"<{_PARAM_OPEN.format(name='expr', is_str='true')}a<b><|DSML|parameter",
' name="date" string="true">tomorrow',
_PARAM_CLOSE,
DSML_INVOKE_END,
DSML_FUNC_END,
]
results = simulate_tool_streaming(
DeepSeekV32Parser(mock_tokenizer), mock_request, chunks
)
arguments = collect_tool_arguments(results)
assert "<|DSML|parameter" not in arguments
assert json.loads(arguments) == {"expr": "a<b>", "date": "tomorrow"}
def test_single_tool_streaming(self, mock_tokenizer, mock_request):
text = _func_calls(
_invoke("get_weather", _param("city", "true", "SF")),