llguidance 0.7.14__tar.gz → 0.7.15__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.
Files changed (175) hide show
  1. {llguidance-0.7.14 → llguidance-0.7.15}/CHANGELOG.md +6 -0
  2. {llguidance-0.7.14 → llguidance-0.7.15}/Cargo.lock +5 -5
  3. {llguidance-0.7.14 → llguidance-0.7.15}/PKG-INFO +6 -4
  4. {llguidance-0.7.14 → llguidance-0.7.15}/README.md +5 -3
  5. {llguidance-0.7.14 → llguidance-0.7.15}/docs/json_schema.md +8 -3
  6. {llguidance-0.7.14 → llguidance-0.7.15}/docs/syntax.md +2 -2
  7. {llguidance-0.7.14 → llguidance-0.7.15}/json_stats/expected_maskbench.json +710 -1280
  8. {llguidance-0.7.14 → llguidance-0.7.15}/json_stats/src/json_stats.rs +5 -0
  9. {llguidance-0.7.14 → llguidance-0.7.15}/parser/Cargo.toml +1 -1
  10. {llguidance-0.7.14 → llguidance-0.7.15}/parser/llguidance.h +18 -1
  11. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/api.rs +2 -0
  12. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/earley/from_guidance.rs +61 -0
  13. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/earley/lexerspec.rs +20 -0
  14. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/earley/mod.rs +1 -0
  15. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/earley/parser.rs +12 -2
  16. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/earley/regexvec.rs +4 -0
  17. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/ffi.rs +53 -2
  18. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/grammar_builder.rs +21 -0
  19. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/json/compiler.rs +151 -192
  20. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/json/numeric.rs +40 -19
  21. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/json/schema.rs +353 -301
  22. llguidance-0.7.15/parser/src/json/shared_context.rs +192 -0
  23. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/matcher.rs +7 -0
  24. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/tokenparser.rs +4 -0
  25. {llguidance-0.7.14 → llguidance-0.7.15}/pyproject.toml +1 -1
  26. {llguidance-0.7.14 → llguidance-0.7.15}/python/llguidance/_lib.pyi +25 -0
  27. {llguidance-0.7.14 → llguidance-0.7.15}/python/torch_tests/test_matcher.py +48 -18
  28. {llguidance-0.7.14 → llguidance-0.7.15}/python_ext/Cargo.toml +1 -1
  29. {llguidance-0.7.14 → llguidance-0.7.15}/python_ext/src/llmatcher.rs +27 -3
  30. {llguidance-0.7.14 → llguidance-0.7.15}/python_ext/src/py.rs +1 -0
  31. llguidance-0.7.15/sample_parser/data/ulysses.md +14613 -0
  32. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/tests/test_lark.rs +207 -0
  33. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/test-guidance.sh +3 -3
  34. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie/Cargo.toml +1 -1
  35. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie_hf_downloader/Cargo.toml +1 -1
  36. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie_hf_tokenizers/Cargo.toml +1 -1
  37. llguidance-0.7.14/parser/src/json/shared_context.rs +0 -67
  38. {llguidance-0.7.14 → llguidance-0.7.15}/.github/workflows/rust.yml +0 -0
  39. {llguidance-0.7.14 → llguidance-0.7.15}/.github/workflows/wheels.yml +0 -0
  40. {llguidance-0.7.14 → llguidance-0.7.15}/.gitignore +0 -0
  41. {llguidance-0.7.14 → llguidance-0.7.15}/CODE_OF_CONDUCT.md +0 -0
  42. {llguidance-0.7.14 → llguidance-0.7.15}/Cargo.toml +0 -0
  43. {llguidance-0.7.14 → llguidance-0.7.15}/LICENSE +0 -0
  44. {llguidance-0.7.14 → llguidance-0.7.15}/SECURITY.md +0 -0
  45. {llguidance-0.7.14 → llguidance-0.7.15}/SUPPORT.md +0 -0
  46. {llguidance-0.7.14 → llguidance-0.7.15}/c_sample/Makefile +0 -0
  47. {llguidance-0.7.14 → llguidance-0.7.15}/c_sample/README.md +0 -0
  48. {llguidance-0.7.14 → llguidance-0.7.15}/c_sample/c_sample.cpp +0 -0
  49. {llguidance-0.7.14 → llguidance-0.7.15}/docs/fast_forward.md +0 -0
  50. {llguidance-0.7.14 → llguidance-0.7.15}/docs/mask_plot.png +0 -0
  51. {llguidance-0.7.14 → llguidance-0.7.15}/docs/optimizations.md +0 -0
  52. {llguidance-0.7.14 → llguidance-0.7.15}/docs/special_tokens.md +0 -0
  53. {llguidance-0.7.14 → llguidance-0.7.15}/docs/toktrie.md +0 -0
  54. {llguidance-0.7.14 → llguidance-0.7.15}/json_stats/Cargo.toml +0 -0
  55. {llguidance-0.7.14 → llguidance-0.7.15}/json_stats/jstats.sh +0 -0
  56. {llguidance-0.7.14 → llguidance-0.7.15}/json_stats/scripts/split-stats.sh +0 -0
  57. {llguidance-0.7.14 → llguidance-0.7.15}/json_stats/scripts/split_plot.py +0 -0
  58. {llguidance-0.7.14 → llguidance-0.7.15}/json_stats/src/lib.rs +0 -0
  59. {llguidance-0.7.14 → llguidance-0.7.15}/json_stats/src/stats.rs +0 -0
  60. {llguidance-0.7.14 → llguidance-0.7.15}/parser/LICENSE +0 -0
  61. {llguidance-0.7.14 → llguidance-0.7.15}/parser/README.md +0 -0
  62. {llguidance-0.7.14 → llguidance-0.7.15}/parser/build.rs +0 -0
  63. {llguidance-0.7.14 → llguidance-0.7.15}/parser/cbindgen.toml +0 -0
  64. {llguidance-0.7.14 → llguidance-0.7.15}/parser/grammars/character.json +0 -0
  65. {llguidance-0.7.14 → llguidance-0.7.15}/parser/grammars/json.json +0 -0
  66. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/constraint.rs +0 -0
  67. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/earley/grammar.rs +0 -0
  68. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/earley/lexer.rs +0 -0
  69. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/earley/perf.rs +0 -0
  70. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/earley/slicer.rs +0 -0
  71. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/factory.rs +0 -0
  72. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/ffi_par.rs +0 -0
  73. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/json/README.md +0 -0
  74. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/json/context_ref.rs +0 -0
  75. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/json/context_simple/context.rs +0 -0
  76. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/json/context_simple/draft.rs +0 -0
  77. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/json/context_simple/mod.rs +0 -0
  78. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/json/formats.rs +0 -0
  79. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/json/mod.rs +0 -0
  80. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/json_validation.rs +0 -0
  81. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/lark/README.md +0 -0
  82. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/lark/ast.rs +0 -0
  83. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/lark/common.rs +0 -0
  84. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/lark/compiler.rs +0 -0
  85. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/lark/lexer.rs +0 -0
  86. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/lark/mod.rs +0 -0
  87. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/lark/parser.rs +0 -0
  88. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/lib.rs +0 -0
  89. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/logging.rs +0 -0
  90. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/output.rs +0 -0
  91. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/panic_utils.rs +0 -0
  92. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/regex_rewrite.rs +0 -0
  93. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/stop_controller.rs +0 -0
  94. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/substring.rs +0 -0
  95. {llguidance-0.7.14 → llguidance-0.7.15}/parser/src/tokenizer_json.rs +0 -0
  96. {llguidance-0.7.14 → llguidance-0.7.15}/plan.md +0 -0
  97. {llguidance-0.7.14 → llguidance-0.7.15}/python/llguidance/__init__.py +0 -0
  98. {llguidance-0.7.14 → llguidance-0.7.15}/python/llguidance/_grammar_from.py +0 -0
  99. {llguidance-0.7.14 → llguidance-0.7.15}/python/llguidance/_struct_tag.py +0 -0
  100. {llguidance-0.7.14 → llguidance-0.7.15}/python/llguidance/_tokenizer.py +0 -0
  101. {llguidance-0.7.14 → llguidance-0.7.15}/python/llguidance/_util.py +0 -0
  102. {llguidance-0.7.14 → llguidance-0.7.15}/python/llguidance/cli.py +0 -0
  103. {llguidance-0.7.14 → llguidance-0.7.15}/python/llguidance/gbnf_to_lark.py +0 -0
  104. {llguidance-0.7.14 → llguidance-0.7.15}/python/llguidance/hf.py +0 -0
  105. {llguidance-0.7.14 → llguidance-0.7.15}/python/llguidance/mlx.py +0 -0
  106. {llguidance-0.7.14 → llguidance-0.7.15}/python/llguidance/numpy.py +0 -0
  107. {llguidance-0.7.14 → llguidance-0.7.15}/python/llguidance/py.typed +0 -0
  108. {llguidance-0.7.14 → llguidance-0.7.15}/python/llguidance/torch.py +0 -0
  109. {llguidance-0.7.14 → llguidance-0.7.15}/python/mypy.ini +0 -0
  110. {llguidance-0.7.14 → llguidance-0.7.15}/python/torch_tests/__init__.py +0 -0
  111. {llguidance-0.7.14 → llguidance-0.7.15}/python/torch_tests/test_bitmask.py +0 -0
  112. {llguidance-0.7.14 → llguidance-0.7.15}/python/torch_tests/test_hf.py +0 -0
  113. {llguidance-0.7.14 → llguidance-0.7.15}/python_ext/src/lib.rs +0 -0
  114. {llguidance-0.7.14 → llguidance-0.7.15}/python_ext/src/llinterpreter.rs +0 -0
  115. {llguidance-0.7.14 → llguidance-0.7.15}/python_ext/src/parserlimits.rs +0 -0
  116. {llguidance-0.7.14 → llguidance-0.7.15}/python_ext/src/pyjson.rs +0 -0
  117. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/Cargo.toml +0 -0
  118. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/README.md +0 -0
  119. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/cli.sh +0 -0
  120. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/data/blog.sample.json +0 -0
  121. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/data/blog.schema.json +0 -0
  122. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/data/blog.schema.ll.json +0 -0
  123. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/data/from-llama.cpp/README.md +0 -0
  124. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/data/from-llama.cpp/arithmetic.gbnf +0 -0
  125. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/data/from-llama.cpp/c.gbnf +0 -0
  126. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/data/from-llama.cpp/chess.gbnf +0 -0
  127. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/data/from-llama.cpp/english.gbnf +0 -0
  128. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/data/from-llama.cpp/japanese.gbnf +0 -0
  129. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/data/from-llama.cpp/json.gbnf +0 -0
  130. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/data/from-llama.cpp/json_arr.gbnf +0 -0
  131. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/data/from-llama.cpp/list.gbnf +0 -0
  132. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/data/from-llama.cpp/vllm-sql.gbnf +0 -0
  133. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/data/lark.lark +0 -0
  134. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/data/rfc.lark +0 -0
  135. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/data/rfc.xml +0 -0
  136. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/gtest.sh +0 -0
  137. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/lark.sh +0 -0
  138. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/run.sh +0 -0
  139. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/src/lib.rs +0 -0
  140. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/src/minimal.rs +0 -0
  141. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/src/sample_parser.rs +0 -0
  142. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/tests/test_ll.rs +0 -0
  143. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/tests/test_raw_parser.rs +0 -0
  144. {llguidance-0.7.14 → llguidance-0.7.15}/sample_parser/tests/test_stop.rs +0 -0
  145. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/annotate_asm.js +0 -0
  146. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/bump.py +0 -0
  147. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/cbindgen.sh +0 -0
  148. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/checklinks.py +0 -0
  149. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/checklinks.sh +0 -0
  150. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/ci-publish.py +0 -0
  151. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/disasm.sh +0 -0
  152. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/gbnf_to_lark.py +0 -0
  153. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/gen-testcase.py +0 -0
  154. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/git-version.sh +0 -0
  155. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/install-deps.sh +0 -0
  156. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/jsonschema-stats.js +0 -0
  157. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/remote-guidance-test.sh +0 -0
  158. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/rust-size.js +0 -0
  159. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/rust_size.py +0 -0
  160. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/tokenizer_test.py +0 -0
  161. {llguidance-0.7.14 → llguidance-0.7.15}/scripts/update-git.py +0 -0
  162. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie/LICENSE +0 -0
  163. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie/README.md +0 -0
  164. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie/src/bytes.rs +0 -0
  165. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie/src/lib.rs +0 -0
  166. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie/src/recognizer.rs +0 -0
  167. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie/src/rng.rs +0 -0
  168. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie/src/svob.rs +0 -0
  169. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie/src/tokenv.rs +0 -0
  170. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie/src/toktree.rs +0 -0
  171. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie/tests/test_svob.rs +0 -0
  172. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie_hf_downloader/LICENSE +0 -0
  173. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie_hf_downloader/src/lib.rs +0 -0
  174. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie_hf_tokenizers/LICENSE +0 -0
  175. {llguidance-0.7.14 → llguidance-0.7.15}/toktrie_hf_tokenizers/src/lib.rs +0 -0
