]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
chat : fixed crash when Hermes 2 <tool_call> had a newline before it (#15639)
authorExtReMLapin <redacted>
Thu, 4 Sep 2025 23:24:08 +0000 (01:24 +0200)
committerGitHub <redacted>
Thu, 4 Sep 2025 23:24:08 +0000 (01:24 +0200)
Co-authored-by: CNE Pierre FICHEPOIL <redacted>
common/chat.cpp

index 823d88deca4fb8aad8192c7d0f06c8df4817425f..e962adfdc2bfc32513a6347847adcb2fff958cea 100644 (file)
@@ -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,
                 // (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*)?") + (
-                    "(\\s*"
+                    "\\s*("
                     "(?:<tool_call>"
                     "|<function"
                     "|(?:```(?:json|xml)?\n\\s*)?(?:<function_call>|<tools>|<xml><json>|<response>)?"