vllm.v1.structured_output.backend_outlines
¶
Classes:
Functions:
-
validate_regex_is_buildable–Validates that the input regex is not using unsupported features
OutlinesGrammar
dataclass
¶
Bases: StructuredOutputGrammar
Methods:
-
accept_tokens–Accepts a list of tokens and advances the FSM.
Source code in vllm/v1/structured_output/backend_outlines.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 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 | |
accept_tokens(request_id, tokens)
¶
Accepts a list of tokens and advances the FSM.
Returns True if all grammar-constrained tokens were accepted. Tokens after termination (EOS) are ignored. Returns False if the FSM failed to advance.
Source code in vllm/v1/structured_output/backend_outlines.py
_check_unsupported(parsed)
¶
Check for regex features unsupported by regex-automata.
Source code in vllm/v1/structured_output/backend_outlines.py
_prefix_needs_context(parsed)
¶
Return True if there's a look-around/anchor before any consumer.
Source code in vllm/v1/structured_output/backend_outlines.py
validate_regex_is_buildable(pattern)
¶
Validates that the input regex is not using unsupported features
of the regex-automata crate (outlines_core regex engine) and has a
universal start state.
definition of universal start state used can be found at:
https://docs.rs/regex-automata/latest/regex_automata/dfa/trait.Automaton.html#method.universal_start_state