pub struct StructuredOutputsParams {
pub json: Option<Value>,
pub regex: Option<String>,
pub choice: Option<Vec<String>>,
pub grammar: Option<String>,
pub json_object: Option<bool>,
pub structural_tag: Option<String>,
pub disable_any_whitespace: Option<bool>,
pub disable_additional_properties: Option<bool>,
pub whitespace_pattern: Option<String>,
}Expand description
vLLM’s structured_outputs parameter: constrains decoding to a grammar
so the output is guaranteed to parse.
Exactly one of json, regex, choice, grammar, json_object and
structural_tag must be set; the server rejects zero or more than one.
Replaces the deprecated top-level guided_json, guided_regex,
guided_choice, guided_grammar, guided_decoding_backend,
guided_whitespace_pattern and structural_tag keys, which current
vLLM no longer accepts at all — sending one is a 400 reporting the
unexpected keyword.
Fields§
§json: Option<Value>JSON Schema the output must validate against. vLLM accepts either an inline schema object or a schema serialized as a string.
regex: Option<String>Regular expression the whole output must match.
choice: Option<Vec<String>>Closed set of allowed outputs; the model must produce exactly one.
grammar: Option<String>Context-free grammar in EBNF, e.g. for a query language.
json_object: Option<bool>Require syntactically valid JSON without constraining its schema.
Equivalent to OpenAI’s response_format: {"type": "json_object"}.
structural_tag: Option<String>A structural tag interleaving schema fragments with free text.
disable_any_whitespace: Option<bool>Forbid whitespace between JSON tokens, producing compact output.
disable_additional_properties: Option<bool>Reject input schemas that do not set
additionalProperties: false, which guided decoding needs.
whitespace_pattern: Option<String>Regex describing the whitespace allowed between JSON tokens.