cont : fix [no ci]

This commit is contained in:
Georgi Gerganov 2024-09-03 15:19:32 +03:00
parent 71293a6456
commit 0daebc6b8d
No known key found for this signature in database
GPG key ID: 449E073F9DC10735

View file

@ -973,8 +973,14 @@ struct llama_constraint * llama_constraint_init_grammar_impl(const struct llama_
auto * ctx = (llama_constraint_context_grammar *) result->ctx; auto * ctx = (llama_constraint_context_grammar *) result->ctx;
if (grammar_str != nullptr && grammar_str[0] != '\0') { if (grammar_str != nullptr && grammar_str[0] != '\0') {
ctx->grammar_str = grammar_str;
ctx->grammar_root = grammar_root;
ctx->grammar = llama_grammar_init_impl(&vocab, grammar_str, grammar_root); ctx->grammar = llama_grammar_init_impl(&vocab, grammar_str, grammar_root);
} else { } else {
ctx->grammar_str.clear();
ctx->grammar_root.clear();
ctx->grammar = nullptr; ctx->grammar = nullptr;
} }