|
23 | 23 | from vllm.v1.structured_output.utils import (
|
24 | 24 | validate_structured_output_request_xgrammar)
|
25 | 25 |
|
| 26 | +# Xgrammar and Guidance are supported. |
| 27 | +SUPPORTED_GUIDED_DECODING = [ |
| 28 | + "xgrammar", "xgrammar:disable-any-whitespace", "guidance", |
| 29 | + "guidance:disable-any-whitespace", "guidance:no-additional-properties", |
| 30 | + "guidance:no-additional-properties,disable-any-whitespace", |
| 31 | + "guidance:disable-any-whitespace,no-additional-properties", "auto" |
| 32 | +] |
| 33 | + |
26 | 34 |
|
27 | 35 | class Processor:
|
28 | 36 |
|
@@ -120,14 +128,11 @@ def _validate_structured_output(self, params: SamplingParams) -> None:
|
120 | 128 | if not params.guided_decoding or not self.decoding_config:
|
121 | 129 | return
|
122 | 130 |
|
123 |
| - supported_backends = [ |
124 |
| - "xgrammar", "xgrammar:disable-any-whitespace", "guidance", |
125 |
| - "guidance:disable-any-whitespace", "auto" |
126 |
| - ] |
127 | 131 | engine_level_backend = self.decoding_config.guided_decoding_backend
|
128 |
| - if engine_level_backend not in supported_backends: |
129 |
| - raise ValueError(f"Only {supported_backends} structured output is " |
130 |
| - "supported in V1.") |
| 132 | + if engine_level_backend not in SUPPORTED_GUIDED_DECODING: |
| 133 | + raise ValueError( |
| 134 | + f"Only {SUPPORTED_GUIDED_DECODING} structured output is " |
| 135 | + "supported in V1.") |
131 | 136 | if params.guided_decoding.backend:
|
132 | 137 | if params.guided_decoding.backend != engine_level_backend:
|
133 | 138 | raise ValueError("Request-level structured output backend "
|
|
0 commit comments