llguidance 0.7.10__tar.gz → 0.7.11__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.11/CHANGELOG.md +113 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/Cargo.lock +5 -5
- {llguidance-0.7.10 → llguidance-0.7.11}/PKG-INFO +1 -1
- {llguidance-0.7.10 → llguidance-0.7.11}/docs/json_schema.md +35 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/docs/syntax.md +28 -15
- {llguidance-0.7.10 → llguidance-0.7.11}/json_stats/expected_maskbench.json +1149 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/json_stats/src/json_stats.rs +3 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/Cargo.toml +1 -1
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/earley/parser.rs +4 -3
- {llguidance-0.7.10 → llguidance-0.7.11}/pyproject.toml +1 -1
- {llguidance-0.7.10 → llguidance-0.7.11}/python/llguidance/__init__.py +2 -0
- llguidance-0.7.11/python/llguidance/_struct_tag.py +118 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python/torch_tests/test_hf.py +22 -1
- {llguidance-0.7.10 → llguidance-0.7.11}/python/torch_tests/test_matcher.py +84 -4
- {llguidance-0.7.10 → llguidance-0.7.11}/python_ext/Cargo.toml +1 -1
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/src/lib.rs +15 -3
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/tests/test_ll.rs +174 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/bump.py +28 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie/Cargo.toml +1 -1
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie/src/tokenv.rs +8 -1
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie/src/toktree.rs +7 -1
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie_hf_downloader/Cargo.toml +1 -1
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie_hf_tokenizers/Cargo.toml +1 -1
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie_hf_tokenizers/src/lib.rs +5 -18
- {llguidance-0.7.10 → llguidance-0.7.11}/.github/workflows/rust.yml +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/.github/workflows/wheels.yml +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/.gitignore +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/CODE_OF_CONDUCT.md +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/Cargo.toml +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/LICENSE +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/README.md +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/SECURITY.md +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/SUPPORT.md +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/c_sample/Makefile +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/c_sample/README.md +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/c_sample/c_sample.cpp +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/docs/fast_forward.md +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/docs/mask_plot.png +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/docs/optimizations.md +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/docs/special_tokens.md +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/docs/toktrie.md +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/json_stats/Cargo.toml +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/json_stats/jstats.sh +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/json_stats/scripts/split-stats.sh +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/json_stats/scripts/split_plot.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/json_stats/src/lib.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/json_stats/src/stats.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/LICENSE +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/README.md +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/build.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/cbindgen.toml +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/grammars/character.json +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/grammars/json.json +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/llguidance.h +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/api.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/constraint.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/earley/from_guidance.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/earley/grammar.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/earley/lexer.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/earley/lexerspec.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/earley/mod.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/earley/perf.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/earley/regexvec.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/earley/slicer.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/factory.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/ffi.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/ffi_par.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/grammar_builder.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/json/README.md +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/json/compiler.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/json/context_ref.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/json/context_simple/context.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/json/context_simple/draft.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/json/context_simple/mod.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/json/formats.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/json/mod.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/json/numeric.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/json/schema.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/json/shared_context.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/json_validation.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/lark/README.md +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/lark/ast.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/lark/common.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/lark/compiler.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/lark/lexer.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/lark/mod.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/lark/parser.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/lib.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/logging.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/matcher.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/output.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/panic_utils.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/stop_controller.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/substring.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/tokenizer_json.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/parser/src/tokenparser.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/plan.md +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python/llguidance/_grammar_from.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python/llguidance/_lib.pyi +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python/llguidance/_tokenizer.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python/llguidance/_util.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python/llguidance/cli.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python/llguidance/gbnf_to_lark.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python/llguidance/hf.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python/llguidance/mlx.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python/llguidance/numpy.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python/llguidance/py.typed +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python/llguidance/torch.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python/mypy.ini +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python/torch_tests/__init__.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python/torch_tests/test_bitmask.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python_ext/src/lib.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python_ext/src/llinterpreter.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python_ext/src/llmatcher.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python_ext/src/py.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/python_ext/src/pyjson.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/Cargo.toml +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/README.md +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/cli.sh +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/data/blog.sample.json +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/data/blog.schema.json +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/data/blog.schema.ll.json +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/data/from-llama.cpp/README.md +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/data/from-llama.cpp/arithmetic.gbnf +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/data/from-llama.cpp/c.gbnf +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/data/from-llama.cpp/chess.gbnf +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/data/from-llama.cpp/english.gbnf +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/data/from-llama.cpp/japanese.gbnf +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/data/from-llama.cpp/json.gbnf +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/data/from-llama.cpp/json_arr.gbnf +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/data/from-llama.cpp/list.gbnf +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/data/from-llama.cpp/vllm-sql.gbnf +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/data/lark.lark +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/data/rfc.lark +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/data/rfc.xml +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/gtest.sh +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/lark.sh +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/run.sh +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/src/minimal.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/src/sample_parser.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/tests/test_lark.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/tests/test_raw_parser.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/sample_parser/tests/test_stop.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/annotate_asm.js +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/cbindgen.sh +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/checklinks.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/checklinks.sh +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/ci-publish.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/disasm.sh +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/gbnf_to_lark.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/gen-testcase.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/git-version.sh +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/install-deps.sh +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/jsonschema-stats.js +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/remote-guidance-test.sh +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/rust-size.js +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/rust_size.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/test-guidance.sh +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/tokenizer_test.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/scripts/update-git.py +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie/LICENSE +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie/README.md +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie/src/bytes.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie/src/lib.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie/src/recognizer.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie/src/rng.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie/src/svob.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie/tests/test_svob.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie_hf_downloader/LICENSE +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie_hf_downloader/src/lib.rs +0 -0
- {llguidance-0.7.10 → llguidance-0.7.11}/toktrie_hf_tokenizers/LICENSE +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
### Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
|
|
4
|
+
|
|
5
|
+
If a release doesn't introduce any interesting changes (build fixes etc.), it's skipped.
|
|
6
|
+
|
|
7
|
+
#### [0.7.11](https://github.com/guidance-ai/llguidance/compare/v0.7.10...0.7.11) 2025-03-27
|
|
8
|
+
|
|
9
|
+
- add StructTag python API; fixes [`#146`](https://github.com/guidance-ai/llguidance/issues/146)
|
|
10
|
+
- fix handling of AddedToken.special (gemma tokenizer, fixes [`#147`](https://github.com/guidance-ai/llguidance/issues/147))
|
|
11
|
+
- handle incomplete tokenizers (SmolLM); fixes [`#138`](https://github.com/guidance-ai/llguidance/issues/138)
|
|
12
|
+
- fix `validate_token_raw([EOS])` bug
|
|
13
|
+
|
|
14
|
+
#### [v0.7.10](https://github.com/guidance-ai/llguidance/compare/v0.7.9...v0.7.10) 2025-03-25
|
|
15
|
+
|
|
16
|
+
- add `llg_matcher_*()` functions to C interface [`#145`](https://github.com/guidance-ai/llguidance/pull/145)
|
|
17
|
+
- always pass validation of grammars with special tokens without tokenizer [`0892a2a`](https://github.com/guidance-ai/llguidance/commit/0892a2adb5c8d818c025fe554bd67f05a5770aa7)
|
|
18
|
+
|
|
19
|
+
#### [v0.7.9](https://github.com/guidance-ai/llguidance/compare/v0.7.8...v0.7.9) 2025-03-24
|
|
20
|
+
|
|
21
|
+
- improve Python `LLMatcher.validate_grammar()` [`6b5f5ed`](https://github.com/guidance-ai/llguidance/commit/6b5f5eda7ca85ae2ca9a76c3813a0162a8b99b45)
|
|
22
|
+
|
|
23
|
+
#### [v0.7.6](https://github.com/guidance-ai/llguidance/compare/v0.7.5...v0.7.6) 2025-03-21
|
|
24
|
+
|
|
25
|
+
- Stabilize JSON schema property order [`#134`](https://github.com/guidance-ai/llguidance/pull/134)
|
|
26
|
+
|
|
27
|
+
#### [v0.7.5](https://github.com/guidance-ai/llguidance/compare/v0.7.4...v0.7.5) 2025-03-21
|
|
28
|
+
|
|
29
|
+
- add toktrie_hf_downloader crate [`11bea00`](https://github.com/guidance-ai/llguidance/commit/11bea00ecd1ef3c4a8970c1748db829e0c8a14de)
|
|
30
|
+
- use hf tokenizers library in python ext [`61728be`](https://github.com/guidance-ai/llguidance/commit/61728be47828525e959f6db226a0f17a783442bc)
|
|
31
|
+
- add LLTokenizer.tokenize_partial [`893cedf`](https://github.com/guidance-ai/llguidance/commit/893cedf614e234bd86bf01a99772d846b6ea884b)
|
|
32
|
+
|
|
33
|
+
#### [v0.7.4](https://github.com/guidance-ai/llguidance/compare/v0.7.3...v0.7.4) 2025-03-20
|
|
34
|
+
|
|
35
|
+
- fix gbnf parsing [`e5828b8`](https://github.com/guidance-ai/llguidance/commit/e5828b8a7a2fffaa9cf1aa2619c603a3d4ec7e17)
|
|
36
|
+
|
|
37
|
+
#### [v0.7.3](https://github.com/guidance-ai/llguidance/compare/v0.7.2...v0.7.3) 2025-03-19
|
|
38
|
+
|
|
39
|
+
- add LLMatcher.validate_grammar(); make it never raise [`0f8ec60`](https://github.com/guidance-ai/llguidance/commit/0f8ec6088a28eda13c2dd3d537733c0648e00cb3)
|
|
40
|
+
- add LLMatcher.reset() [`6a70aa7`](https://github.com/guidance-ai/llguidance/commit/6a70aa7efa8121fcd1865cefa9998926852eee25)
|
|
41
|
+
|
|
42
|
+
#### [v0.7.2](https://github.com/guidance-ai/llguidance/compare/v0.7.1...v0.7.2) 2025-03-18
|
|
43
|
+
|
|
44
|
+
- don't go into error state on final EOS [`1f0f21d`](https://github.com/guidance-ai/llguidance/commit/1f0f21d41fe88427d065b09414047d76b8b32041)
|
|
45
|
+
|
|
46
|
+
#### [v0.7.1](https://github.com/guidance-ai/llguidance/compare/v0.7.0...v0.7.1) 2025-03-18
|
|
47
|
+
|
|
48
|
+
- add `LLMatcher` interface in python
|
|
49
|
+
- add whitespace_pattern to JsonCompileOptions [`04a5491`](https://github.com/guidance-ai/llguidance/commit/04a54912cf6d082669674340833f06385f7b66f8)
|
|
50
|
+
- enable mypy in CI [`#140`](https://github.com/guidance-ai/llguidance/pull/140)
|
|
51
|
+
- add py.typed for annotations information [`#139`](https://github.com/guidance-ai/llguidance/pull/139)
|
|
52
|
+
- fix clippy warnings
|
|
53
|
+
|
|
54
|
+
#### [v0.7.0](https://github.com/guidance-ai/llguidance/compare/v0.6.31...v0.7.0) 2025-03-07
|
|
55
|
+
|
|
56
|
+
- remove JSON-based grammar serialization [`#133`](https://github.com/guidance-ai/llguidance/pull/133)
|
|
57
|
+
|
|
58
|
+
#### [v0.6.31](https://github.com/guidance-ai/llguidance/compare/v0.6.29...v0.6.31) 2025-03-05
|
|
59
|
+
|
|
60
|
+
- fix https://github.com/guidance-ai/guidance/issues/1131 - backtracking+prompt healing [`#1131`](https://github.com/guidance-ai/guidance/issues/1131)
|
|
61
|
+
- optimize substring [`9950600`](https://github.com/guidance-ai/llguidance/commit/9950600f46e433b4c42506f8816f61cee331774f)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
#### [v0.6.29](https://github.com/guidance-ai/llguidance/compare/v0.6.28...v0.6.29) 2025-02-25
|
|
65
|
+
|
|
66
|
+
- [JSON] "x-guidance" JsonCompileOptions [`#130`](https://github.com/guidance-ai/llguidance/pull/130)
|
|
67
|
+
|
|
68
|
+
#### [v0.6.28](https://github.com/guidance-ai/llguidance/compare/v0.6.27...v0.6.28) 2025-02-21
|
|
69
|
+
|
|
70
|
+
- support for rollback() [`#126`](https://github.com/guidance-ai/llguidance/pull/126)
|
|
71
|
+
- allow lexer to produce alternative lexemes [`#124`](https://github.com/guidance-ai/llguidance/pull/124)
|
|
72
|
+
- make tokenize_with_greedy_fallback() handle invalid UTF not only at the end [`4762895`](https://github.com/guidance-ai/llguidance/commit/476289558d7d1edefe42eb87a093865debae8129)
|
|
73
|
+
- rise default lexer state limit from 50k to 250k [`202d3d5`](https://github.com/guidance-ai/llguidance/commit/202d3d545c14c63a62017b228c424a603619eb2a)
|
|
74
|
+
|
|
75
|
+
#### [v0.6.27](https://github.com/guidance-ai/llguidance/compare/v0.6.26...v0.6.27) 2025-02-18
|
|
76
|
+
|
|
77
|
+
- fix #122: captures with nullable symbols [`#122`](https://github.com/guidance-ai/llguidance/issues/122)
|
|
78
|
+
|
|
79
|
+
#### [v0.6.26](https://github.com/guidance-ai/llguidance/compare/v0.6.25...v0.6.26) 2025-02-14
|
|
80
|
+
|
|
81
|
+
- Extend Token::Number to match floats in scientific notation [`#121`](https://github.com/guidance-ai/llguidance/pull/121)
|
|
82
|
+
- native [suffix=...] support [`6d648c7`](https://github.com/guidance-ai/llguidance/commit/6d648c748bed4d83db28ed96ea87ad40ea51bc7e)
|
|
83
|
+
|
|
84
|
+
#### [v0.6.25](https://github.com/guidance-ai/llguidance/compare/v0.6.16...v0.6.25) 2025-02-12
|
|
85
|
+
|
|
86
|
+
- update referencing to 0.29.0 [`#118`](https://github.com/guidance-ai/llguidance/pull/118)
|
|
87
|
+
- Allow passing string for `capture_name` in lark syntax [`#119`](https://github.com/guidance-ai/llguidance/pull/119)
|
|
88
|
+
|
|
89
|
+
Plus a few releases messing with, deps, unsafe code cleanup.
|
|
90
|
+
|
|
91
|
+
#### [v0.6.16](https://github.com/guidance-ai/llguidance/compare/v0.6.15...v0.6.16) 2025-02-06
|
|
92
|
+
|
|
93
|
+
- Port over guidance's 'substring' [`#116`](https://github.com/guidance-ai/llguidance/pull/116)
|
|
94
|
+
- add %regex {...} syntax in lark for substrings [`b5ab086`](https://github.com/guidance-ai/llguidance/commit/b5ab0861e819b6e9221ef0aed3fcc827d6bad316)
|
|
95
|
+
|
|
96
|
+
#### [v0.6.15](https://github.com/guidance-ai/llguidance/compare/v0.6.14...v0.6.15) 2025-02-04
|
|
97
|
+
|
|
98
|
+
- move gbnf_to_lark to llguidance python pkg [`53134f1`](https://github.com/guidance-ai/llguidance/commit/53134f1befc6b6019bc88406e21b51c901943b51)
|
|
99
|
+
- add LLExecutor and fill_next_token_bitmask_par() [`ba4b917`](https://github.com/guidance-ai/llguidance/commit/ba4b9175b8d6c5445e1c0bcc8d5ef8e62b6cf73c)
|
|
100
|
+
|
|
101
|
+
#### [v0.6.14](https://github.com/guidance-ai/llguidance/compare/v0.6.13...v0.6.14) 2025-02-03
|
|
102
|
+
|
|
103
|
+
- add llguidance.numpy and llguidance.mlx submodules [`c627a39`](https://github.com/guidance-ai/llguidance/commit/c627a39689c9147fe7b072e5075960d16d43fc73)
|
|
104
|
+
|
|
105
|
+
#### [v0.6.13](https://github.com/guidance-ai/llguidance/compare/v0.6.12...v0.6.13) 2025-02-03
|
|
106
|
+
|
|
107
|
+
- add llguidance.torch and llguidance.hf submodules [`3fcdb1d`](https://github.com/guidance-ai/llguidance/commit/3fcdb1d93af076bbc8f1b3bef6fa9ead22b3e959)
|
|
108
|
+
|
|
109
|
+
#### [v0.6.12](https://github.com/guidance-ai/llguidance/compare/v0.6.11...v0.6.12) 2025-01-31
|
|
110
|
+
|
|
111
|
+
- fixes for numeric tokens [`b7c9970`](https://github.com/guidance-ai/llguidance/commit/b7c99709a9cb7f7a8a3c4716092e4d94fae2ff2c)
|
|
112
|
+
- make capture explicit in lark syntax [`2a57678`](https://github.com/guidance-ai/llguidance/commit/2a57678d9397e8be54cb0c9f14c4270604f8e1a5)
|
|
113
|
+
|
|
@@ -1177,7 +1177,7 @@ checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
|
|
|
1177
1177
|
|
|
1178
1178
|
[[package]]
|
|
1179
1179
|
name = "llguidance"
|
|
1180
|
-
version = "0.7.
|
|
1180
|
+
version = "0.7.11"
|
|
1181
1181
|
dependencies = [
|
|
1182
1182
|
"anyhow",
|
|
1183
1183
|
"derivre",
|
|
@@ -1196,7 +1196,7 @@ dependencies = [
|
|
|
1196
1196
|
|
|
1197
1197
|
[[package]]
|
|
1198
1198
|
name = "llguidance_py"
|
|
1199
|
-
version = "0.7.
|
|
1199
|
+
version = "0.7.11"
|
|
1200
1200
|
dependencies = [
|
|
1201
1201
|
"anyhow",
|
|
1202
1202
|
"bytemuck",
|
|
@@ -2356,7 +2356,7 @@ dependencies = [
|
|
|
2356
2356
|
|
|
2357
2357
|
[[package]]
|
|
2358
2358
|
name = "toktrie"
|
|
2359
|
-
version = "0.7.
|
|
2359
|
+
version = "0.7.11"
|
|
2360
2360
|
dependencies = [
|
|
2361
2361
|
"anyhow",
|
|
2362
2362
|
"bytemuck",
|
|
@@ -2367,7 +2367,7 @@ dependencies = [
|
|
|
2367
2367
|
|
|
2368
2368
|
[[package]]
|
|
2369
2369
|
name = "toktrie_hf_downloader"
|
|
2370
|
-
version = "0.7.
|
|
2370
|
+
version = "0.7.11"
|
|
2371
2371
|
dependencies = [
|
|
2372
2372
|
"anyhow",
|
|
2373
2373
|
"hf-hub",
|
|
@@ -2378,7 +2378,7 @@ dependencies = [
|
|
|
2378
2378
|
|
|
2379
2379
|
[[package]]
|
|
2380
2380
|
name = "toktrie_hf_tokenizers"
|
|
2381
|
-
version = "0.7.
|
|
2381
|
+
version = "0.7.11"
|
|
2382
2382
|
dependencies = [
|
|
2383
2383
|
"anyhow",
|
|
2384
2384
|
"log",
|
|
@@ -56,6 +56,41 @@ Number features (for both integer and number):
|
|
|
56
56
|
- order of object properties is fixed, see below
|
|
57
57
|
- string `format` is enforced by default, with unrecognized or unimplemented formats returning errors
|
|
58
58
|
|
|
59
|
+
## Whitespace handling
|
|
60
|
+
|
|
61
|
+
By default any whitespace is allowed inside of the JSON object.
|
|
62
|
+
Whitespace is not allowed before the first `{` or after the last `}`.
|
|
63
|
+
You can modify your grammar easily to allow initial or trailing whitespace.
|
|
64
|
+
|
|
65
|
+
You can set top-level `"x-guidance"` key to control this.
|
|
66
|
+
Following keys are available inside of it:
|
|
67
|
+
|
|
68
|
+
- `item_separator`, defaults to `":"`
|
|
69
|
+
- `key_separator`, defaults to `","`
|
|
70
|
+
- `whitespace_flexible`, defaults to `true`; set to `false` to enforce compact JSON representation
|
|
71
|
+
- `whitespace_pattern`, optional string, overrides `whitespace_flexible`;
|
|
72
|
+
`whitespace_flexible: true` is equivalent to `whitespace_pattern: r"[\x20\x0A\x0D\x09]+"`
|
|
73
|
+
- `coerce_one_of`, defaults to `false`; when set to `true`, the `"oneOf"` will be treated as `"anyOf"`
|
|
74
|
+
|
|
75
|
+
For example:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"x-guidance": {
|
|
80
|
+
"whitespace_flexible": false
|
|
81
|
+
},
|
|
82
|
+
"type": "object",
|
|
83
|
+
"properties": {
|
|
84
|
+
"a": {
|
|
85
|
+
"type": "string"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The `"x-guidance"` key is only recognized at the top level of the schema.
|
|
92
|
+
|
|
93
|
+
|
|
59
94
|
## Property order
|
|
60
95
|
|
|
61
96
|
### TL;DR
|
|
@@ -116,8 +116,7 @@ Often, the chat format already includes initial `<think>\n` - in these cases
|
|
|
116
116
|
you can use `start: /(.|\n)*/ </think> json` as the grammar.
|
|
117
117
|
You can also use `/(.|\n){1000,3000}/` to place lower and upper bounds on the thinking amount.
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
This assumes `<think>` is a special token. If it was just a string, you would need
|
|
119
|
+
This assumes `<think>` is a special token. If it was just a string, you would need
|
|
121
120
|
to use [`suffix="</think>"`](#lazy-lexemes).
|
|
122
121
|
|
|
123
122
|
### Lexeme options
|
|
@@ -135,7 +134,7 @@ Example: `mygen[stop="\n", max_tokens=10, temperature=0.7]: /.*/`
|
|
|
135
134
|
The `temperature` alters temperature while sampling tokens inside of the terminal,
|
|
136
135
|
while `max_tokens` limits the number of tokens generated for the terminal.
|
|
137
136
|
|
|
138
|
-
|
|
137
|
+
### Lazy lexemes
|
|
139
138
|
|
|
140
139
|
Specifying `stop=""` will make the EOS token of the model act as the stop condition.
|
|
141
140
|
This is only useful if there is some other rule following this rule (otherwise the model will stop on EOS anyways),
|
|
@@ -187,20 +186,36 @@ If it doesn't, the results may be surprising:
|
|
|
187
186
|
for example, `foo[lazy]: /.*/` will match only the empty string,
|
|
188
187
|
while `foo[lazy]: /[0-9]+/` will only match a single digit.
|
|
189
188
|
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
### Tool calling
|
|
190
|
+
|
|
191
|
+
Some models have been finetuned to use normal text, not special tokens, for tool calling.
|
|
192
|
+
Here's an example how `lazy` can be used to allow any text interspersed with
|
|
193
|
+
tool calls:
|
|
192
194
|
|
|
193
195
|
```lark
|
|
194
|
-
start:
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
196
|
+
start: ( f_foo | f_bar )* f_end
|
|
197
|
+
f_end: TEXT
|
|
198
|
+
TEXT: /(.|\n)*/
|
|
199
|
+
|
|
200
|
+
f_foo_hd[lazy]: TEXT "<function"
|
|
201
|
+
f_foo: f_foo_hd "=foo>" %json { "type": "object" } "</function>"
|
|
202
|
+
|
|
203
|
+
f_bar_hd[lazy]: TEXT "<function"
|
|
204
|
+
f_bar: f_bar_hd "=bar>" /[0-9]+/ "</function>"
|
|
202
205
|
```
|
|
203
206
|
|
|
207
|
+
The above allows for anything, until the text `<function` is generated.
|
|
208
|
+
Then it will force the model to choose between `=foo>` or `=bar>`.
|
|
209
|
+
Then we'll either enforce valid JSON or a number, followed by string `</function>`.
|
|
210
|
+
Then again any text is allowed, etc.
|
|
211
|
+
|
|
212
|
+
Note that the tool call can be missing algtogether, you can change `*` to `+` if you want to enforce at least one tool call.
|
|
213
|
+
You can also change the definition of `TEXT` to limit the free-form text.
|
|
214
|
+
|
|
215
|
+
See [Special tokens](#special-tokens) if the "trigger" for the tool call is a special token
|
|
216
|
+
like `<|python_tag|>`, not a string like `<function`.
|
|
217
|
+
|
|
218
|
+
The `llguidance.StructTag` API, [inspired](https://github.com/mlc-ai/xgrammar/blob/fd9ee31/python/xgrammar/grammar.py#L211) by XGrammar, just compiles down to the above.
|
|
204
219
|
|
|
205
220
|
### Structured %regex
|
|
206
221
|
|
|
@@ -221,8 +236,6 @@ Additionally, "structured" regex nodes can be defined using `%regex { ... }` syn
|
|
|
221
236
|
|
|
222
237
|
#### Substring
|
|
223
238
|
|
|
224
|
-
**The syntax is not stable yet!**
|
|
225
|
-
|
|
226
239
|
`%regex { "substring_chunks": lst }` will match `lst[n:m].join("")` for some `n <= m <= len(lst)`.
|
|
227
240
|
Additionally `substring_words` or `substring_chars` can be specified.
|
|
228
241
|
For example:
|