[Chore] Remove redundant input parsing methods (#33542)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
Cyrus Leung
2026-02-02 10:50:47 +00:00
committed by GitHub
parent ba871fb788
commit a502831d36
7 changed files with 21 additions and 51 deletions
+4 -17
View File
@@ -5,7 +5,7 @@ from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Generic, Literal, TypeAlias, cast
import torch
from typing_extensions import NotRequired, TypedDict, TypeIs, TypeVar
from typing_extensions import NotRequired, TypedDict, TypeVar
from vllm.sampling_params import SamplingParams
@@ -77,6 +77,9 @@ class EmbedsPrompt(_CommonKeys):
prompt_embeds: torch.Tensor
"""The embeddings of the prompt."""
prompt: NotRequired[str]
"""The prompt text corresponding to the token embeddings, if available."""
class DataPrompt(_CommonKeys):
"""Represents generic inputs handled by IO processor plugins."""
@@ -113,22 +116,6 @@ more than one prompt, i.e.
"""
def is_tokens_prompt(prompt: SingletonPrompt) -> TypeIs[TokensPrompt]:
return (
isinstance(prompt, dict)
and "prompt_token_ids" in prompt
and "prompt_embeds" not in prompt
)
def is_embeds_prompt(prompt: SingletonPrompt) -> TypeIs[EmbedsPrompt]:
return (
isinstance(prompt, dict)
and "prompt_token_ids" not in prompt
and "prompt_embeds" in prompt
)
_T1_co = TypeVar(
"_T1_co", bound=SingletonPrompt, default=SingletonPrompt, covariant=True
)