]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
`json`: support integer minimum, maximum, exclusiveMinimum, exclusiveMaximum (#7797)
authorOlivier Chafik <redacted>
Tue, 25 Jun 2024 19:06:20 +0000 (20:06 +0100)
committerGitHub <redacted>
Tue, 25 Jun 2024 19:06:20 +0000 (20:06 +0100)
commit84631fe1504de40427dc4b4cdac92fa7ebf65955
tree2899056619c59e5bf37f7d2286d78e388341cc7f
parentdd047b476c8b904e0c25e5dbc5bee6ffde2f6e17
`json`: support integer minimum, maximum, exclusiveMinimum, exclusiveMaximum (#7797)

* json: support minimum for positive integer values

* json: fix min 0

* json: min + max integer constraints

* json: handle negative min / max integer bounds

* json: fix missing paren min/max bug

* json: proper paren fix

* json: integration test for schemas

* json: fix bounds tests

* Update json-schema-to-grammar.cpp

* json: fix negative max

* json: fix negative min (w/ more than 1 digit)

* Update test-grammar-integration.cpp

* json: nit: move string rules together

* json: port min/max integer support to Python & JS

* nit: move + rename _build_min_max_int

* fix min in [1, 9]

* Update test-grammar-integration.cpp

* add C++11-compatible replacement for std::string_view

* add min/max constrained int field to pydantic json schema example

* fix merge

* json: add integration tests for min/max bounds

* reshuffle/merge min/max integ test cases

* nits / cleanups

* defensive code against string out of bounds (apparently different behaviour of libstdc++ vs. clang's libc++, can't read final NULL char w/ former)
common/json-schema-to-grammar.cpp
examples/json-schema-pydantic-example.py
examples/json_schema_to_grammar.py
examples/server/public/json-schema-to-grammar.mjs
tests/test-grammar-integration.cpp
tests/test-json-schema-to-grammar.cpp