llama.cpp/examples/server/public
Joe Eli McIlvain 66c2c93082
grammar : fix JSON Schema for string regex with top-level alt. (#9903)
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
```
2024-10-16 19:03:24 +03:00
..
colorthemes.css server : new UI (#7633) 2024-06-01 22:31:48 +03:00
completion.js server: use relative routes for static files in new UI (#8552) 2024-07-18 12:43:49 +02:00
favicon.ico server : add themes + favicon (#6848) 2024-05-08 22:12:06 +03:00
index-new.html sampling : add XTC sampler (#9742) 2024-10-15 12:54:55 +02:00
index.html sampling : add XTC sampler (#9742) 2024-10-15 12:54:55 +02:00
index.js server : update preact (#9895) 2024-10-15 12:48:44 +03:00
json-schema-to-grammar.mjs grammar : fix JSON Schema for string regex with top-level alt. (#9903) 2024-10-16 19:03:24 +03:00
loading.html server : add loading html page while model is loading (#9468) 2024-09-13 14:23:11 +02:00
prompt-formats.js server : new UI (#7633) 2024-06-01 22:31:48 +03:00
style.css server : new UI (#7633) 2024-06-01 22:31:48 +03:00
system-prompts.js server : new UI (#7633) 2024-06-01 22:31:48 +03:00
theme-beeninorder.css server : new UI (#7633) 2024-06-01 22:31:48 +03:00
theme-ketivah.css server : new UI (#7633) 2024-06-01 22:31:48 +03:00
theme-mangotango.css server : new UI (#7633) 2024-06-01 22:31:48 +03:00
theme-playground.css server : new UI (#7633) 2024-06-01 22:31:48 +03:00
theme-polarnight.css server : new UI (#7633) 2024-06-01 22:31:48 +03:00
theme-snowstorm.css server : new UI (#7633) 2024-06-01 22:31:48 +03:00