[Bugfix] Implicitly close DeepSeek DSML parameters (#54838)
Signed-off-by: sfeng33 <4florafeng@gmail.com>
This commit is contained in:
@@ -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")),
|
||||
|
||||
Reference in New Issue
Block a user