-
Notifications
You must be signed in to change notification settings - Fork 12.4k
json
: document schema conversion in GBNF readme, align manual grammar examples & converters
#7841
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,10 @@ array ::= | |
string ::= | ||
"\"" ( | ||
[^"\\\x7F\x00-\x1F] | | ||
"\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) # escapes | ||
"\\" (["\\bfnrt] | "u" [0-9a-fA-F]{4}) # escapes | ||
)* "\"" ws | ||
|
||
number ::= ("-"? ([0-9] | [1-9] [0-9]*)) ("." [0-9]+)? ([eE] [-+]? [0-9]+)? ws | ||
number ::= ("-"? ([0-9] | [1-9] [0-9]{0,15})) ("." [0-9]+)? ([eE] [-+]? [0-9] [1-9]{0,15})? ws | ||
|
||
# Optional space: by convention, applied in this grammar after literal chars when allowed | ||
ws ::= ([ \t\n] ws)? | ||
ws ::= [ \t\n]{,20} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels like a good change -- I like constraining the output in this way. Could even consider limiting it to something more restrictive like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've drafted an updated space rule in #7866. No matter what the bound is with this current syntax, models like Llama-3-8B & Phi-3-mini seem keen to misuse it. But given near-unlimited indent space only (and only 1 newline at a time), they're very sensible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these possibly be updated to use the new
.
operator, or is now not the time for that?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, we can't do that, because we need to exclude backslashes from this list. Nevermind, carry on! :)