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

Expose json schema to grammar conversion method #94

Merged
merged 4 commits into from
Mar 9, 2025

Conversation

glebashnik
Copy link
Contributor

This exposes exposes C++ function to convert JSON schema to GBNF grammar.
GBNF grammar is an inference parameter to generate structured output, which is often useful to reduce hallucinations.
https://github.com/ggml-org/llama.cpp/blob/master/grammars/README.md.

@kherud
Copy link
Owner

kherud commented Mar 9, 2025

Hey @glebashnik thank you very much for the PR! We worked on a bigger update to the latest llama.cpp version so it had to wait a little, but it should now be merged and released soon.

When I just tested it, the json schema to grammar test failed because of a slight difference:

grafik

I assume this is due to a change in the implementation since the last version. I hope it's ok that I adapted it. Otherwise everything looks good to me.

@kherud kherud merged commit 7a8dc54 into kherud:master Mar 9, 2025
4 checks passed
@glebashnik
Copy link
Contributor Author

Thank for the fix and new release, @kherud! Indeed, there was a small change in underlying C++ implementation of grammar generator.

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

Successfully merging this pull request may close these issues.

2 participants