[V1][Structured Output] Add supports_structured_output() method to Platform (#16148)

Signed-off-by: shen-shanshan <467638484@qq.com>
This commit is contained in:
Shanshan Shen
2025-04-07 19:06:24 +08:00
committed by GitHub
parent 7c80368710
commit e9ba99f296
9 changed files with 41 additions and 3 deletions

View File

@@ -136,9 +136,11 @@ class Processor:
f" != {engine_level_backend}")
else:
params.guided_decoding.backend = engine_level_backend
import vllm.platforms
if vllm.platforms.current_platform.is_tpu():
raise ValueError("Structured output is not supported on TPU.")
from vllm.platforms import current_platform
if not current_platform.supports_structured_output():
raise ValueError("Structured output is not supported on "
f"{current_platform.device_name}.")
# Request content validation
if engine_level_backend.startswith("xgrammar"):