Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix pattern-string in json_schema.py by removing anchors #995

Merged
merged 1 commit into from
Jun 22, 2024

Conversation

lapp0
Copy link
Collaborator

@lapp0 lapp0 commented Jun 21, 2024

Fixes #931

Problem

interegular doesn't support anchors, ^ and $, however json_schema.py explicitly allowed their inclusion in main, resulting in interegular.patterns.Unsupported: '^'.

Solution

  • Strip anchors in pattern-strings.
  • update json_schema.py tests so any produced regex is run through interegular.parse_pattern(regex) to check for interegular incompatibility.

@lapp0 lapp0 requested a review from rlouf June 21, 2024 14:18
@lapp0 lapp0 added correctness Everything related to the generation correctness JSON and removed correctness Everything related to the generation correctness labels Jun 21, 2024
@rlouf rlouf merged commit 60e89f5 into outlines-dev:main Jun 22, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unsupported: '^' from integregular when string has pattern in json schema
2 participants