vllm.v1.structured_output.backend_outlines
OutlinesBackend dataclass
¶
Bases: StructuredOutputBackend
Source code in vllm/v1/structured_output/backend_outlines.py
__post_init__ ¶
_compile_index ¶
_compile_index(
regex_string: str, vocabulary: OutlinesVocabulary
) -> Index
Source code in vllm/v1/structured_output/backend_outlines.py
allocate_token_bitmask ¶
compile_grammar ¶
compile_grammar(
request_type: StructuredOutputOptions, grammar_spec: str
) -> StructuredOutputGrammar
Source code in vllm/v1/structured_output/backend_outlines.py
OutlinesGrammar dataclass
¶
Bases: StructuredOutputGrammar
Source code in vllm/v1/structured_output/backend_outlines.py
_prev_finished class-attribute
instance-attribute
¶
num_processed_tokens class-attribute
instance-attribute
¶
accept_tokens ¶
Accepts a list of tokens and advances the FSM.
Returns True if the FSM was advanced successfully. Returns False if the FSM failed to advance.
Source code in vllm/v1/structured_output/backend_outlines.py
fill_bitmask ¶
reset ¶
validate_tokens ¶
_check_unsupported ¶
Check for regex features unsupported by regex-automata
Source code in vllm/v1/structured_output/backend_outlines.py
_prefix_needs_context ¶
_prefix_needs_context(parsed) -> bool
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 ¶
validate_regex_is_buildable(pattern: str) -> None
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
Source code in vllm/v1/structured_output/backend_outlines.py
validate_structured_output_request_outlines ¶
validate_structured_output_request_outlines(
params: SamplingParams,
)