Skip to content

Commit e05fcb1

Browse files
committed
common : fix reasoning before forced tool call via tool_choice = required
1 parent 835b2b9 commit e05fcb1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

common/chat.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1615,9 +1615,14 @@ static common_chat_params common_chat_params_init_gpt_oss(const common_chat_temp
16151615
)
16161616
);
16171617
});
1618+
1619+
auto not_end = builder.add_rule("not-end",
1620+
"[^<] | \"<\" [^|] | \"<|\" [^e] | \"<|e\" [^n] | \"<|en\" [^d] | \"<|end\" [^|] | \"<|end|\" [^>]");
1621+
auto analysis = builder.add_rule("analysis",
1622+
"\"<|channel|>analysis<|message|>\" ( " + not_end + " )* \"<|end|>\"");
16181623

16191624
auto recipient_in_role = builder.add_rule("recipient_in_role",
1620-
"\"<|start|>assistant\"? \" to=functions.\" ( " +
1625+
"(" + analysis + ")?" + "\"<|start|>assistant\"? \" to=functions.\" ( " +
16211626
string_join(tool_rules_recipient_in_role, " | ") + " )"
16221627
);
16231628

0 commit comments

Comments
 (0)