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

Ensure regex matches valid JSON for "const" and "enum" with booleans, nulls, and strings #972

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

mwootten
Copy link
Contributor

Use JSON's serialization, rather than Python's, in this case.

Fixes #971. Note that this still does not correctly handle arrays and objects, which are allowed by the JSON schema spec; however, those would be more complex to handle correctly.

Copy link
Contributor

@lapp0 lapp0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, thanks for submitting! I have one minor change request.

outlines/fsm/json_schema.py Show resolved Hide resolved
@lapp0
Copy link
Contributor

lapp0 commented Jun 17, 2024

Your tests failed due to an issue in main which has now been resolved. Please rebase on main

… nulls, and strings

Use JSON's serialization, rather than Python's, in this case.

Fixes dottxt-ai#971. Note that this still does not correctly handle arrays
and objects, which are allowed by the JSON schema spec; however,
those would be more complex to handle correctly.
Copy link
Contributor

@lapp0 lapp0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, thanks for contributing!

@rlouf rlouf added bug structured generation Linked to structured generation JSON labels Jun 18, 2024
@rlouf rlouf merged commit 7d8269f into dottxt-ai:main Jun 18, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug JSON structured generation Linked to structured generation
Projects
None yet
3 participants