[Bugfix][Structured Outputs] Reject degenerate structured_outputs that crash EngineCore (#45346)
Signed-off-by: Ting Sun <suntcrick@gmail.com>
This commit is contained in:
@@ -938,6 +938,18 @@ class SamplingParams(
|
||||
and self.structured_outputs.grammar.strip() == ""
|
||||
):
|
||||
raise ValueError("structured_outputs.grammar cannot be an empty string")
|
||||
# Reject empty string json schema early to avoid engine-side crashes
|
||||
if (
|
||||
isinstance(self.structured_outputs.json, str)
|
||||
and self.structured_outputs.json.strip() == ""
|
||||
):
|
||||
raise ValueError("structured_outputs.json cannot be an empty string")
|
||||
# Reject json_object=False early to avoid engine-side crashes
|
||||
if self.structured_outputs.json_object is False:
|
||||
raise ValueError(
|
||||
"structured_outputs.json_object must be True if set; omit "
|
||||
"structured_outputs to disable structured outputs"
|
||||
)
|
||||
|
||||
from vllm.v1.structured_output.backend_guidance import (
|
||||
has_guidance_unsupported_json_features,
|
||||
|
||||
Reference in New Issue
Block a user