[Bugfix] Reject NUL byte in structured_outputs.regex (#51796)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
f80b66f548
commit
38f097fab8
@@ -1029,6 +1029,15 @@ class SamplingParams(
|
||||
"structured_outputs.json_object must be True if set; omit "
|
||||
"structured_outputs to disable structured outputs"
|
||||
)
|
||||
# Reject a regex containing a NUL byte early, in every backend mode. A
|
||||
# NUL is never meaningful in a regex pattern and is not handled by the
|
||||
# regex-to-grammar conversion. Checked here, before backend selection,
|
||||
# so it is a clean 400 rather than a silent fallback in the default
|
||||
# "auto" mode.
|
||||
if self.structured_outputs.regex and "\x00" in self.structured_outputs.regex:
|
||||
raise VLLMValidationError(
|
||||
"structured_outputs.regex must not contain a NUL character ('\\x00')"
|
||||
)
|
||||
|
||||
from vllm.v1.structured_output.backend_guidance import (
|
||||
has_guidance_unsupported_json_features,
|
||||
|
||||
Reference in New Issue
Block a user