From 8b2cf3509fc98cc073042fda1d49db6def65ad08 Mon Sep 17 00:00:00 2001 From: ochafik Date: Sat, 28 Sep 2024 18:30:01 +0100 Subject: [PATCH] `tool-call`: fix grammar trigger crash --- examples/server/server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/server/server.cpp b/examples/server/server.cpp index 4f7a29545..10913e7d8 100644 --- a/examples/server/server.cpp +++ b/examples/server/server.cpp @@ -1157,7 +1157,7 @@ struct server_context { // If there is a lazy grammar trigger word at stop_pos, enable the lazy grammar if (match.is_grammar_trigger && gpt_sampler_trigger_grammar(model, slot.smpl, match.pattern)) { is_grammar_trigger = true; - length = pos + match.pos + match.matchLength; + length = match.pos + match.matchLength; } else if (!match.is_grammar_trigger && match.pos != std::string::npos && !match.is_partial) { slot.stopped_word = true; slot.stopping_word = match.pattern;