Skip to content

Commit

Permalink
Update test-tool-call.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
ochafik committed Dec 26, 2024
1 parent e70ce3f commit f0bd693
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tests/test-tool-call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,10 @@ static std::unique_ptr<llama_grammar> build_grammar(const std::string & grammar_
static bool match_string(const std::string & input, llama_grammar * grammar) {
const auto cpts = unicode_cpts_from_utf8(input);

const llama_grammar_rules & rules = llama_grammar_get_rules (grammar);
llama_grammar_stacks & stacks_cur = llama_grammar_get_stacks(grammar);
auto & stacks_cur = llama_grammar_get_stacks(grammar);

for (const auto & cpt : cpts) {
const llama_grammar_stacks stacks_prev = llama_grammar_get_stacks(grammar); // copy

llama_grammar_accept(rules, stacks_prev, cpt, stacks_cur);
llama_grammar_accept(grammar, cpt);

if (stacks_cur.empty()) {
// no stacks means that the grammar failed to match at this point
Expand Down

0 comments on commit f0bd693

Please sign in to comment.