mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-25 10:26:30 +08:00
fix: Update json features supported by xGrammar (#30390)
Signed-off-by: Johannes Flommersfeld <johannes.flommersfeld@tngtech.com> Signed-off-by: Johannes F <johannesflommersfeld@users.noreply.github.com> Co-authored-by: Johannes Flommersfeld <johannes.flommersfeld@tngtech.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
parent
e9add129ad
commit
060893654d
@ -76,6 +76,8 @@ def sample_json_schema():
|
||||
},
|
||||
"required": ["name", "age", "skills", "grade", "email", "work_history"],
|
||||
"additionalProperties": False,
|
||||
"minProperties": 1,
|
||||
"maxProperties": 10,
|
||||
}
|
||||
|
||||
|
||||
@ -96,6 +98,9 @@ def unsupported_json_schema():
|
||||
},
|
||||
"required": ["score", "tags"],
|
||||
"additionalProperties": False,
|
||||
"patternProperties": {
|
||||
"^score$": {"type": "integer"},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -44,8 +44,6 @@ def unsupported_array_schemas():
|
||||
@pytest.fixture
|
||||
def unsupported_object_schemas():
|
||||
return [
|
||||
{"type": "object", "minProperties": 1},
|
||||
{"type": "object", "maxProperties": 5},
|
||||
{"type": "object", "propertyNames": {"pattern": "^[a-z]+$"}},
|
||||
{"type": "object", "patternProperties": {"^S": {"type": "string"}}},
|
||||
]
|
||||
@ -79,6 +77,8 @@ def supported_schema():
|
||||
},
|
||||
},
|
||||
},
|
||||
"minProperties": 1,
|
||||
"maxProperties": 100,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -268,13 +268,7 @@ def has_xgrammar_unsupported_json_features(schema: dict[str, Any]) -> bool:
|
||||
|
||||
# Unsupported keywords for objects
|
||||
if obj.get("type") == "object" and any(
|
||||
key in obj
|
||||
for key in (
|
||||
"minProperties",
|
||||
"maxProperties",
|
||||
"propertyNames",
|
||||
"patternProperties",
|
||||
)
|
||||
key in obj for key in ("patternProperties", "propertyNames")
|
||||
):
|
||||
return True
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user