llguidance 1.1.0__tar.gz → 1.1.2__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 (192) hide show
  1. llguidance-1.1.2/.github/workflows/code-coverage.yml +62 -0
  2. {llguidance-1.1.0 → llguidance-1.1.2}/CHANGELOG.md +37 -27
  3. {llguidance-1.1.0 → llguidance-1.1.2}/Cargo.lock +105 -6
  4. {llguidance-1.1.0 → llguidance-1.1.2}/PKG-INFO +2 -2
  5. {llguidance-1.1.0 → llguidance-1.1.2}/parser/Cargo.toml +1 -1
  6. {llguidance-1.1.0 → llguidance-1.1.2}/parser/llguidance.h +6 -0
  7. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/api.rs +6 -0
  8. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/matcher.rs +1 -0
  9. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/panic_utils.rs +1 -1
  10. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/tokenparser.rs +20 -6
  11. {llguidance-1.1.0 → llguidance-1.1.2}/pyproject.toml +1 -1
  12. {llguidance-1.1.0 → llguidance-1.1.2}/python/llguidance/_lib.pyi +9 -0
  13. {llguidance-1.1.0 → llguidance-1.1.2}/python_ext/Cargo.toml +1 -1
  14. {llguidance-1.1.0 → llguidance-1.1.2}/python_ext/src/parserlimits.rs +11 -1
  15. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/Cargo.toml +3 -0
  16. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/tests/common_lark_utils/mod.rs +59 -5
  17. llguidance-1.1.2/sample_parser/tests/test_json_arrays.rs +216 -0
  18. llguidance-1.1.2/sample_parser/tests/test_json_enum_const.rs +92 -0
  19. llguidance-1.1.2/sample_parser/tests/test_json_objects.rs +203 -0
  20. llguidance-1.1.2/sample_parser/tests/test_json_primitives.rs +540 -0
  21. llguidance-1.1.2/sample_parser/tests/test_json_schema_combinations.rs +154 -0
  22. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/tests/test_raw_parser.rs +45 -0
  23. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/bump.py +2 -3
  24. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie/Cargo.toml +1 -1
  25. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie_hf_downloader/Cargo.toml +1 -1
  26. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie_hf_tokenizers/Cargo.toml +1 -1
  27. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie_tiktoken/Cargo.toml +1 -1
  28. {llguidance-1.1.0 → llguidance-1.1.2}/.github/workflows/rust.yml +0 -0
  29. {llguidance-1.1.0 → llguidance-1.1.2}/.github/workflows/wheels.yml +0 -0
  30. {llguidance-1.1.0 → llguidance-1.1.2}/.gitignore +0 -0
  31. {llguidance-1.1.0 → llguidance-1.1.2}/CODE_OF_CONDUCT.md +0 -0
  32. {llguidance-1.1.0 → llguidance-1.1.2}/Cargo.toml +0 -0
  33. {llguidance-1.1.0 → llguidance-1.1.2}/LICENSE +0 -0
  34. {llguidance-1.1.0 → llguidance-1.1.2}/README.md +0 -0
  35. {llguidance-1.1.0 → llguidance-1.1.2}/SECURITY.md +0 -0
  36. {llguidance-1.1.0 → llguidance-1.1.2}/SUPPORT.md +0 -0
  37. {llguidance-1.1.0 → llguidance-1.1.2}/c_sample/Makefile +0 -0
  38. {llguidance-1.1.0 → llguidance-1.1.2}/c_sample/README.md +0 -0
  39. {llguidance-1.1.0 → llguidance-1.1.2}/c_sample/c_sample.cpp +0 -0
  40. {llguidance-1.1.0 → llguidance-1.1.2}/docs/de_recursing.md +0 -0
  41. {llguidance-1.1.0 → llguidance-1.1.2}/docs/fast_forward.md +0 -0
  42. {llguidance-1.1.0 → llguidance-1.1.2}/docs/json_schema.md +0 -0
  43. {llguidance-1.1.0 → llguidance-1.1.2}/docs/mask_plot.png +0 -0
  44. {llguidance-1.1.0 → llguidance-1.1.2}/docs/optimizations.md +0 -0
  45. {llguidance-1.1.0 → llguidance-1.1.2}/docs/parametric.md +0 -0
  46. {llguidance-1.1.0 → llguidance-1.1.2}/docs/special_tokens.md +0 -0
  47. {llguidance-1.1.0 → llguidance-1.1.2}/docs/syntax.md +0 -0
  48. {llguidance-1.1.0 → llguidance-1.1.2}/docs/toktrie.md +0 -0
  49. {llguidance-1.1.0 → llguidance-1.1.2}/json_stats/Cargo.toml +0 -0
  50. {llguidance-1.1.0 → llguidance-1.1.2}/json_stats/expected_maskbench.json +0 -0
  51. {llguidance-1.1.0 → llguidance-1.1.2}/json_stats/jstats.sh +0 -0
  52. {llguidance-1.1.0 → llguidance-1.1.2}/json_stats/scripts/split-stats.sh +0 -0
  53. {llguidance-1.1.0 → llguidance-1.1.2}/json_stats/scripts/split_plot.py +0 -0
  54. {llguidance-1.1.0 → llguidance-1.1.2}/json_stats/src/json_stats.rs +0 -0
  55. {llguidance-1.1.0 → llguidance-1.1.2}/json_stats/src/lib.rs +0 -0
  56. {llguidance-1.1.0 → llguidance-1.1.2}/json_stats/src/stats.rs +0 -0
  57. {llguidance-1.1.0 → llguidance-1.1.2}/parser/LICENSE +0 -0
  58. {llguidance-1.1.0 → llguidance-1.1.2}/parser/README.md +0 -0
  59. {llguidance-1.1.0 → llguidance-1.1.2}/parser/build.rs +0 -0
  60. {llguidance-1.1.0 → llguidance-1.1.2}/parser/cbindgen.toml +0 -0
  61. {llguidance-1.1.0 → llguidance-1.1.2}/parser/grammars/character.json +0 -0
  62. {llguidance-1.1.0 → llguidance-1.1.2}/parser/grammars/json.json +0 -0
  63. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/constraint.rs +0 -0
  64. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/earley/from_guidance.rs +0 -0
  65. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/earley/grammar.rs +0 -0
  66. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/earley/lexer.rs +0 -0
  67. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/earley/lexerspec.rs +0 -0
  68. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/earley/mod.rs +0 -0
  69. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/earley/parser.rs +0 -0
  70. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/earley/perf.rs +0 -0
  71. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/earley/regexvec.rs +0 -0
  72. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/earley/slicer.rs +0 -0
  73. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/factory.rs +0 -0
  74. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/ffi.rs +0 -0
  75. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/ffi_par.rs +0 -0
  76. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/grammar_builder.rs +0 -0
  77. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/hashcons.rs +0 -0
  78. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/json/README.md +0 -0
  79. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/json/compiler.rs +0 -0
  80. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/json/context_ref.rs +0 -0
  81. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/json/context_simple/context.rs +0 -0
  82. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/json/context_simple/draft.rs +0 -0
  83. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/json/context_simple/mod.rs +0 -0
  84. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/json/formats.rs +0 -0
  85. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/json/mod.rs +0 -0
  86. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/json/numeric.rs +0 -0
  87. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/json/schema.rs +0 -0
  88. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/json/shared_context.rs +0 -0
  89. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/json_validation.rs +0 -0
  90. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/lark/README.md +0 -0
  91. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/lark/ast.rs +0 -0
  92. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/lark/common.rs +0 -0
  93. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/lark/compiler.rs +0 -0
  94. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/lark/lexer.rs +0 -0
  95. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/lark/mod.rs +0 -0
  96. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/lark/parser.rs +0 -0
  97. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/lib.rs +0 -0
  98. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/logging.rs +0 -0
  99. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/output.rs +0 -0
  100. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/regex_rewrite.rs +0 -0
  101. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/stop_controller.rs +0 -0
  102. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/substring.rs +0 -0
  103. {llguidance-1.1.0 → llguidance-1.1.2}/parser/src/tokenizer_json.rs +0 -0
  104. {llguidance-1.1.0 → llguidance-1.1.2}/plan.md +0 -0
  105. {llguidance-1.1.0 → llguidance-1.1.2}/python/llguidance/__init__.py +0 -0
  106. {llguidance-1.1.0 → llguidance-1.1.2}/python/llguidance/_grammar_from.py +0 -0
  107. {llguidance-1.1.0 → llguidance-1.1.2}/python/llguidance/_struct_tag.py +0 -0
  108. {llguidance-1.1.0 → llguidance-1.1.2}/python/llguidance/_tokenizer.py +0 -0
  109. {llguidance-1.1.0 → llguidance-1.1.2}/python/llguidance/_util.py +0 -0
  110. {llguidance-1.1.0 → llguidance-1.1.2}/python/llguidance/cli.py +0 -0
  111. {llguidance-1.1.0 → llguidance-1.1.2}/python/llguidance/gbnf_to_lark.py +0 -0
  112. {llguidance-1.1.0 → llguidance-1.1.2}/python/llguidance/hf.py +0 -0
  113. {llguidance-1.1.0 → llguidance-1.1.2}/python/llguidance/llamacpp.py +0 -0
  114. {llguidance-1.1.0 → llguidance-1.1.2}/python/llguidance/mlx.py +0 -0
  115. {llguidance-1.1.0 → llguidance-1.1.2}/python/llguidance/numpy.py +0 -0
  116. {llguidance-1.1.0 → llguidance-1.1.2}/python/llguidance/py.typed +0 -0
  117. {llguidance-1.1.0 → llguidance-1.1.2}/python/llguidance/tiktoken.py +0 -0
  118. {llguidance-1.1.0 → llguidance-1.1.2}/python/llguidance/torch.py +0 -0
  119. {llguidance-1.1.0 → llguidance-1.1.2}/python/mypy.ini +0 -0
  120. {llguidance-1.1.0 → llguidance-1.1.2}/python/torch_tests/__init__.py +0 -0
  121. {llguidance-1.1.0 → llguidance-1.1.2}/python/torch_tests/test_bitmask.py +0 -0
  122. {llguidance-1.1.0 → llguidance-1.1.2}/python/torch_tests/test_hf.py +0 -0
  123. {llguidance-1.1.0 → llguidance-1.1.2}/python/torch_tests/test_llamacpp.py +0 -0
  124. {llguidance-1.1.0 → llguidance-1.1.2}/python/torch_tests/test_matcher.py +0 -0
  125. {llguidance-1.1.0 → llguidance-1.1.2}/python/torch_tests/test_tiktoken.py +0 -0
  126. {llguidance-1.1.0 → llguidance-1.1.2}/python_ext/src/lib.rs +0 -0
  127. {llguidance-1.1.0 → llguidance-1.1.2}/python_ext/src/llamatokenizer.rs +0 -0
  128. {llguidance-1.1.0 → llguidance-1.1.2}/python_ext/src/llinterpreter.rs +0 -0
  129. {llguidance-1.1.0 → llguidance-1.1.2}/python_ext/src/llmatcher.rs +0 -0
  130. {llguidance-1.1.0 → llguidance-1.1.2}/python_ext/src/py.rs +0 -0
  131. {llguidance-1.1.0 → llguidance-1.1.2}/python_ext/src/pyjson.rs +0 -0
  132. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/README.md +0 -0
  133. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/cli.sh +0 -0
  134. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/blog.sample.json +0 -0
  135. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/blog.schema.json +0 -0
  136. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/blog.schema.ll.json +0 -0
  137. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/from-llama.cpp/README.md +0 -0
  138. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/from-llama.cpp/arithmetic.gbnf +0 -0
  139. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/from-llama.cpp/c.gbnf +0 -0
  140. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/from-llama.cpp/chess.gbnf +0 -0
  141. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/from-llama.cpp/english.gbnf +0 -0
  142. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/from-llama.cpp/japanese.gbnf +0 -0
  143. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/from-llama.cpp/json.gbnf +0 -0
  144. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/from-llama.cpp/json_arr.gbnf +0 -0
  145. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/from-llama.cpp/list.gbnf +0 -0
  146. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/from-llama.cpp/vllm-sql.gbnf +0 -0
  147. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/lark.lark +0 -0
  148. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/rfc.lark +0 -0
  149. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/rfc.xml +0 -0
  150. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/data/ulysses.md +0 -0
  151. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/gtest.sh +0 -0
  152. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/lark.sh +0 -0
  153. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/run.sh +0 -0
  154. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/src/lib.rs +0 -0
  155. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/src/minimal.rs +0 -0
  156. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/src/sample_parser.rs +0 -0
  157. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/tests/test_lark.rs +0 -0
  158. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/tests/test_ll.rs +0 -0
  159. {llguidance-1.1.0 → llguidance-1.1.2}/sample_parser/tests/test_stop.rs +0 -0
  160. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/annotate_asm.js +0 -0
  161. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/cbindgen.sh +0 -0
  162. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/checklinks.py +0 -0
  163. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/checklinks.sh +0 -0
  164. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/ci-publish.py +0 -0
  165. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/disasm.sh +0 -0
  166. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/gbnf_to_lark.py +0 -0
  167. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/gen-testcase.py +0 -0
  168. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/git-version.sh +0 -0
  169. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/install-deps.sh +0 -0
  170. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/jsonschema-stats.js +0 -0
  171. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/remote-guidance-test.sh +0 -0
  172. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/rust-size.js +0 -0
  173. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/rust_size.py +0 -0
  174. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/test-guidance.sh +0 -0
  175. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/tokenizer_test.py +0 -0
  176. {llguidance-1.1.0 → llguidance-1.1.2}/scripts/update-git.py +0 -0
  177. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie/LICENSE +0 -0
  178. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie/README.md +0 -0
  179. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie/src/bytes.rs +0 -0
  180. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie/src/lib.rs +0 -0
  181. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie/src/recognizer.rs +0 -0
  182. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie/src/rng.rs +0 -0
  183. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie/src/svob.rs +0 -0
  184. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie/src/tokenv.rs +0 -0
  185. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie/src/toktree.rs +0 -0
  186. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie/tests/test_svob.rs +0 -0
  187. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie_hf_downloader/LICENSE +0 -0
  188. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie_hf_downloader/src/lib.rs +0 -0
  189. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie_hf_tokenizers/LICENSE +0 -0
  190. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie_hf_tokenizers/src/lib.rs +0 -0
  191. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie_tiktoken/LICENSE +0 -0
  192. {llguidance-1.1.0 → llguidance-1.1.2}/toktrie_tiktoken/src/lib.rs +0 -0
@@ -0,0 +1,62 @@
1
+ name: Code Coverage
2
+ permissions:
3
+ contents: read
4
+
5
+
6
+ on:
7
+ pull_request:
8
+ push:
9
+ branches: [ "main" ]
10
+ workflow_dispatch:
11
+ inputs:
12
+ commit_id:
13
+ description: 'Branch or Commit ID (optional)'
14
+ required: false
15
+ type: string
16
+
17
+
18
+ env:
19
+ CARGO_TERM_COLOR: always
20
+ RUSTFLAGS: "-Cinstrument-coverage"
21
+ LLVM_PROFILE_FILE: "llg-%p-%m.profraw"
22
+
23
+
24
+ jobs:
25
+ code-cov:
26
+ runs-on: ubuntu-latest
27
+
28
+ steps:
29
+ - name: Checkout repo at ${{ github.event_name == 'workflow_dispatch' && inputs.commit_id || github.sha }}
30
+ uses: actions/checkout@v4
31
+ with:
32
+ ref: ${{ github.event_name == 'workflow_dispatch' && inputs.commit_id || github.sha }}
33
+
34
+ - name: Update toolchain
35
+ run: rustup component add llvm-tools
36
+
37
+ - name: Install grcov
38
+ run: cargo install grcov
39
+
40
+ - name: Build everything
41
+ run: cargo build
42
+
43
+ - name: Run tests
44
+ run: cargo test
45
+
46
+ - name: Check environment
47
+ run: |
48
+ echo "CARGO_TERM_COLOR: $CARGO_TERM_COLOR"
49
+ echo "RUSTFLAGS: $RUSTFLAGS"
50
+ echo "LLVM_PROFILE_FILE: $LLVM_PROFILE_FILE"
51
+
52
+ - name: Generate coverage report
53
+ run: |
54
+ grcov . -s . --binary-path target/debug/ -t html --branch --ignore-not-existing -o target/debug/coverage/
55
+
56
+ - name: Check output
57
+ run: ls target/debug/coverage/
58
+
59
+ - uses: actions/upload-artifact@v4
60
+ with:
61
+ name: coverage-report
62
+ path: target/debug/coverage/
@@ -4,104 +4,114 @@ 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
- #### [1.1.0](https://github.com/guidance-ai/llguidance/compare/v1.0.1...1.1.0) 2025-07-18
7
+ #### [v1.1.2](https://github.com/guidance-ai/llguidance/compare/v1.1.1...v1.1.2) 2025-08-08
8
8
 
9
- - disable hf tokenizer truncation and padding [`#205`](https://github.com//hudson-ai/llguidance.git/pull/205); fixes [`#1322`](https://github.com/guidance-ai/guidance/issues/1322)
10
- - llama_cpp tokenizers: infer added tokens starting/ending with < and > to be special tokens [`#202`](https://github.com//hudson-ai/llguidance.git/pull/202)
11
- - add lark syntax for "any token" and negation of token ranges [`#201`](https://github.com//hudson-ai/llguidance.git/pull/201)
12
- - add de-recursion cook book to docs [`#199`](https://github.com//hudson-ai/llguidance.git/pull/199)
9
+ - add flag in ParserLimits to disable verbose errors [`#227`](https://github.com/guidance-ai/llguidance/pull/227)
10
+ - new tests and cleanups
13
11
 
14
- #### [1.0.1](https://github.com/guidance-ai/llguidance/compare/v1.0.0...1.0.1) 2025-07-03
12
+ #### [v1.1.1](https://github.com/guidance-ai/llguidance/compare/v1.1.0...v1.1.1) 2025-07-23
13
+
14
+ - prevent error state when calling `try_consume_tokens` after parser is stopped [`#213`](https://github.com/guidance-ai/llguidance/pull/213); fixes [`#211`](https://github.com/guidance-ai/llguidance/issues/211)
15
+ - set parser stop condition in `try_consume_tokens` even when some tokens are rejected [`#212`](https://github.com/guidance-ai/llguidance/pull/212)
16
+
17
+ #### [v1.1.0](https://github.com/guidance-ai/llguidance/compare/v1.0.1...v1.1.0) 2025-07-18
18
+
19
+ - disable hf tokenizer truncation and padding [`#205`](https://github.com/guidance-ai/llguidance/pull/205); fixes [`#1322`](https://github.com/guidance-ai/guidance/issues/1322)
20
+ - llama_cpp tokenizers: infer added tokens starting/ending with < and > to be special tokens [`#202`](https://github.com/guidance-ai/llguidance/pull/202)
21
+ - add lark syntax for "any token" and negation of token ranges [`#201`](https://github.com/guidance-ai/llguidance/pull/201)
22
+ - add de-recursion cook book to docs [`#199`](https://github.com/guidance-ai/llguidance/pull/199)
23
+
24
+ #### [v1.0.1](https://github.com/guidance-ai/llguidance/compare/v1.0.0...v1.0.1) 2025-07-03
15
25
 
16
26
  - fix: tokenizers normalizers sequence api changed [`#195`](https://github.com/guidance-ai/llguidance/pull/195)
17
27
  - Strip debug info from the wheels [`#194`](https://github.com/guidance-ai/llguidance/pull/194)
18
28
 
19
29
  Thank you @ammar-elsabe and @Ahajha!
20
30
 
21
- #### [1.0.0](https://github.com/guidance-ai/llguidance/compare/v0.7.30...1.0.0) 2025-06-23
31
+ #### [v1.0.0](https://github.com/guidance-ai/llguidance/compare/v0.7.30...v1.0.0) 2025-06-23
22
32
 
23
33
  This is identical to `0.7.30`, but indicates intended stability and from now on we'll try to follow semver.
24
34
 
25
- #### [0.7.30](https://github.com/guidance-ai/llguidance/compare/v0.7.29...0.7.30) 2025-06-23
35
+ #### [v0.7.30](https://github.com/guidance-ai/llguidance/compare/v0.7.29...v0.7.30) 2025-06-23
26
36
 
27
37
  - parametric grammars [`#192`](https://github.com/guidance-ai/llguidance/pull/192)
28
38
  - allow for tokens up to ~2k bytes; fixes #188 [`#188`](https://github.com/guidance-ai/llguidance/issues/188)
29
39
 
30
- #### [0.7.29](https://github.com/guidance-ai/llguidance/compare/v0.7.28...0.7.29) 2025-06-06
40
+ #### [v0.7.29](https://github.com/guidance-ai/llguidance/compare/v0.7.28...v0.7.29) 2025-06-06
31
41
 
32
42
  - cargo fmt
33
43
 
34
- #### [0.7.28](https://github.com/guidance-ai/llguidance/compare/v0.7.27...0.7.28) 2025-06-06
44
+ #### [v0.7.28](https://github.com/guidance-ai/llguidance/compare/v0.7.27...v0.7.28) 2025-06-06
35
45
 
36
46
  - fix lexer_stack=... panic with numeric tokens [`4e91b0f`](https://github.com/guidance-ai/llguidance/commit/4e91b0fa0c03572a5fc221ac0e0b05035af9dcfa)
37
47
 
38
- #### [0.7.27](https://github.com/guidance-ai/llguidance/compare/v0.7.26...0.7.27) 2025-06-04
48
+ #### [v0.7.27](https://github.com/guidance-ai/llguidance/compare/v0.7.26...v0.7.27) 2025-06-04
39
49
 
40
50
  - add toktrie_tiktoken and llguidance.tiktoken.lltokenizer_from_encoding [`#154`](https://github.com/guidance-ai/llguidance/issues/154)
41
51
  - implement clone on StopController [`#185`](https://github.com/guidance-ai/llguidance/issues/185)
42
52
 
43
- #### [0.7.26](https://github.com/guidance-ai/llguidance/compare/v0.7.25...0.7.26) 2025-05-30
53
+ #### [v0.7.26](https://github.com/guidance-ai/llguidance/compare/v0.7.25...v0.7.26) 2025-05-30
44
54
 
45
55
  - add support for & and ~ in lark regexes [`96fcee3`](https://github.com/guidance-ai/llguidance/commit/96fcee373697b57bead94d1bc06c17cf1c6134e4)
46
56
  - dump grammar in errors in LLInterpreter [`#183`](https://github.com/guidance-ai/llguidance/pull/183)
47
57
  - don't check lexer bytes invariant when we cannot rollback [`ec22083`](https://github.com/guidance-ai/llguidance/commit/ec220837051513a70177974ca389b7bf387455f1)
48
58
 
49
59
 
50
- #### [0.7.25](https://github.com/guidance-ai/llguidance/compare/v0.7.24...0.7.25) 2025-05-28
60
+ #### [v0.7.25](https://github.com/guidance-ai/llguidance/compare/v0.7.24...v0.7.25) 2025-05-28
51
61
 
52
62
  - add parse_special=False to tokenize_str/bytes() in python [`#181`](https://github.com/guidance-ai/llguidance/pull/181)
53
63
 
54
- #### [0.7.24](https://github.com/guidance-ai/llguidance/compare/v0.7.23...0.7.24) 2025-05-23
64
+ #### [v0.7.24](https://github.com/guidance-ai/llguidance/compare/v0.7.23...v0.7.24) 2025-05-23
55
65
 
56
66
  - add the sentinel token hack, fixes #180 [`#180`](https://github.com/guidance-ai/llguidance/issues/180)
57
67
 
58
- #### [0.7.23](https://github.com/guidance-ai/llguidance/compare/v0.7.22...0.7.23) 2025-05-22
68
+ #### [v0.7.23](https://github.com/guidance-ai/llguidance/compare/v0.7.22...v0.7.23) 2025-05-22
59
69
 
60
70
  - native llama.cpp tokenizer support [`#179`](https://github.com/guidance-ai/llguidance/pull/179)
61
71
  - improve special token detection in HF tokenizers [`6cae393`](https://github.com/guidance-ai/llguidance/commit/6cae393b9c04fe67621615ff22b46beab512d069)
62
72
 
63
- #### [0.7.22](https://github.com/guidance-ai/llguidance/compare/v0.7.21...0.7.22) 2025-05-21
73
+ #### [v0.7.22](https://github.com/guidance-ai/llguidance/compare/v0.7.21...v0.7.22) 2025-05-21
64
74
 
65
75
  - Keep EOS token bytes in `TokenizerWrapper` [`#178`](https://github.com/guidance-ai/llguidance/pull/178)
66
76
  - Stop using prefix/sentinel strings for `TokenizerWrapper` [`#175`](https://github.com/guidance-ai/llguidance/pull/175)
67
77
  - avoid taking poisoned locks, see [`#174`](https://github.com/guidance-ai/llguidance/issues/174) [`d41aa9a`](https://github.com/guidance-ai/llguidance/commit/d41aa9a4427967708a951506b2bc0e395871b6c8); thanks [@g-eoj](https://github.com/g-eoj)
68
78
 
69
- #### [0.7.21](https://github.com/guidance-ai/llguidance/compare/v0.7.20...0.7.21) 2025-05-20
79
+ #### [v0.7.21](https://github.com/guidance-ai/llguidance/compare/v0.7.20...v0.7.21) 2025-05-20
70
80
 
71
81
  - include parser state in errors [`82e34da`](https://github.com/guidance-ai/llguidance/commit/82e34da704d22f04979d8cbc54a0ac00885a277d)
72
82
  - tighten email format in JSON schema [`7454ea9`](https://github.com/guidance-ai/llguidance/commit/7454ea9df958f8bcc42e6bb986d6de397de65b3e)
73
83
 
74
- #### [0.7.20](https://github.com/guidance-ai/llguidance/compare/v0.7.19...0.7.20) 2025-05-15
84
+ #### [v0.7.20](https://github.com/guidance-ai/llguidance/compare/v0.7.19...v0.7.20) 2025-05-15
75
85
 
76
86
  - use fancy-regex instead of onig as tokenizers regex library [`#172`](https://github.com/guidance-ai/llguidance/pull/172)
77
87
  - fixes compilation on GCC 15, thanks [@Slowki](https://github.com/Slowki)
78
88
  - msrv 1.80 support (incl. derivre bump) [`c89e386`](https://github.com/guidance-ai/llguidance/commit/c89e386685cd911a89fd47df225de88f88c10883), thank you [@nteodosio](https://github.com/nteodosio) for initial [PR](https://github.com/guidance-ai/llguidance/pull/170)!
79
89
 
80
- #### [0.7.19](https://github.com/guidance-ai/llguidance/compare/v0.7.18...0.7.19) 2025-04-24
90
+ #### [v0.7.19](https://github.com/guidance-ai/llguidance/compare/v0.7.18...v0.7.19) 2025-04-24
81
91
 
82
92
  - fix a numeric token bug [`1f59edf`](https://github.com/guidance-ai/llguidance/commit/1f59edfc49b44cfba74b2380f34874a0778d9441)
83
93
 
84
- #### [0.7.18](https://github.com/guidance-ai/llguidance/compare/v0.7.17...0.7.18) 2025-04-22
94
+ #### [v0.7.18](https://github.com/guidance-ai/llguidance/compare/v0.7.17...v0.7.18) 2025-04-22
85
95
 
86
96
  - apply x-guidance also in %json{} [`2627891`](https://github.com/guidance-ai/llguidance/commit/2627891c72c7e38062cd3e052f1de146d2e21635)
87
97
  - more sensible llg_validate_grammar() signature [`41928c0`](https://github.com/guidance-ai/llguidance/commit/41928c07298e69e3c8adc4a3c1f43ef9b1cc1c6b)
88
98
 
89
- #### [0.7.17](https://github.com/guidance-ai/llguidance/compare/v0.7.16...0.7.17) 2025-04-22
99
+ #### [v0.7.17](https://github.com/guidance-ai/llguidance/compare/v0.7.16...v0.7.17) 2025-04-22
90
100
 
91
101
  - support for min/maxProperties in JSON Schema [`#168`](https://github.com/guidance-ai/llguidance/issues/168)
92
102
  - give priority to <[123]> over "foo" in grammar [`3e9f3b5`](https://github.com/guidance-ai/llguidance/commit/3e9f3b5e8c1cac92daab6e9709f01ebccc20342b)
93
103
 
94
- #### [0.7.16](https://github.com/guidance-ai/llguidance/compare/v0.7.15...0.7.16) 2025-04-17
104
+ #### [v0.7.16](https://github.com/guidance-ai/llguidance/compare/v0.7.15...v0.7.16) 2025-04-17
95
105
 
96
106
  - fix special token tokenization [`ae7870f`](https://github.com/guidance-ai/llguidance/commit/ae7870f05ca0de68599088607ba742b7071f92ad)
97
107
 
98
- #### [0.7.15](https://github.com/guidance-ai/llguidance/compare/v0.7.14...0.7.15) 2025-04-16
108
+ #### [v0.7.15](https://github.com/guidance-ai/llguidance/compare/v0.7.14...v0.7.15) 2025-04-16
99
109
 
100
110
  - support for patternProperties in JSON schema [`#167`](https://github.com/guidance-ai/llguidance/pull/167)
101
111
  - add lenient option to JSON schemas [`#163`](https://github.com/guidance-ai/llguidance/pull/163) [`#136`](https://github.com/guidance-ai/llguidance/issues/136)
102
112
  - Add llg_validate_grammar() in C FFI [`e5c21cf`](https://github.com/guidance-ai/llguidance/commit/e5c21cf480a17e6b310e46b24b272576cfd9c4c6)
103
113
 
104
- #### [0.7.14](https://github.com/guidance-ai/llguidance/compare/v0.7.13...0.7.14) 2025-04-11
114
+ #### [v0.7.14](https://github.com/guidance-ai/llguidance/compare/v0.7.13...v0.7.14) 2025-04-11
105
115
 
106
116
  - support %lark { ... } syntax for nested grammars [`#157`](https://github.com/guidance-ai/llguidance/pull/157)
107
117
  - treat \d and \w in json schema as ASCII; fix ^$ anchors [`#158`](https://github.com/guidance-ai/llguidance/issues/158)
@@ -110,19 +120,19 @@ This is identical to `0.7.30`, but indicates intended stability and from now on
110
120
  - expose regex_to_lark() in Rust and Python; add \d\w\s replacement [`78fb32f`](https://github.com/guidance-ai/llguidance/commit/78fb32fe2745d30ca94a62b00e5a7299750d80b0)
111
121
  - fix usage of / vs \* in python signatures [`ca73c2a`](https://github.com/guidance-ai/llguidance/commit/ca73c2abd44e75d569230b942f53c72b052ed2ab)
112
122
 
113
- #### [0.7.13](https://github.com/guidance-ai/llguidance/compare/v0.7.12...0.7.13) 2025-04-05
123
+ #### [v0.7.13](https://github.com/guidance-ai/llguidance/compare/v0.7.12...v0.7.13) 2025-04-05
114
124
 
115
125
  - expose LLParserLimits in Python API [`598dc8f`](https://github.com/guidance-ai/llguidance/commit/598dc8f37f69f51244e54d9885445abf02a515a7)
116
126
  - pre-compute lexer states for particularly large regexes (can be disabled in ParserLimits)
117
127
 
118
- #### [0.7.12](https://github.com/guidance-ai/llguidance/compare/v0.7.11...0.7.12) 2025-04-04
128
+ #### [v0.7.12](https://github.com/guidance-ai/llguidance/compare/v0.7.11...v0.7.12) 2025-04-04
119
129
 
120
130
  - performance optimizations
121
131
  - use factory in C FFI (otherwise slicer was not used)
122
132
  - add some null checks and safety comments in C FFI
123
133
  - implement subgrammar lexeme class merging; fixes [`#113`](https://github.com/guidance-ai/llguidance/issues/113)
124
134
 
125
- #### [0.7.11](https://github.com/guidance-ai/llguidance/compare/v0.7.10...0.7.11) 2025-03-27
135
+ #### [v0.7.11](https://github.com/guidance-ai/llguidance/compare/v0.7.10...v0.7.11) 2025-03-27
126
136
 
127
137
  - add StructTag python API; fixes [`#146`](https://github.com/guidance-ai/llguidance/issues/146)
128
138
  - fix handling of AddedToken.special (gemma tokenizer, fixes [`#147`](https://github.com/guidance-ai/llguidance/issues/147))
@@ -711,6 +711,12 @@ version = "0.3.31"
711
711
  source = "registry+https://github.com/rust-lang/crates.io-index"
712
712
  checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
713
713
 
714
+ [[package]]
715
+ name = "futures-timer"
716
+ version = "3.0.3"
717
+ source = "registry+https://github.com/rust-lang/crates.io-index"
718
+ checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24"
719
+
714
720
  [[package]]
715
721
  name = "futures-util"
716
722
  version = "0.3.31"
@@ -760,6 +766,12 @@ version = "0.31.1"
760
766
  source = "registry+https://github.com/rust-lang/crates.io-index"
761
767
  checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
762
768
 
769
+ [[package]]
770
+ name = "glob"
771
+ version = "0.3.2"
772
+ source = "registry+https://github.com/rust-lang/crates.io-index"
773
+ checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
774
+
763
775
  [[package]]
764
776
  name = "h2"
765
777
  version = "0.4.11"
@@ -1229,7 +1241,7 @@ checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956"
1229
1241
 
1230
1242
  [[package]]
1231
1243
  name = "llguidance"
1232
- version = "1.1.0"
1244
+ version = "1.1.2"
1233
1245
  dependencies = [
1234
1246
  "anyhow",
1235
1247
  "derivre",
@@ -1248,7 +1260,7 @@ dependencies = [
1248
1260
 
1249
1261
  [[package]]
1250
1262
  name = "llguidance_py"
1251
- version = "1.1.0"
1263
+ version = "1.1.2"
1252
1264
  dependencies = [
1253
1265
  "anyhow",
1254
1266
  "bytemuck",
@@ -1637,6 +1649,15 @@ dependencies = [
1637
1649
  "zerocopy",
1638
1650
  ]
1639
1651
 
1652
+ [[package]]
1653
+ name = "proc-macro-crate"
1654
+ version = "3.3.0"
1655
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1656
+ checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35"
1657
+ dependencies = [
1658
+ "toml_edit",
1659
+ ]
1660
+
1640
1661
  [[package]]
1641
1662
  name = "proc-macro2"
1642
1663
  version = "1.0.95"
@@ -1868,6 +1889,12 @@ version = "0.8.5"
1868
1889
  source = "registry+https://github.com/rust-lang/crates.io-index"
1869
1890
  checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
1870
1891
 
1892
+ [[package]]
1893
+ name = "relative-path"
1894
+ version = "1.9.3"
1895
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1896
+ checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2"
1897
+
1871
1898
  [[package]]
1872
1899
  name = "reqwest"
1873
1900
  version = "0.12.22"
@@ -1926,6 +1953,36 @@ dependencies = [
1926
1953
  "windows-sys 0.52.0",
1927
1954
  ]
1928
1955
 
1956
+ [[package]]
1957
+ name = "rstest"
1958
+ version = "0.25.0"
1959
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1960
+ checksum = "6fc39292f8613e913f7df8fa892b8944ceb47c247b78e1b1ae2f09e019be789d"
1961
+ dependencies = [
1962
+ "futures-timer",
1963
+ "futures-util",
1964
+ "rstest_macros",
1965
+ "rustc_version",
1966
+ ]
1967
+
1968
+ [[package]]
1969
+ name = "rstest_macros"
1970
+ version = "0.25.0"
1971
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1972
+ checksum = "1f168d99749d307be9de54d23fd226628d99768225ef08f6ffb52e0182a27746"
1973
+ dependencies = [
1974
+ "cfg-if",
1975
+ "glob",
1976
+ "proc-macro-crate",
1977
+ "proc-macro2",
1978
+ "quote",
1979
+ "regex",
1980
+ "relative-path",
1981
+ "rustc_version",
1982
+ "syn",
1983
+ "unicode-ident",
1984
+ ]
1985
+
1929
1986
  [[package]]
1930
1987
  name = "rustc-demangle"
1931
1988
  version = "0.1.25"
@@ -1938,6 +1995,15 @@ version = "1.1.0"
1938
1995
  source = "registry+https://github.com/rust-lang/crates.io-index"
1939
1996
  checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
1940
1997
 
1998
+ [[package]]
1999
+ name = "rustc_version"
2000
+ version = "0.4.1"
2001
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2002
+ checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
2003
+ dependencies = [
2004
+ "semver",
2005
+ ]
2006
+
1941
2007
  [[package]]
1942
2008
  name = "rustix"
1943
2009
  version = "1.0.7"
@@ -2006,6 +2072,7 @@ dependencies = [
2006
2072
  "clap",
2007
2073
  "lazy_static",
2008
2074
  "llguidance",
2075
+ "rstest",
2009
2076
  "serde",
2010
2077
  "serde_json",
2011
2078
  "toktrie_hf_downloader",
@@ -2050,6 +2117,12 @@ dependencies = [
2050
2117
  "libc",
2051
2118
  ]
2052
2119
 
2120
+ [[package]]
2121
+ name = "semver"
2122
+ version = "1.0.26"
2123
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2124
+ checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0"
2125
+
2053
2126
  [[package]]
2054
2127
  name = "serde"
2055
2128
  version = "1.0.219"
@@ -2405,7 +2478,7 @@ dependencies = [
2405
2478
 
2406
2479
  [[package]]
2407
2480
  name = "toktrie"
2408
- version = "1.1.0"
2481
+ version = "1.1.2"
2409
2482
  dependencies = [
2410
2483
  "anyhow",
2411
2484
  "bytemuck",
@@ -2416,7 +2489,7 @@ dependencies = [
2416
2489
 
2417
2490
  [[package]]
2418
2491
  name = "toktrie_hf_downloader"
2419
- version = "1.1.0"
2492
+ version = "1.1.2"
2420
2493
  dependencies = [
2421
2494
  "anyhow",
2422
2495
  "hf-hub",
@@ -2427,7 +2500,7 @@ dependencies = [
2427
2500
 
2428
2501
  [[package]]
2429
2502
  name = "toktrie_hf_tokenizers"
2430
- version = "1.1.0"
2503
+ version = "1.1.2"
2431
2504
  dependencies = [
2432
2505
  "anyhow",
2433
2506
  "log",
@@ -2439,7 +2512,7 @@ dependencies = [
2439
2512
 
2440
2513
  [[package]]
2441
2514
  name = "toktrie_tiktoken"
2442
- version = "1.1.0"
2515
+ version = "1.1.2"
2443
2516
  dependencies = [
2444
2517
  "anyhow",
2445
2518
  "log",
@@ -2449,6 +2522,23 @@ dependencies = [
2449
2522
  "toktrie",
2450
2523
  ]
2451
2524
 
2525
+ [[package]]
2526
+ name = "toml_datetime"
2527
+ version = "0.6.11"
2528
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2529
+ checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
2530
+
2531
+ [[package]]
2532
+ name = "toml_edit"
2533
+ version = "0.22.27"
2534
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2535
+ checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
2536
+ dependencies = [
2537
+ "indexmap",
2538
+ "toml_datetime",
2539
+ "winnow",
2540
+ ]
2541
+
2452
2542
  [[package]]
2453
2543
  name = "tower"
2454
2544
  version = "0.5.2"
@@ -3004,6 +3094,15 @@ version = "0.53.0"
3004
3094
  source = "registry+https://github.com/rust-lang/crates.io-index"
3005
3095
  checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
3006
3096
 
3097
+ [[package]]
3098
+ name = "winnow"
3099
+ version = "0.7.12"
3100
+ source = "registry+https://github.com/rust-lang/crates.io-index"
3101
+ checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95"
3102
+ dependencies = [
3103
+ "memchr",
3104
+ ]
3105
+
3007
3106
  [[package]]
3008
3107
  name = "wit-bindgen-rt"
3009
3108
  version = "0.39.0"
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llguidance
3
- Version: 1.1.0
3
+ Version: 1.1.2
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
7
- License: MIT
7
+ License-Expression: MIT
8
8
  Requires-Python: >=3.9
9
9
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
10
10
  Project-URL: repository, https://github.com/microsoft/llguidance
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "llguidance"
3
- version = "1.1.0"
3
+ version = "1.1.2"
4
4
  edition = "2021"
5
5
  license = "MIT"
6
6
  description = "Super-fast Structured Outputs"
@@ -78,6 +78,12 @@ typedef struct LlgParserLimits {
78
78
  * Default: true
79
79
  */
80
80
  bool precompute_large_lexemes;
81
+ /**
82
+ * If true, include parser state (including tokens so far) and grammar in
83
+ * errors.
84
+ * Default: true
85
+ */
86
+ bool verbose_errors;
81
87
  } LlgParserLimits;
82
88
 
83
89
  typedef struct LlgConstraintInit {
@@ -258,6 +258,11 @@ pub struct ParserLimits {
258
258
  /// the time it takes to construct the lexer.
259
259
  /// Default: true
260
260
  pub precompute_large_lexemes: bool,
261
+
262
+ /// If true, include parser state (including tokens so far) and grammar in
263
+ /// errors.
264
+ /// Default: true
265
+ pub verbose_errors: bool,
261
266
  }
262
267
 
263
268
  impl Default for ParserLimits {
@@ -270,6 +275,7 @@ impl Default for ParserLimits {
270
275
  max_grammar_size: 500_000, // fhir schema => 200k
271
276
  step_max_items: 50_000, //
272
277
  precompute_large_lexemes: true,
278
+ verbose_errors: true,
273
279
  }
274
280
  }
275
281
  }
@@ -166,6 +166,7 @@ impl Matcher {
166
166
  self.with_inner(|inner| {
167
167
  for (idx, &t) in tokens.iter().enumerate() {
168
168
  if !inner.parser.validate_token(t)? {
169
+ let _ = inner.parser.check_stop()?;
169
170
  return Ok(idx);
170
171
  }
171
172
  let bt = inner.parser.consume_token(t)?;
@@ -24,7 +24,7 @@ pub fn mk_panic_error(info: &Box<dyn Any + Send>) -> String {
24
24
  let b = BACKTRACE.with(|b| b.take());
25
25
 
26
26
  if let Some(b) = b {
27
- format!("panic: {msg}\n{b}")
27
+ format!("panic: {msg}\n<backtrace>\n{b}\n</backtrace>")
28
28
  } else {
29
29
  format!("panic: {msg}")
30
30
  }
@@ -139,6 +139,10 @@ impl TokenParser {
139
139
  self.stop_reason
140
140
  }
141
141
 
142
+ pub fn stopped(&self) -> bool {
143
+ self.stop_reason != StopReason::NotStopped
144
+ }
145
+
142
146
  pub fn is_fresh(&self) -> bool {
143
147
  self.is_fresh
144
148
  }
@@ -276,11 +280,15 @@ impl TokenParser {
276
280
  }
277
281
 
278
282
  pub fn augment_err(&self, e: impl Display) -> String {
279
- format!(
280
- "{e}\n<state>\n{}\n</state><grammar>\n{}\n</grammar>",
281
- self.dump_state(),
282
- self.dbg_grammar
283
- )
283
+ if self.limits.verbose_errors {
284
+ format!(
285
+ "{e}\n<state>\n{}\n</state><grammar>\n{}\n</grammar>",
286
+ self.dump_state(),
287
+ self.dbg_grammar
288
+ )
289
+ } else {
290
+ format!("{e}\n<non-verbose/>")
291
+ }
284
292
  }
285
293
 
286
294
  pub fn dump_state(&self) -> String {
@@ -334,7 +342,7 @@ impl TokenParser {
334
342
  fn check_initialized(&self, lbl: &str) -> Result<()> {
335
343
  ensure!(!self.is_fresh, "process_prompt() not called in {}", lbl);
336
344
  ensure!(
337
- self.stop_reason == StopReason::NotStopped,
345
+ !self.stopped(),
338
346
  "parser stopped in {}; {}",
339
347
  lbl,
340
348
  self.error_message()
@@ -344,6 +352,9 @@ impl TokenParser {
344
352
  }
345
353
 
346
354
  pub fn validate_token(&mut self, token: TokenId) -> Result<bool> {
355
+ if self.stopped() {
356
+ return Ok(false);
357
+ }
347
358
  self.check_initialized("validate_token")?;
348
359
  self.validate_tokens_raw(&[token]).map(|n| n > 0)
349
360
  }
@@ -407,6 +418,9 @@ impl TokenParser {
407
418
  /// It does not tokenize forced bytes, so will accept non-canonical tokenizations.
408
419
  /// If called with more than one token, it may ignore max_tokens constraints.
409
420
  pub fn validate_tokens_raw(&mut self, tokens: &[TokenId]) -> Result<usize> {
421
+ if self.stopped() {
422
+ return Ok(0);
423
+ }
410
424
  self.check_initialized("validate_tokens_raw")?;
411
425
 
412
426
  if tokens.is_empty() {
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "llguidance"
3
- version = "1.1.0"
3
+ version = "1.1.2"
4
4
  description = "Bindings for the Low-level Guidance (llguidance) Rust library for use within Guidance"
5
5
  requires-python = ">=3.9"
6
6
  license = "MIT"
@@ -565,6 +565,7 @@ class LLParserLimits:
565
565
  max_lexer_states: Optional[int] = None,
566
566
  max_grammar_size: Optional[int] = None,
567
567
  precompute_large_lexemes: Optional[bool] = None,
568
+ verbose_errors: Optional[bool] = None,
568
569
  ) -> None:
569
570
  """
570
571
  ParserLimits configuration for controlling parser and lexer resource usage.
@@ -597,6 +598,10 @@ class LLParserLimits:
597
598
  precompute_large_lexemes (Optional[bool]):
598
599
  Whether to run large regexes eagerly on the entire token trie during lexer build.
599
600
  Increases lexer construction time, but speeds up mask computation. Default: True.
601
+
602
+ verbose_errors (Optional[bool]):
603
+ If true, include parser state and grammar details in error messages.
604
+ Useful for debugging; may leak schema/state in logs. Default: True.
600
605
  """
601
606
 
602
607
  @property
@@ -627,6 +632,10 @@ class LLParserLimits:
627
632
  def precompute_large_lexemes(self) -> bool:
628
633
  """Precompute large regexes during lexer construction. Default: True"""
629
634
 
635
+ @property
636
+ def verbose_errors(self) -> bool:
637
+ """Include parser state and grammar in errors. Default: True"""
638
+
630
639
 
631
640
  def regex_to_lark(regex: str, use_ascii: str = "d") -> str:
632
641
  r"""
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "llguidance_py"
3
- version = "1.1.0"
3
+ version = "1.1.2"
4
4
  edition = "2021"
5
5
  license = "MIT"
6
6
  description = "Super-fast Structured Outputs"