llama: fix error on bad grammar (#12628)

This commit is contained in:
Johannes Gäßler
2025-03-28 18:08:52 +01:00
committed by GitHub
parent 5d01670266
commit dd373dd3bf
3 changed files with 12 additions and 0 deletions

View File

@ -1265,6 +1265,10 @@ extern "C" {
float tau,
float eta);
/// @details Intializes a GBNF grammar, see grammars/README.md for details.
/// @param vocab The vocabulary that this grammar will be used with.
/// @param grammar_str The production rules for the grammar, encoded as a string. Returns an empty grammar if empty. Returns NULL if parsing of grammar_str fails.
/// @param grammar_root The name of the start symbol for the grammar.
LLAMA_API struct llama_sampler * llama_sampler_init_grammar(
const struct llama_vocab * vocab,
const char * grammar_str,