A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 8, 15:15 UTC
[structured output] validate unsupported json features first (#33233)
Signed-off-by: Andy Xie <andy.xning@gmail.com> Co-authored-by: Chauncey <chaunceyjiang@gmail.com> Co-authored-by: Russell Bryant <rbryant@redhat.com>
Ning Xie committed
Feb 10, 2026 at 07:49 UTC
13397841ab469cecf1ed425c3f52a9ffc38139b5
1 file changed
+5
-5
vllm/v1/structured_output/backend_xgrammar.py
+5
-5
@@ -304,17 +304,17 @@ def validate_xgrammar_grammar(sampling_params: SamplingParams) -> None:
304
else:
305
schema = so_params.json
306
307
+ if has_xgrammar_unsupported_json_features(schema):
308
+ raise ValueError(
309
+ "The provided JSON schema contains features not supported by xgrammar."
310
+ )
311
+
312
try:
313
xgr.Grammar.from_json_schema(schema)
314
except Exception as err:
315
raise ValueError(
316
f"Failed to transform json schema into a grammar: {err}"
317
) from err
313
-
314
- if has_xgrammar_unsupported_json_features(schema):
315
- raise ValueError(
316
- "The provided JSON schema contains features not supported by xgrammar."
317
- )
318
return
319
320
if so_params.grammar: