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

String format support #3

Open
notpushkin opened this issue Jul 5, 2024 · 1 comment
Open

String format support #3

notpushkin opened this issue Jul 5, 2024 · 1 comment

Comments

@notpushkin
Copy link

Hey, first of all thanks for your wonderful project!

Right now the only way to restrict a format of a string is with pattern, but JSON Schema also supports format and some built-in formats could be pretty useful to support.

For example, email is notoriously hard to parse using a regex, but a fairly clean BNF is defined in RFC 5321 (which JSON Schema uses for the email format) and I think it should be pretty straightforward to port.

Do you think this could be something you could use? I can try and work out a PR if you'd like :-)

@adrienbrault
Copy link
Owner

Absolutely, good idea.

There's a few formats already implemented in llama cpp json-schema-to-grammar.mjs: https://github.com/ggerganov/llama.cpp/blob/2ee44c9a1865a928ccbbc16a2d7841d7513f31c1/examples/server/public/json-schema-to-grammar.mjs#L245-L252

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

No branches or pull requests

2 participants