chat : accept </ifm|think> as K2 Horizon closer at medium/low effort (#30335)
This commit is contained in:
2 files changed
+24
No files matched your search
@@ -48,6 +48,11 @@ common_chat_params common_chat_params_init_k2_horizon(const common_chat_template
|
||||
data.thinking_start_tag = THINK_START;
|
||||
data.thinking_end_tags = { THINK_END };
|
||||
|
||||
// The models sometimes close medium/low reasoning with the generic </ifm|think>
|
||||
if (think != "ifm|think") {
|
||||
data.thinking_end_tags.push_back("</ifm|think>");
|
||||
}
|
||||
|
||||
data.preserved_tokens = data.thinking_end_tags;
|
||||
data.preserved_tokens.insert(data.preserved_tokens.end(), {
|
||||
THINK_START, SECTION_START, SECTION_END, CALL_START, CALL_END,
|
||||
|
||||
@@ -5206,6 +5206,25 @@ static void test_template_output_peg_parsers(bool detailed_debug) {
|
||||
.expect_reconstruction()
|
||||
.run();
|
||||
|
||||
tst.test("I'm\nthinking</ifm|think>Hello, world!\nWhat's up?")
|
||||
.reasoning_format(COMMON_REASONING_FORMAT_AUTO)
|
||||
.chat_template_kwargs({ { "reasoning_effort", R"("low")" } })
|
||||
.expect(message_assist_thoughts)
|
||||
.run();
|
||||
|
||||
tst.test(
|
||||
"I'm\nthinking</ifm|think><ifm|tool_calls>\n"
|
||||
"<ifm|tool_call>special_function\n"
|
||||
"<ifm|arg_key>arg1</ifm|arg_key>\n"
|
||||
"<ifm|arg_value>1</ifm|arg_value>\n"
|
||||
"</ifm|tool_call>\n"
|
||||
"</ifm|tool_calls>")
|
||||
.reasoning_format(COMMON_REASONING_FORMAT_AUTO)
|
||||
.tools({ special_function_tool })
|
||||
.chat_template_kwargs({ { "reasoning_effort", R"("medium")" } })
|
||||
.expect(message_assist_call_thoughts)
|
||||
.run();
|
||||
|
||||
tst.test(
|
||||
"I'm\nthinking</ifm|think><ifm|tool_calls>\n"
|
||||
"<ifm|tool_call>{\"name\": \"special_function\", \"arguments\": {\"arg1\": 1}}</ifm|tool_call>\n"
|
||||
|
||||
Reference in new issue
Block a user