mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2025-10-27 08:21:30 +00:00
chat : fixed crash when Hermes 2 <tool_call> had a newline before it (#15639)
Co-authored-by: CNE Pierre FICHEPOIL <pierre-1.fichepoil@gendarmerie.interieur.gouv.fr>
This commit is contained in:
@@ -1892,7 +1892,7 @@ static common_chat_params common_chat_params_init_hermes_2_pro(const common_chat
|
|||||||
// 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 ? "[\\s\\S]*?(</think>\\s*)" : "(?:<think>[\\s\\S]*?</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>)?"
|
||||||
|
|||||||
Reference in New Issue
Block a user