vllm.inputs ¶
Modules:
| Name | Description |
|---|---|
data | |
parse | |
preprocess | |
DecoderOnlyInputs module-attribute ¶
DecoderOnlyInputs: TypeAlias = (
TokenInputs | EmbedsInputs | MultiModalInputs
)
A processed prompt from InputPreprocessor which can be passed to InputProcessor for decoder-only models.
ProcessorInputs module-attribute ¶
ProcessorInputs: TypeAlias = (
DecoderOnlyInputs | EncoderDecoderInputs
)
A processed prompt from InputPreprocessor which can be passed to InputProcessor.
PromptType module-attribute ¶
PromptType: TypeAlias = (
DecoderOnlyPrompt | EncoderDecoderPrompt
)
Schema for any prompt, regardless of model type.
This is the input format accepted by most LLM APIs.
SingletonInputs module-attribute ¶
SingletonInputs: TypeAlias = (
DecoderOnlyInputs | MultiModalEncDecInputs
)
SingletonPrompt module-attribute ¶
SingletonPrompt: TypeAlias = (
DecoderOnlyPrompt | EncoderPrompt | DecoderPrompt
)
Schema for a single prompt. This is as opposed to a data structure which encapsulates multiple prompts, such as ExplicitEncoderDecoderPrompt.
__all__ module-attribute ¶
__all__ = [
"DataPrompt",
"TextPrompt",
"TokensPrompt",
"PromptType",
"SingletonPrompt",
"ExplicitEncoderDecoderPrompt",
"TokenInputs",
"EmbedsInputs",
"EmbedsPrompt",
"token_inputs",
"embeds_inputs",
"DecoderOnlyInputs",
"EncoderDecoderInputs",
"ProcessorInputs",
"SingletonInputs",
"StreamingInput",
]
DataPrompt ¶
Bases: _PromptOptions
Represents generic inputs that are converted to PromptType by IO processor plugins.
Source code in vllm/inputs/data.py
EmbedsInputs ¶
EmbedsPrompt ¶
Bases: _PromptOptions
Schema for a prompt provided via token embeddings.
Source code in vllm/inputs/data.py
prompt instance-attribute ¶
prompt: NotRequired[str]
The prompt text corresponding to the token embeddings, if available.
EncoderDecoderInputs ¶
Bases: TypedDict
A processed pair of encoder and decoder singleton prompts. InputPreprocessor which can be passed to InputProcessor for encoder-decoder models.
Source code in vllm/inputs/data.py
ExplicitEncoderDecoderPrompt ¶
Bases: TypedDict
Schema for a pair of encoder and decoder singleton prompts.
Note
This schema is not valid for decoder-only models.
Source code in vllm/inputs/data.py
decoder_prompt instance-attribute ¶
decoder_prompt: DecoderPrompt | None
The prompt for the decoder part of the model.
Passing None will cause the prompt to be inferred automatically.
encoder_prompt instance-attribute ¶
encoder_prompt: EncoderPrompt
The prompt for the encoder part of the model.
StreamingInput dataclass ¶
Input data for a streaming generation request.
This is used with generate() to support multi-turn streaming sessions where inputs are provided via an async generator.
Source code in vllm/inputs/data.py
TextPrompt ¶
TokenInputs ¶
TokensPrompt ¶
Bases: _PromptOptions
Schema for a tokenized prompt.
Source code in vllm/inputs/data.py
prompt instance-attribute ¶
prompt: NotRequired[str]
The prompt text corresponding to the token IDs, if available.
prompt_token_ids instance-attribute ¶
A list of token IDs to pass to the model.
token_type_ids instance-attribute ¶
token_type_ids: NotRequired[list[int]]
A list of token type IDs to pass to the cross encoder model.
embeds_inputs ¶
embeds_inputs(
prompt_embeds: Tensor, cache_salt: str | None = None
) -> EmbedsInputs
Construct EmbedsInputs from optional values.
Source code in vllm/inputs/data.py
token_inputs ¶
token_inputs(
prompt_token_ids: list[int],
cache_salt: str | None = None,
) -> TokenInputs
Construct TokenInputs from optional values.