llguidance 0.7.14__tar.gz → 0.7.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {llguidance-0.7.14 → llguidance-0.7.16}/CHANGELOG.md +10 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/Cargo.lock +5 -5
- {llguidance-0.7.14 → llguidance-0.7.16}/PKG-INFO +6 -4
- {llguidance-0.7.14 → llguidance-0.7.16}/README.md +5 -3
- {llguidance-0.7.14 → llguidance-0.7.16}/docs/json_schema.md +8 -3
- {llguidance-0.7.14 → llguidance-0.7.16}/docs/syntax.md +2 -2
- {llguidance-0.7.14 → llguidance-0.7.16}/json_stats/expected_maskbench.json +710 -1280
- {llguidance-0.7.14 → llguidance-0.7.16}/json_stats/src/json_stats.rs +5 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/Cargo.toml +1 -1
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/llguidance.h +18 -1
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/api.rs +2 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/earley/from_guidance.rs +61 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/earley/lexerspec.rs +20 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/earley/mod.rs +1 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/earley/parser.rs +12 -2
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/earley/regexvec.rs +4 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/ffi.rs +53 -2
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/grammar_builder.rs +21 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/json/compiler.rs +151 -192
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/json/numeric.rs +40 -19
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/json/schema.rs +353 -301
- llguidance-0.7.16/parser/src/json/shared_context.rs +192 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/matcher.rs +7 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/tokenparser.rs +4 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/pyproject.toml +1 -1
- {llguidance-0.7.14 → llguidance-0.7.16}/python/llguidance/_lib.pyi +25 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/torch_tests/test_matcher.py +48 -18
- {llguidance-0.7.14 → llguidance-0.7.16}/python_ext/Cargo.toml +1 -1
- {llguidance-0.7.14 → llguidance-0.7.16}/python_ext/src/llmatcher.rs +27 -3
- {llguidance-0.7.14 → llguidance-0.7.16}/python_ext/src/py.rs +1 -0
- llguidance-0.7.16/sample_parser/data/ulysses.md +14613 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/tests/test_lark.rs +207 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/test-guidance.sh +3 -3
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie/Cargo.toml +1 -1
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie/src/tokenv.rs +7 -1
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie_hf_downloader/Cargo.toml +1 -1
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie_hf_tokenizers/Cargo.toml +1 -1
- llguidance-0.7.14/parser/src/json/shared_context.rs +0 -67
- {llguidance-0.7.14 → llguidance-0.7.16}/.github/workflows/rust.yml +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/.github/workflows/wheels.yml +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/.gitignore +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/CODE_OF_CONDUCT.md +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/Cargo.toml +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/LICENSE +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/SECURITY.md +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/SUPPORT.md +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/c_sample/Makefile +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/c_sample/README.md +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/c_sample/c_sample.cpp +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/docs/fast_forward.md +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/docs/mask_plot.png +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/docs/optimizations.md +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/docs/special_tokens.md +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/docs/toktrie.md +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/json_stats/Cargo.toml +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/json_stats/jstats.sh +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/json_stats/scripts/split-stats.sh +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/json_stats/scripts/split_plot.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/json_stats/src/lib.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/json_stats/src/stats.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/LICENSE +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/README.md +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/build.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/cbindgen.toml +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/grammars/character.json +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/grammars/json.json +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/constraint.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/earley/grammar.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/earley/lexer.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/earley/perf.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/earley/slicer.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/factory.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/ffi_par.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/json/README.md +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/json/context_ref.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/json/context_simple/context.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/json/context_simple/draft.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/json/context_simple/mod.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/json/formats.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/json/mod.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/json_validation.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/lark/README.md +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/lark/ast.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/lark/common.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/lark/compiler.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/lark/lexer.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/lark/mod.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/lark/parser.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/lib.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/logging.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/output.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/panic_utils.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/regex_rewrite.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/stop_controller.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/substring.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/parser/src/tokenizer_json.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/plan.md +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/llguidance/__init__.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/llguidance/_grammar_from.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/llguidance/_struct_tag.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/llguidance/_tokenizer.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/llguidance/_util.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/llguidance/cli.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/llguidance/gbnf_to_lark.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/llguidance/hf.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/llguidance/mlx.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/llguidance/numpy.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/llguidance/py.typed +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/llguidance/torch.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/mypy.ini +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/torch_tests/__init__.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/torch_tests/test_bitmask.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python/torch_tests/test_hf.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python_ext/src/lib.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python_ext/src/llinterpreter.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python_ext/src/parserlimits.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/python_ext/src/pyjson.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/Cargo.toml +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/README.md +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/cli.sh +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/data/blog.sample.json +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/data/blog.schema.json +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/data/blog.schema.ll.json +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/data/from-llama.cpp/README.md +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/data/from-llama.cpp/arithmetic.gbnf +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/data/from-llama.cpp/c.gbnf +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/data/from-llama.cpp/chess.gbnf +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/data/from-llama.cpp/english.gbnf +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/data/from-llama.cpp/japanese.gbnf +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/data/from-llama.cpp/json.gbnf +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/data/from-llama.cpp/json_arr.gbnf +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/data/from-llama.cpp/list.gbnf +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/data/from-llama.cpp/vllm-sql.gbnf +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/data/lark.lark +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/data/rfc.lark +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/data/rfc.xml +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/gtest.sh +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/lark.sh +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/run.sh +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/src/lib.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/src/minimal.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/src/sample_parser.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/tests/test_ll.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/tests/test_raw_parser.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/sample_parser/tests/test_stop.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/annotate_asm.js +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/bump.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/cbindgen.sh +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/checklinks.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/checklinks.sh +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/ci-publish.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/disasm.sh +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/gbnf_to_lark.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/gen-testcase.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/git-version.sh +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/install-deps.sh +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/jsonschema-stats.js +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/remote-guidance-test.sh +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/rust-size.js +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/rust_size.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/tokenizer_test.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/scripts/update-git.py +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie/LICENSE +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie/README.md +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie/src/bytes.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie/src/lib.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie/src/recognizer.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie/src/rng.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie/src/svob.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie/src/toktree.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie/tests/test_svob.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie_hf_downloader/LICENSE +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie_hf_downloader/src/lib.rs +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie_hf_tokenizers/LICENSE +0 -0
- {llguidance-0.7.14 → llguidance-0.7.16}/toktrie_hf_tokenizers/src/lib.rs +0 -0
|
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
If a release doesn't introduce any interesting changes (build fixes etc.), it's skipped.
|
|
6
6
|
|
|
7
|
+
#### [0.7.16](https://github.com/guidance-ai/llguidance/compare/v0.7.15...0.7.16) 2025-04-17
|
|
8
|
+
|
|
9
|
+
- fix special token tokenization [`ae7870f`](https://github.com/guidance-ai/llguidance/commit/ae7870f05ca0de68599088607ba742b7071f92ad)
|
|
10
|
+
|
|
11
|
+
#### [0.7.15](https://github.com/guidance-ai/llguidance/compare/v0.7.14...0.7.15) 2025-04-16
|
|
12
|
+
|
|
13
|
+
- support for patternProperties in JSON schema [`#167`](https://github.com/guidance-ai/llguidance/pull/167)
|
|
14
|
+
- add lenient option to JSON schemas [`#163`](https://github.com/guidance-ai/llguidance/pull/163) [`#136`](https://github.com/guidance-ai/llguidance/issues/136)
|
|
15
|
+
- Add llg_validate_grammar() in C FFI [`e5c21cf`](https://github.com/guidance-ai/llguidance/commit/e5c21cf480a17e6b310e46b24b272576cfd9c4c6)
|
|
16
|
+
|
|
7
17
|
#### [0.7.14](https://github.com/guidance-ai/llguidance/compare/v0.7.13...0.7.14) 2025-04-11
|
|
8
18
|
|
|
9
19
|
- support %lark { ... } syntax for nested grammars [`#157`](https://github.com/guidance-ai/llguidance/pull/157)
|
|
@@ -1178,7 +1178,7 @@ checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856"
|
|
|
1178
1178
|
|
|
1179
1179
|
[[package]]
|
|
1180
1180
|
name = "llguidance"
|
|
1181
|
-
version = "0.7.
|
|
1181
|
+
version = "0.7.16"
|
|
1182
1182
|
dependencies = [
|
|
1183
1183
|
"anyhow",
|
|
1184
1184
|
"derivre",
|
|
@@ -1197,7 +1197,7 @@ dependencies = [
|
|
|
1197
1197
|
|
|
1198
1198
|
[[package]]
|
|
1199
1199
|
name = "llguidance_py"
|
|
1200
|
-
version = "0.7.
|
|
1200
|
+
version = "0.7.16"
|
|
1201
1201
|
dependencies = [
|
|
1202
1202
|
"anyhow",
|
|
1203
1203
|
"bytemuck",
|
|
@@ -2362,7 +2362,7 @@ dependencies = [
|
|
|
2362
2362
|
|
|
2363
2363
|
[[package]]
|
|
2364
2364
|
name = "toktrie"
|
|
2365
|
-
version = "0.7.
|
|
2365
|
+
version = "0.7.16"
|
|
2366
2366
|
dependencies = [
|
|
2367
2367
|
"anyhow",
|
|
2368
2368
|
"bytemuck",
|
|
@@ -2373,7 +2373,7 @@ dependencies = [
|
|
|
2373
2373
|
|
|
2374
2374
|
[[package]]
|
|
2375
2375
|
name = "toktrie_hf_downloader"
|
|
2376
|
-
version = "0.7.
|
|
2376
|
+
version = "0.7.16"
|
|
2377
2377
|
dependencies = [
|
|
2378
2378
|
"anyhow",
|
|
2379
2379
|
"hf-hub",
|
|
@@ -2384,7 +2384,7 @@ dependencies = [
|
|
|
2384
2384
|
|
|
2385
2385
|
[[package]]
|
|
2386
2386
|
name = "toktrie_hf_tokenizers"
|
|
2387
|
-
version = "0.7.
|
|
2387
|
+
version = "0.7.16"
|
|
2388
2388
|
dependencies = [
|
|
2389
2389
|
"anyhow",
|
|
2390
2390
|
"log",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: llguidance
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.16
|
|
4
4
|
License-File: LICENSE
|
|
5
5
|
Summary: Bindings for the Low-level Guidance (llguidance) Rust library for use within Guidance
|
|
6
6
|
Author: Michal Moskal
|
|
@@ -20,6 +20,7 @@ Project-URL: issue_tracker, https://github.com/microsoft/llguidance/issues
|
|
|
20
20
|
|
|
21
21
|
---
|
|
22
22
|
|
|
23
|
+
* 2025-04-11 integration [merged](https://github.com/chromium/chromium/commit/07ca6337c2f714ba0477202414bd2b1692e70594) into Chromium
|
|
23
24
|
* 2025-03-25 integration [merged](https://github.com/vllm-project/vllm/pull/14779) into vLLM (v0.8.2)
|
|
24
25
|
* 2025-02-26 integration [merged](https://github.com/sgl-project/sglang/pull/3298) into SGLang (v0.4.4)
|
|
25
26
|
* 2025-02-01 integration [merged](https://github.com/ggml-org/llama.cpp/pull/10224) into llama.cpp (b4613)
|
|
@@ -61,16 +62,17 @@ The library is currently integrated in:
|
|
|
61
62
|
- [llama.cpp](https://github.com/ggerganov/llama.cpp/pull/10224) -
|
|
62
63
|
available via `-DLLAMA_LLGUIDANCE=ON` option for `cmake`;
|
|
63
64
|
llama.cpp can be also used Guidance Python package
|
|
65
|
+
- **Chromium** - [merged](https://github.com/chromium/chromium/commit/07ca6337c2f714ba0477202414bd2b1692e70594),
|
|
66
|
+
to be used for [JSON Schema enforcement](https://github.com/webmachinelearning/prompt-api?tab=readme-ov-file#structured-output-or-json-output) for `window.ai` in Chromium-based browsers
|
|
64
67
|
- [SGLang](https://github.com/sgl-project/sglang/pull/3298) -
|
|
65
68
|
use `--grammar-backend llguidance`; when passing Lark grammar make
|
|
66
69
|
sure to prefix them with `%llguidance {}`, just as in llama.cpp
|
|
67
|
-
- vLLM - [V0 PR](https://github.com/vllm-project/vllm/pull/14589) and [V1 PR](https://github.com/vllm-project/vllm/pull/14779)
|
|
70
|
+
- **vLLM** - [V0 PR](https://github.com/vllm-project/vllm/pull/14589) and [V1 PR](https://github.com/vllm-project/vllm/pull/14779)
|
|
68
71
|
- [LLGTRT](https://github.com/guidance-ai/llgtrt) - OpenAI-compatible REST server using NVIDIA's [TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM)
|
|
69
72
|
- [mistral.rs](https://github.com/EricLBuehler/mistral.rs/pull/899)
|
|
70
73
|
|
|
71
74
|
The integration is ongoing in:
|
|
72
|
-
- onnxruntime-genai - [draft PR](https://github.com/microsoft/onnxruntime-genai/pull/1038)
|
|
73
|
-
- Chromium - [ongoing PR](https://chromium-review.googlesource.com/c/chromium/src/+/6232561)
|
|
75
|
+
- **onnxruntime-genai** - [draft PR](https://github.com/microsoft/onnxruntime-genai/pull/1038)
|
|
74
76
|
|
|
75
77
|
## Technical details
|
|
76
78
|
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
+
* 2025-04-11 integration [merged](https://github.com/chromium/chromium/commit/07ca6337c2f714ba0477202414bd2b1692e70594) into Chromium
|
|
11
12
|
* 2025-03-25 integration [merged](https://github.com/vllm-project/vllm/pull/14779) into vLLM (v0.8.2)
|
|
12
13
|
* 2025-02-26 integration [merged](https://github.com/sgl-project/sglang/pull/3298) into SGLang (v0.4.4)
|
|
13
14
|
* 2025-02-01 integration [merged](https://github.com/ggml-org/llama.cpp/pull/10224) into llama.cpp (b4613)
|
|
@@ -49,16 +50,17 @@ The library is currently integrated in:
|
|
|
49
50
|
- [llama.cpp](https://github.com/ggerganov/llama.cpp/pull/10224) -
|
|
50
51
|
available via `-DLLAMA_LLGUIDANCE=ON` option for `cmake`;
|
|
51
52
|
llama.cpp can be also used Guidance Python package
|
|
53
|
+
- **Chromium** - [merged](https://github.com/chromium/chromium/commit/07ca6337c2f714ba0477202414bd2b1692e70594),
|
|
54
|
+
to be used for [JSON Schema enforcement](https://github.com/webmachinelearning/prompt-api?tab=readme-ov-file#structured-output-or-json-output) for `window.ai` in Chromium-based browsers
|
|
52
55
|
- [SGLang](https://github.com/sgl-project/sglang/pull/3298) -
|
|
53
56
|
use `--grammar-backend llguidance`; when passing Lark grammar make
|
|
54
57
|
sure to prefix them with `%llguidance {}`, just as in llama.cpp
|
|
55
|
-
- vLLM - [V0 PR](https://github.com/vllm-project/vllm/pull/14589) and [V1 PR](https://github.com/vllm-project/vllm/pull/14779)
|
|
58
|
+
- **vLLM** - [V0 PR](https://github.com/vllm-project/vllm/pull/14589) and [V1 PR](https://github.com/vllm-project/vllm/pull/14779)
|
|
56
59
|
- [LLGTRT](https://github.com/guidance-ai/llgtrt) - OpenAI-compatible REST server using NVIDIA's [TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM)
|
|
57
60
|
- [mistral.rs](https://github.com/EricLBuehler/mistral.rs/pull/899)
|
|
58
61
|
|
|
59
62
|
The integration is ongoing in:
|
|
60
|
-
- onnxruntime-genai - [draft PR](https://github.com/microsoft/onnxruntime-genai/pull/1038)
|
|
61
|
-
- Chromium - [ongoing PR](https://chromium-review.googlesource.com/c/chromium/src/+/6232561)
|
|
63
|
+
- **onnxruntime-genai** - [draft PR](https://github.com/microsoft/onnxruntime-genai/pull/1038)
|
|
62
64
|
|
|
63
65
|
## Technical details
|
|
64
66
|
|
|
@@ -15,7 +15,7 @@ Following JSON schema features are supported.
|
|
|
15
15
|
Core features:
|
|
16
16
|
|
|
17
17
|
- `anyOf`
|
|
18
|
-
- `oneOf` -
|
|
18
|
+
- `oneOf` - converted to `anyOf` only when provably equivalent
|
|
19
19
|
- `allOf` - intersection of certain schemas is not supported right now
|
|
20
20
|
- `$ref` - external/remote refs unsupported
|
|
21
21
|
- `const`
|
|
@@ -34,13 +34,14 @@ Object features:
|
|
|
34
34
|
|
|
35
35
|
- `properties` - order of properties is fixed to the order in schema
|
|
36
36
|
- `additionalProperties`
|
|
37
|
+
- `patternProperties` - they have to be disjoint
|
|
37
38
|
- `required`
|
|
38
39
|
|
|
39
40
|
String features:
|
|
40
41
|
|
|
41
42
|
- `minLength`
|
|
42
43
|
- `maxLength`
|
|
43
|
-
- `pattern`
|
|
44
|
+
- `pattern`
|
|
44
45
|
- `format`, with the following formats: `date-time`, `time`, `date`, `duration`, `email`, `hostname`, `ipv4`, `ipv6`, `uuid`,
|
|
45
46
|
|
|
46
47
|
Number features (for both integer and number):
|
|
@@ -55,6 +56,8 @@ Number features (for both integer and number):
|
|
|
55
56
|
|
|
56
57
|
- order of object properties is fixed, see below
|
|
57
58
|
- string `format` is enforced by default, with unrecognized or unimplemented formats returning errors
|
|
59
|
+
- for properties specified with `additionalProperties` or `patternProperties`, the grammar does not enforce unique keys;
|
|
60
|
+
the ones listed in `properties` are enforced uniquely, in given order
|
|
58
61
|
|
|
59
62
|
## Whitespace handling
|
|
60
63
|
|
|
@@ -71,6 +74,7 @@ Following keys are available inside of it:
|
|
|
71
74
|
- `whitespace_pattern`, optional string, overrides `whitespace_flexible`;
|
|
72
75
|
`whitespace_flexible: true` is equivalent to `whitespace_pattern: r"[\x20\x0A\x0D\x09]+"`
|
|
73
76
|
- `coerce_one_of`, defaults to `false`; when set to `true`, the `"oneOf"` will be treated as `"anyOf"`
|
|
77
|
+
- `lenient`, defaults to `false`; when set to `true`, the unsupported keywords and formats will be ignored; implies `coerce_one_of: true`
|
|
74
78
|
|
|
75
79
|
For example:
|
|
76
80
|
|
|
@@ -97,6 +101,7 @@ The `"x-guidance"` key is only recognized at the top level of the schema.
|
|
|
97
101
|
|
|
98
102
|
Properties follow order in `properties` map.
|
|
99
103
|
When schemas are merged with `allOf` etc., the `properties` maps are merged in order.
|
|
104
|
+
Any `additionalProperties` or `patternProperties` come in any order, but after `properties` and `required`.
|
|
100
105
|
|
|
101
106
|
Easiest way to override this, is to include `"my_property": true` in appropriate position in `"properties"`,
|
|
102
107
|
before `anyOf/allOf/oneOf/$ref`.
|
|
@@ -108,7 +113,7 @@ Basically, the schema is processed line-by-line, left-to-right, and property ord
|
|
|
108
113
|
|
|
109
114
|
The enforced property order during generation is as follows:
|
|
110
115
|
1. Each property in the `"properties"` object, in order of appearance
|
|
111
|
-
2. Each property in `"required"`, in order of appearance (if not already in `"properties"` they are constrained with `"
|
|
116
|
+
2. Each property in `"required"`, in order of appearance (if not already in `"properties"` they are constrained with `"additionalProperties"`)
|
|
112
117
|
|
|
113
118
|
When two schemas are joined (more than two is defined inductively), the resulting `"properties"` object will have order given by:
|
|
114
119
|
1. Each property in the left schema, in order of appearance
|
|
@@ -56,8 +56,8 @@ This will accepting strings like `There is no function I can call`
|
|
|
56
56
|
and `{"name":"get_weather", "parameters": {"city":"Seattle"}}`.
|
|
57
57
|
If the string starts with `{`, it will be forced to follow the given JSON schema.
|
|
58
58
|
|
|
59
|
-
If you have more functions, you
|
|
60
|
-
|
|
59
|
+
If you have more functions, you can use either `%json { "anyOf": [ ... ] }`,
|
|
60
|
+
or `fun_call1 | fun_call2` where each `fun_callX` is defined as `%json { ... }`.
|
|
61
61
|
|
|
62
62
|
### Special tokens
|
|
63
63
|
|