[Frontend] Support strict MiMo-V2.6 tool calling (#58019)

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: yuchuan <yuchuan.7streams@gmail.com>
Co-authored-by: Bugen Zhao <i@bugenzhao.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ubospica <ubospica@gmail.com>
Signed-off-by: yuchuan <yuchuan.7streams@gmail.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
This commit is contained in:
Yixin Dong
2026-09-29 12:47:47 +00:00
committed by GitHub
co-authored by Codex yuchuan Bugen Zhao Claude Opus 5.5
parent 79a0307d74
commit dfc8e0f3e2
17 changed files with 243 additions and 15 deletions
+24
View File
@@ -1175,3 +1175,27 @@ class TestNestedSchemaCoercion:
assert questions[0]["question"] == "Pick a color"
assert questions[0]["multiSelect"] is False
assert questions[0]["answer"] is None
@pytest.mark.parametrize("value", ["\n北京 &amp;\n", "null", "42", "", "a\nb"])
@pytest.mark.parametrize("chunk_size", [1, 7, 1000])
def test_mimo_preserves_verbatim_parameter_values(
mock_tokenizer, mock_request, value, chunk_size
):
from vllm.parser.mimo import MiMoParser
text = (
f"<tool_call><function=run><parameter=text>{value}</parameter>"
"</function></tool_call>"
)
parser = MiMoParser(mock_tokenizer, chat_template_kwargs={"enable_thinking": False})
result = parser.extract_tool_calls(text, mock_request)
assert json.loads(result.tool_calls[0].function.arguments) == {"text": value}
parser = MiMoParser(mock_tokenizer, chat_template_kwargs={"enable_thinking": False})
results = simulate_tool_streaming(
parser,
mock_request,
[text[i : i + chunk_size] for i in range(0, len(text), chunk_size)],
)
assert collect_function_name(results) == "run"
assert json.loads(collect_tool_arguments(results)) == {"text": value}