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

The specific limitations of JSON Schema? #104

Open
ckhfor opened this issue Nov 28, 2024 · 1 comment
Open

The specific limitations of JSON Schema? #104

ckhfor opened this issue Nov 28, 2024 · 1 comment

Comments

@ckhfor
Copy link

ckhfor commented Nov 28, 2024

Good Job! Can you provide the specific limitations of JSON Schema? Like, additionalProperties,defs,min/max,patternProperties. Thanks.

@Ubospica
Copy link
Collaborator

Yes. We will update our doc to cover the supported and unsupported keywords soon.

Ubospica added a commit that referenced this issue Dec 7, 2024
This PR supports allowing any whitespace by the grammar converted from JSON schema. 

Previously the json_schema_converter only allows strictly formatted JSON schema by specifying the indentation and separators. However, some model could tend to generate unformatted JSON schema. Forcing them to generate strictly formatted json may degrade the output quality, because these models will generate a dummy json following the format constraint. 

This PR provides an option `any_whitespace` in `Grammar.from_json_schema` and `GrammarCompiler.compile_json_schema`, default true, to allow any whitespace in the generated json, therefore allowing non-strictly formatted json output.

Note that this PR changes the behavior of these two functions that the converted grammar will by default allow any whitespace, unless a indentation is specifyed.

It also addresses #104.
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