From 5575fedd33141ffdeb87304da3b1225da58db76a Mon Sep 17 00:00:00 2001 From: tc-wolf <50339167+tc-wolf@users.noreply.github.com> Date: Sun, 4 Aug 2024 16:07:54 -0500 Subject: [PATCH] fix: llama_grammar_accept_token arg order (#1649) Old was: llama_grammar_accept_token(ctx, grammar, token) Now this is: llama_grammar_accept_token(grammar, ctx, token) --- llama_cpp/_internals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llama_cpp/_internals.py b/llama_cpp/_internals.py index dcd4e17ff..357023e3c 100644 --- a/llama_cpp/_internals.py +++ b/llama_cpp/_internals.py @@ -511,7 +511,7 @@ def sample_token(self, candidates: "_LlamaTokenDataArray") -> int: def grammar_accept_token(self, grammar: LlamaGrammar, token: int): assert self.ctx is not None assert grammar.grammar is not None - llama_cpp.llama_grammar_accept_token(self.ctx, grammar.grammar, token) + llama_cpp.llama_grammar_accept_token(grammar.grammar, self.ctx, token) def reset_timings(self): assert self.ctx is not None