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

Use outlines-core to translate JSON Schemas into regexes #1311

Merged
merged 4 commits into from
Dec 9, 2024

Conversation

rlouf
Copy link
Member

@rlouf rlouf commented Dec 2, 2024

Outlines is currently using its own logic to translate JSON Schema definitions into regular expressions. However, this logic was ported to outlines-core recently. In this PR I remove Outlines' implementation and import outlines-core's instead.

TODO

  • It seems like outlines-core does not support the enum keyword when the elements are objects. Craft a MRE and open an issue there. That's completely expected since enum is for constant values only. I fixed this by converting enum into oneOf.

@rlouf rlouf requested a review from torymur December 2, 2024 14:55
@rlouf rlouf force-pushed the use-outlines-core-json-schema branch 4 times, most recently from 088e42d to 9aca8c7 Compare December 9, 2024 12:03
@rlouf rlouf force-pushed the use-outlines-core-json-schema branch from 9aca8c7 to 9d67934 Compare December 9, 2024 12:08
rlouf added 3 commits December 9, 2024 13:20
The `enum` keyword is reserved for arrays of constants. When we have
callables as members of a Python `Enum`, we get an object whose
properties are the arguments of the callable. The `Enum` thus needs
to be converted into a `oneOf` field.
@rlouf
Copy link
Member Author

rlouf commented Dec 9, 2024

Coverage will necessarily fail, they correspond to the MLX array conversion and we cannot test MLX on GH runners. Merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant