vllm.renderers.inputs.preprocess ¶
Schemas and utilites for preprocessing inputs.
DecoderDictPrompt module-attribute ¶
DecoderDictPrompt: TypeAlias = TextPrompt | TokensPrompt
A DecoderPrompt that has been standardized into a dictionary.
DecoderOnlyDictPrompt module-attribute ¶
DecoderOnlyDictPrompt: TypeAlias = (
TextPrompt | TokensPrompt | EmbedsPrompt
)
A DecoderOnlyPrompt that has been standardized into a dictionary.
DictPrompt module-attribute ¶
DictPrompt: TypeAlias = (
DecoderOnlyDictPrompt | EncoderDecoderDictPrompt
)
A PromptType that has been standardized into a dictionary.
EncoderDictPrompt module-attribute ¶
EncoderDictPrompt: TypeAlias = TextPrompt | TokensPrompt
A EncoderPrompt that has been standardized into a dictionary.
SingletonDictPrompt module-attribute ¶
SingletonDictPrompt: TypeAlias = (
DecoderOnlyDictPrompt
| EncoderDictPrompt
| DecoderDictPrompt
)
A SingletonPrompt that has been standardized into a dictionary.
EncoderDecoderDictPrompt ¶
Bases: TypedDict
A EncoderDecoderPrompt that has been standardized into a dictionary.
Source code in vllm/renderers/inputs/preprocess.py
PromptComponents ¶
Bases: NamedTuple
Source code in vllm/renderers/inputs/preprocess.py
_parse_dec_prompt ¶
_parse_dec_prompt(prompt: object) -> DecoderDictPrompt
Source code in vllm/renderers/inputs/preprocess.py
_parse_enc_prompt ¶
_parse_enc_prompt(prompt: object) -> EncoderDictPrompt
Source code in vllm/renderers/inputs/preprocess.py
conversation_to_seq ¶
conversation_to_seq(
conversation_or_conversations: list[
ChatCompletionMessageParam
]
| Sequence[list[ChatCompletionMessageParam]],
) -> Sequence[list[ChatCompletionMessageParam]]
Source code in vllm/renderers/inputs/preprocess.py
extract_prompt_components ¶
extract_prompt_components(
model_config: ModelConfig, prompt: object
) -> PromptComponents
Source code in vllm/renderers/inputs/preprocess.py
extract_prompt_len ¶
extract_prompt_len(
model_config: ModelConfig, prompt: object
)
Source code in vllm/renderers/inputs/preprocess.py
extract_target_prompt ¶
extract_target_prompt(
model_config: ModelConfig, prompt: object
)
parse_dec_only_prompt ¶
parse_dec_only_prompt(
prompt: object,
) -> DecoderOnlyDictPrompt
Parse a prompt for a decoder-only model and normalize it to a dictionary.
Source code in vllm/renderers/inputs/preprocess.py
parse_enc_dec_prompt ¶
parse_enc_dec_prompt(
prompt: object,
) -> EncoderDecoderDictPrompt
Parse a prompt for an encoder-decoder model and normalize it to a dictionary.
Source code in vllm/renderers/inputs/preprocess.py
parse_model_prompt ¶
parse_model_prompt(
model_config: ModelConfig, prompt: object
)
prompt_to_seq ¶
prompt_to_seq(
prompt_or_prompts: SingletonPrompt
| bytes
| Sequence[SingletonPrompt | bytes],
) -> Sequence[SingletonPrompt]
prompt_to_seq(
prompt_or_prompts: ExplicitEncoderDecoderPrompt
| Sequence[ExplicitEncoderDecoderPrompt],
) -> Sequence[ExplicitEncoderDecoderPrompt]
prompt_to_seq(
prompt_or_prompts: PromptType | Sequence[PromptType],
) -> Sequence[PromptType]
prompt_to_seq(
prompt_or_prompts: PromptType
| bytes
| Sequence[PromptType | bytes],
) -> Sequence[PromptType]