Add outlines fallback when JSON schema has enum (#13449)

Signed-off-by: mgoin <mgoin64@gmail.com>
This commit is contained in:
Michael Goin
2025-02-18 01:49:41 -05:00
committed by GitHub
parent 9915912f7f
commit b53d79983c
3 changed files with 86 additions and 0 deletions

View File

@@ -14,6 +14,10 @@ def has_xgrammar_unsupported_json_features(schema: dict) -> bool:
if "pattern" in obj:
return True
# Check for enum restrictions
if "enum" in obj:
return True
# Check for numeric ranges
if obj.get("type") in ("integer", "number") and any(
key in obj for key in [