]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
JSON schema conversion: ⚡️ faster repetitions, min/maxLength for strings, cap number...
authorOlivier Chafik <redacted>
Fri, 12 Apr 2024 18:43:38 +0000 (19:43 +0100)
committerGitHub <redacted>
Fri, 12 Apr 2024 18:43:38 +0000 (19:43 +0100)
commitab9a3240a9da941fdef5cd4a25f2b97c2f5a67aa
treeaa2efe58bc95a650827db07c83eb8bc0e026162c
parentfbbc030ba93561fac842af994c5c6c4c1147f13b
JSON schema conversion: ⚡️ faster repetitions, min/maxLength for strings, cap number length (#6555)

* json: rename python schema converter to make import easier

* server: skip null json_schema / grammar fields

* json: deps management for primitive rules (+ allow null values)

* json: optimize repetitions for minItems/maxItems and regexps: `a{,3}` goes from `"a"? "a"? "a"?` (explosive combos) to `(a (a (a)?)?)?`

* grammars: add troubleshooting section to readme

* json: cap length of numbers to 15 digits before/after decimal point

(avoids infinite gen, e.g. "one third" -> `0.333333333333...`)

* json: unify all repetition code (w/ or w/o sep)

* json: support string minLength/maxLength

* server+json: update server/README w/ result_format

* nits

* json: fix type error w/ python 3.8

* json: fix server/README (json_schema in /completion vs. result_format in /v1/chat/completions)

* json: simplify DOT `{"type": "string", "pattern": "^.$"}`

* json: remove recursion in opt_repetitions (avoids Python stack overflow)

* json: rm dead code

* json: rm useless assert & ggml.h import
common/json-schema-to-grammar.cpp
examples/json-schema-to-grammar.py [deleted file]
examples/json_schema_to_grammar.py [new file with mode: 0755]
examples/regex-to-grammar.py
examples/server/README.md
examples/server/json-schema-to-grammar.mjs.hpp
examples/server/public/json-schema-to-grammar.mjs
examples/server/server.cpp
examples/ts-type-to-grammar.sh
grammars/README.md
tests/test-json-schema-to-grammar.cpp