chat : implement minicpm5 parser (#24889)
* Add minicpm5 tool call parser * Refactor MiniCPM5 PEG parser per review feedback * Fix jinja min/max API to match Jinja2 * modify by review * MiniCPM5: use autoparser for XML tool calls and fix grammar preserved-token triggers * MiniCPM5: fix streaming tool-arg placeholder and remove alt XML markers * skip min/max attribute tests in -py mode * test-jinja: use real expected output for min/max attribute tests * MiniCPM5: revert shared mapper and history fallbacks per review Drop streaming tool-arg placeholder workarounds from the generic PEG mapper and restore strict tool-call argument JSON parsing so MiniCPM5 support stays limited to autoparser/diff-analyzer changes. * chat : refactor minicpm5 back to dedicated parser * cont : simplify grammar * cont : refactor * cont : fixes * cont : rename template to openbmb-MiniCPM5-1B.jinja * cont : add message delimiters * cont : fix tests --------- Co-authored-by: zhangtao <zhangtao2@modelbest.cn> Co-authored-by: 张涛 <>
This commit is contained in:
co-authored by
zhangtao
张涛 <>
parent
f68a788b0b
commit
c818263f2a
@@ -1584,6 +1584,36 @@ static void test_array_methods(testing & t) {
|
||||
"6"
|
||||
);
|
||||
|
||||
test_template(t, "array|min",
|
||||
"{{ [tool_calls_count, tool_sep_count]|min }}",
|
||||
{{"tool_calls_count", 2}, {"tool_sep_count", 1}},
|
||||
"1"
|
||||
);
|
||||
|
||||
test_template(t, "array|max",
|
||||
"{{ [tool_calls_count, tool_sep_count]|max }}",
|
||||
{{"tool_calls_count", 2}, {"tool_sep_count", 1}},
|
||||
"2"
|
||||
);
|
||||
|
||||
test_template(t, "array|min attribute",
|
||||
"{{ items|min(attribute='x') }}",
|
||||
{{"items", json::array({
|
||||
json({{"x", 2}}),
|
||||
json({{"x", 1}}),
|
||||
})}},
|
||||
"{'x': 1}"
|
||||
);
|
||||
|
||||
test_template(t, "array|max attribute",
|
||||
"{{ items|max(attribute='x') }}",
|
||||
{{"items", json::array({
|
||||
json({{"x", 2}}),
|
||||
json({{"x", 1}}),
|
||||
})}},
|
||||
"{'x': 2}"
|
||||
);
|
||||
|
||||
// not used by any chat templates
|
||||
// test_template(t, "array.insert()",
|
||||
// "{% set _ = arr.insert(1, 'x') %}{{ arr|join(',') }}",
|
||||
|
||||
Reference in New Issue
Block a user