From a928c62b501572071cee2768cea2e65d4a1d50eb Mon Sep 17 00:00:00 2001 From: Sloane Date: Thu, 1 Aug 2024 15:50:27 -0500 Subject: [PATCH] fix llama_grammar_accept_token arg order 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