[grammar] Avoid server crash when grammar backend is None (#11401)
This commit is contained in:
@@ -1442,7 +1442,10 @@ class Scheduler(
|
||||
or req.sampling_params.ebnf is not None
|
||||
or req.sampling_params.structural_tag is not None
|
||||
):
|
||||
assert self.grammar_backend is not None
|
||||
if self.grammar_backend is None:
|
||||
error_msg = "Grammar-based generation (json_schema, regex, ebnf, structural_tag) is not supported when the server is launched with --grammar-backend none"
|
||||
req.set_finish_with_abort(error_msg)
|
||||
else:
|
||||
if req.sampling_params.json_schema is not None:
|
||||
key = ("json", req.sampling_params.json_schema)
|
||||
elif req.sampling_params.regex is not None:
|
||||
|
||||
Reference in New Issue
Block a user