@@ -4,6 +4,12 @@ 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.15](https://github.com/guidance-ai/llguidance/compare/v0.7.14...0.7.15) 2025-04-16
8
+
9
+ - support for patternProperties in JSON schema [`#167`](https://github.com/guidance-ai/llguidance/pull/167)
10
+ - add lenient option to JSON schemas [`#163`](https://github.com/guidance-ai/llguidance/pull/163) [`#136`](https://github.com/guidance-ai/llguidance/issues/136)
11
+ - Add llg_validate_grammar() in C FFI [`e5c21cf`](https://github.com/guidance-ai/llguidance/commit/e5c21cf480a17e6b310e46b24b272576cfd9c4c6)
12
+
7
13
  #### [0.7.14](https://github.com/guidance-ai/llguidance/compare/v0.7.13...0.7.14) 2025-04-11
8
14
 
9
15
  - 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.14"
1181
+ version = "0.7.15"
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.14"
1200
+ version = "0.7.15"
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.14"
2365
+ version = "0.7.15"
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.14"
2376
+ version = "0.7.15"
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.14"
2387
+ version = "0.7.15"
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.14
3
+ Version: 0.7.15
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` - not supported right now, use `anyOf` instead, [issue](https://github.com/microsoft/llguidance/issues/77)
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` (though we always anchor them, [issue](https://github.com/microsoft/llguidance/issues/66))
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 `"additionalPropertie"`)
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 should use `%json { "anyOf": [ ... ] }`.
60
- Do not use `fun_call1 | fun_call2`, as it [currently doesn't work](https://github.com/guidance-ai/llguidance/issues/113).
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