common : update hermes2 pro trigger to search instead of match
This commit is contained in:
parent
8da07610f8
commit
6b757458da
|
|
@ -2397,17 +2397,17 @@ static common_chat_params common_chat_params_init_hermes_2_pro(const common_chat
|
||||||
(inputs.parallel_tool_calls ? "(" + tool_call + ")+" : tool_call));
|
(inputs.parallel_tool_calls ? "(" + tool_call + ")+" : tool_call));
|
||||||
// Trigger on some common known "good bad" outputs (only from the start and with a json that's about a specific argument name to avoid false positives)
|
// Trigger on some common known "good bad" outputs (only from the start and with a json that's about a specific argument name to avoid false positives)
|
||||||
data.grammar_triggers.push_back({
|
data.grammar_triggers.push_back({
|
||||||
COMMON_GRAMMAR_TRIGGER_TYPE_PATTERN_FULL,
|
COMMON_GRAMMAR_TRIGGER_TYPE_PATTERN,
|
||||||
// If thinking_forced_open, then we capture the </think> tag in the grammar,
|
// If thinking_forced_open, then we capture the </think> tag in the grammar,
|
||||||
// (important for required tool choice) and in the trigger's first capture (decides what is sent to the grammar)
|
// (important for required tool choice) and in the trigger's first capture (decides what is sent to the grammar)
|
||||||
std::string(data.thinking_forced_open ? "[\\s\\S]*?(</think>\\s*)" : "(?:<think>[\\s\\S]*?</think>\\s*)?") + (
|
std::string(data.thinking_forced_open ? "(</think>\\s*)" : "") + (
|
||||||
"\\s*("
|
"\\s*("
|
||||||
"(?:<tool_call>"
|
"(?:<tool_call>"
|
||||||
"|<function"
|
"|<function"
|
||||||
"|(?:```(?:json|xml)?\n\\s*)?(?:<function_call>|<tools>|<xml><json>|<response>)?"
|
"|(?:```(?:json|xml)?\n\\s*)?(?:<function_call>|<tools>|<xml><json>|<response>)?"
|
||||||
"\\s*\\{\\s*\"name\"\\s*:\\s*\"(?:" + string_join(escaped_names, "|") + ")\""
|
"\\s*\\{\\s*\"name\"\\s*:\\s*\"(?:" + string_join(escaped_names, "|") + ")\""
|
||||||
")"
|
")"
|
||||||
")[\\s\\S]*"
|
")"
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
data.preserved_tokens = {
|
data.preserved_tokens = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue