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

Preserving the order of the keys in json-schema-to-grammar by using nlohmann::ordered_json #6215

Closed
4 tasks done
mgonzs13 opened this issue Mar 21, 2024 · 1 comment
Closed
4 tasks done
Labels
enhancement New feature or request

Comments

@mgonzs13
Copy link

mgonzs13 commented Mar 21, 2024

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest code. Development is very rapid so there are no tagged versions as of now.
  • I carefully followed the README.md.
  • I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new bug or useful enhancement to share.

Feature Description

Using ordered JSONs in json-schema-to-grammar so that the llama.cpp follows the order of the JSON schema.

Motivation

I've been trying the new C++ json-schema-to-grammar from #5978 and I've noticed that there is no prop_order, which is present in the python version, to order the keys of the JSON schema. I think this could be interesting since generating text for some specific keys can improve the text generation of the following keys.

Possible Implementation

An easy solution is replacing the base json nlohmann::jsonwith nlohmann::ordered_json in both files json-schema-to-grammar.h and json-schema-to-grammar.cpp. This will result in JSON that preserves the original order of the keys.

@mgonzs13 mgonzs13 added the enhancement New feature or request label Mar 21, 2024
@mgonzs13
Copy link
Author

Solved in #6232

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

No branches or pull requests

1 participant