Emit {0,n} for at_most so the regex compiles on the outlines-core backend#1871
Open
lollinng wants to merge 2 commits into
Open
Emit {0,n} for at_most so the regex compiles on the outlines-core backend#1871lollinng wants to merge 2 commits into
lollinng wants to merge 2 commits into
Conversation
QuantifyMaximum (Term.at_most / at_most) compiled to (...){,n}. Python's re
accepts the lower-bound-omitted form, but the default outlines-core backend
(Rust regex-automata) does not, so any structured generation using at_most
raised 'Failed to build DFA' when the Index was built. Emit the equivalent
(...){0,n}. Updates the test that asserted the old output.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
A test in |
The QuantifyMaximum assertion in test_to_regex.py still expected the
old (a){,2} form; align it with the (a){0,2} output.
Author
|
Fixed in 802114b. The stale assertion was in The other CI failures (ollama multimodal 400s) are unrelated to this change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Term.at_most(n)/at_most(n, term)(theQuantifyMaximumDSL term) compiles to a regex of the form(...){,n}:Python's
reaccepts the lower-bound-omitted{,n}form, but the default generation backend —outlines-core(Rustregex/ regex-automata) — does not (it only supports{n},{n,},{n,m}). So any structured generation using anat_mostquantifier raises when theIndex/Guideis built:The whole
at_mostquantifier is effectively unusable with the default backend.Fix
Emit the equivalent
(...){0,n}. Semantically identical (0 to n repetitions), but valid for bothreandoutlines-core. A unit test asserted the old(a){,5}output; updated to(a){0,5}.Verification