[Bugfix] Properly reject requests with empty list guided_choice (#20195)
Signed-off-by: mgoin <mgoin64@gmail.com>
This commit is contained in:
@@ -173,6 +173,12 @@ class Processor:
|
|||||||
params.guided_decoding.backend = engine_level_backend
|
params.guided_decoding.backend = engine_level_backend
|
||||||
|
|
||||||
# Request content validation
|
# Request content validation
|
||||||
|
if (isinstance(params.guided_decoding.choice, list)
|
||||||
|
and not params.guided_decoding.choice):
|
||||||
|
# It is invalid for choice to be an empty list
|
||||||
|
raise ValueError(f"Choice '{params.guided_decoding.choice}' "
|
||||||
|
"cannot be an empty list")
|
||||||
|
|
||||||
if engine_level_backend.startswith("xgrammar"):
|
if engine_level_backend.startswith("xgrammar"):
|
||||||
# xgrammar with no fallback
|
# xgrammar with no fallback
|
||||||
validate_xgrammar_grammar(params)
|
validate_xgrammar_grammar(params)
|
||||||
|
|||||||
Reference in New Issue
Block a user