vllm.v1.structured_output.backend_guidance
¶
Classes:
Functions:
-
has_guidance_unsupported_json_features–Check if JSON schema contains features unsupported by guidance/llguidance.
GuidanceGrammar
dataclass
¶
Bases: StructuredOutputGrammar
Methods:
-
accept_tokens–Accepts a list of tokens and advances the parser.
-
validate_tokens–Checks if the list of tokens are accepted by the parser in sequence.
Source code in vllm/v1/structured_output/backend_guidance.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | |
accept_tokens(request_id, tokens)
¶
Accepts a list of tokens and advances the parser.
Returns True if the parser was advanced successfully. Returns False if the parser failed to advance.
Source code in vllm/v1/structured_output/backend_guidance.py
validate_tokens(tokens)
¶
Checks if the list of tokens are accepted by the parser in sequence. Will not advance the parser.
Returns the prefix list of tokens that are accepted by the parser.
Source code in vllm/v1/structured_output/backend_guidance.py
has_guidance_unsupported_json_features(schema)
¶
Check if JSON schema contains features unsupported by guidance/llguidance.