[V1] Add regex structured output support with xgrammar (#14590)

Signed-off-by: Russell Bryant <rbryant@redhat.com>
This commit is contained in:
Russell Bryant
2025-03-11 11:03:44 -04:00
committed by GitHub
parent 9ab326713f
commit 4bf82d4b90
4 changed files with 25 additions and 19 deletions

View File

@@ -112,6 +112,8 @@ class StructuredOutputManager:
ctx = self.compiler.compile_builtin_json_grammar()
elif request_type == StructuredOutputOptions.GRAMMAR:
ctx = self.compiler.compile_grammar(grammar_spec)
elif request_type == StructuredOutputOptions.REGEX:
ctx = self.compiler.compile_regex(grammar_spec)
else:
logger.error("Validation should have already occurred. "
"Please file an issue.")