Expose json schema to grammar conversion method#94
Merged
kherud merged 4 commits intokherud:masterfrom Mar 9, 2025
Merged
Conversation
…ture/json-schema-to-grammar # Conflicts: # src/main/cpp/jllama.cpp # src/main/cpp/jllama.h
Owner
|
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: 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. |
Contributor
Author
|
Thank for the fix and new release, @kherud! Indeed, there was a small change in underlying C++ implementation of grammar generator. |
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.

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.