Skip to content

Conversation

@Ubospica
Copy link
Collaborator

This PR solves the "root rule not found" issue for primitives in json schema converter.

@Ubospica Ubospica merged commit fd9ee31 into mlc-ai:main Mar 21, 2025
38 checks passed
// If the rule name is root, we need to define the root rule instead of just using the
// cached rule.
return ebnf_script_creator_.AddRule(rule_name_hint, basic_rules_cache_[idx]);
}
Copy link
Contributor

@wangkuiyi wangkuiyi Mar 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this change the behavior of the converter and make it tend to generate a new rule? @Ubospica

russellb added a commit to russellb/vllm that referenced this pull request Mar 28, 2025
Our previous behavior with xgrammar was to ensure that the response was
valid JSON. When the json_object output format is requested, the correct
behavior is to ensure the response is a JSON object. Valid JSON could
also be an array, a string, or a number, which is not desired here.

The fix is to explicitly use a json schema of {"type": "object"}. An
upgrade to xgrammar is necessary to fix a bug with xgrammar's support of
this schema, so we upgrade to 0.1.17.

- mlc-ai/xgrammar#256
- mlc-ai/xgrammar#264

Signed-off-by: Russell Bryant <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants