mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-30 16:07:17 +01:00
66c2c93082
Prior to this commit, using a JSON Schema containing a string with `pattern` regular expression that uses top-level alternation (e.g. `"pattern": "^A|B|C|D$"`) would result in invalid JSON output from the constrained sampling grammar, because it ended up creating a grammar rule like this for the string: ``` thing ::= "\"" "A" | "B" | "C" | "D" "\"" space ``` Note that this rule will only match a starting quote for the "A" case, and will only match an ending quote for the "D" case, so this rule will always produce invalid JSON when used for sampling (that is, the JSON will always be lacking the starting quote, the ending quote, or both). This was fixed in a simple way by adding parentheses to the generated rule (for all string pattern rules, to keep it simple), such that the new generated rule looks like this (correct): ``` thing ::= "\"" ("A" | "B" | "C" | "D") "\"" space ``` |
||
---|---|---|
.. | ||
colorthemes.css | ||
completion.js | ||
favicon.ico | ||
index-new.html | ||
index.html | ||
index.js | ||
json-schema-to-grammar.mjs | ||
loading.html | ||
prompt-formats.js | ||
style.css | ||
system-prompts.js | ||
theme-beeninorder.css | ||
theme-ketivah.css | ||
theme-mangotango.css | ||
theme-playground.css | ||
theme-polarnight.css | ||
theme-snowstorm.css |