Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
/vllm/entrypoints/serve/sagemaker @DarkLight1337
/vllm/entrypoints/serve @njhill
/vllm/entrypoints/*.py @njhill
/vllm/entrypoints/chat_utils.py @DarkLight1337
/vllm/entrypoints/common @DarkLight1337
/vllm/entrypoints/llm.py @DarkLight1337

Expand Down
2 changes: 1 addition & 1 deletion docs/models/generative_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ If the model doesn't have a chat template or you want to specify another one,
you can explicitly pass a chat template:

```python
from vllm.entrypoints.chat_utils import load_chat_template
from vllm.renderers.chat_utils import load_chat_template

# You can find a list of existing chat templates under `examples/`
custom_template = load_chat_template(chat_template="<path_to_template>")
Expand Down
2 changes: 1 addition & 1 deletion examples/pooling/embed/vision_embedding_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def run_vlm2vec_qwen2vl(seed: int):
from peft import PeftConfig, PeftModel
from transformers import AutoModelForImageTextToText, AutoProcessor

from vllm.entrypoints.chat_utils import load_chat_template
from vllm.renderers.chat_utils import load_chat_template

model_id = "TIGER-Lab/VLM2Vec-Qwen2VL-2B"

Expand Down
2 changes: 1 addition & 1 deletion rust/src/chat/src/multimodal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ fn input_audio_data_url(data: &str, format: Option<&str>) -> Result<String> {
///
/// Embedding inputs share their base modality's budget rather than getting one
/// of their own, matching Python's `modality.replace("_embeds", "")` in
/// `vllm/entrypoints/chat_utils.py`.
/// `vllm/renderers/chat_utils.py`.
fn media_part_limit_modality(part: &MediaContentPart) -> Option<MmModality> {
match part {
MediaContentPart::Text { .. } => None,
Expand Down
2 changes: 1 addition & 1 deletion tests/entrypoints/multimodal/llm/test_mm_cache_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from tests.entrypoints.multimodal.conftest import TEST_IMAGE_ASSETS
from vllm import LLM
from vllm.entrypoints.chat_utils import ChatCompletionMessageParam
from vllm.renderers.chat_utils import ChatCompletionMessageParam
from vllm.v1.metrics import loggers as stat_loggers
from vllm.v1.metrics.reader import Counter, Metric

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import pytest

from vllm import LLM, SamplingParams
from vllm.entrypoints.chat_utils import ChatCompletionMessageParam
from vllm.inputs import TextPrompt
from vllm.outputs import RequestOutput
from vllm.renderers.chat_utils import ChatCompletionMessageParam


def _make_mock_llm() -> LLM:
Expand Down
2 changes: 1 addition & 1 deletion tests/entrypoints/pooling/embed/test_online.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
)
from tests.models.utils import check_embeddings_close
from tests.utils import RemoteOpenAIServer
from vllm.entrypoints.chat_utils import ChatCompletionMessageParam
from vllm.entrypoints.pooling.embed.protocol import EmbeddingResponse
from vllm.entrypoints.pooling.pooling.protocol import PoolingResponse
from vllm.entrypoints.pooling.utils import (
Expand All @@ -27,6 +26,7 @@
decode_pooling_output,
)
from vllm.platforms import current_platform
from vllm.renderers.chat_utils import ChatCompletionMessageParam
from vllm.tokenizers import get_tokenizer
from vllm.utils.serial_utils import EMBED_DTYPES, ENDIANNESS, binary2tensor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

from tests.models.utils import check_embeddings_close
from tests.utils import RemoteOpenAIServer
from vllm.entrypoints.chat_utils import ChatCompletionMessageParam
from vllm.entrypoints.pooling.pooling.protocol import PoolingResponse
from vllm.entrypoints.pooling.utils import (
MetadataItem,
build_metadata_items,
decode_pooling_output,
)
from vllm.renderers.chat_utils import ChatCompletionMessageParam
from vllm.tokenizers import get_tokenizer
from vllm.utils.serial_utils import EMBED_DTYPES, ENDIANNESS, binary2tensor

Expand Down
6 changes: 3 additions & 3 deletions tests/entrypoints/pooling/scoring/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
from transformers import AutoModel, AutoTokenizer

from tests.conftest import HfRunner
from vllm.entrypoints.chat_utils import (
from vllm.entrypoints.pooling.scoring.typing import ScoreMultiModalParam
from vllm.entrypoints.pooling.scoring.utils import compute_maxsim_score
from vllm.renderers.chat_utils import (
ChatCompletionContentPartImageParam,
ChatCompletionContentPartTextParam,
)
from vllm.entrypoints.pooling.scoring.typing import ScoreMultiModalParam
from vllm.entrypoints.pooling.scoring.utils import compute_maxsim_score
from vllm.transformers_utils.repo_utils import hf_api


Expand Down
2 changes: 1 addition & 1 deletion tests/entrypoints/unit_tests/test_chat_billing_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import pytest

from vllm.entrypoints.chat_utils import _parse_chat_message_content
from vllm.renderers.chat_utils import _parse_chat_message_content

HEADER = (
"x-anthropic-billing-header: cc_version=2.1.220.300; "
Expand Down
2 changes: 1 addition & 1 deletion tests/models/multimodal/generation/test_memory_leak.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from tests.models.registry import HF_EXAMPLE_MODELS
from vllm import LLM, SamplingParams
from vllm.distributed import cleanup_dist_env_and_memory
from vllm.entrypoints.chat_utils import ChatCompletionMessageParam
from vllm.platforms import current_platform
from vllm.renderers.chat_utils import ChatCompletionMessageParam
from vllm.utils.mem_constants import KiB_bytes, MiB_bytes
from vllm.utils.mem_utils import format_mib

Expand Down
6 changes: 3 additions & 3 deletions tests/models/multimodal/pooling/test_colpali.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
import torch
from PIL import Image

from vllm.entrypoints.chat_utils import (
from vllm.entrypoints.pooling.scoring.typing import ScoreMultiModalParam
from vllm.platforms import current_platform
from vllm.renderers.chat_utils import (
ChatCompletionContentPartImageParam,
ChatCompletionContentPartTextParam,
)
from vllm.entrypoints.pooling.scoring.typing import ScoreMultiModalParam
from vllm.platforms import current_platform

from ....conftest import VllmRunner

Expand Down
4 changes: 2 additions & 2 deletions tests/models/multimodal/pooling/test_colqwen3.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
import torch
from PIL import Image

from vllm.entrypoints.chat_utils import (
from vllm.entrypoints.pooling.scoring.typing import ScoreMultiModalParam
from vllm.renderers.chat_utils import (
ChatCompletionContentPartImageParam,
ChatCompletionContentPartTextParam,
)
from vllm.entrypoints.pooling.scoring.typing import ScoreMultiModalParam

from ....conftest import VllmRunner

Expand Down
4 changes: 2 additions & 2 deletions tests/models/multimodal/pooling/test_jinavl_reranker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
from transformers import AutoModel

from vllm.assets.base import VLLM_S3_BUCKET_URL
from vllm.entrypoints.chat_utils import (
from vllm.entrypoints.pooling.scoring.typing import ScoreMultiModalParam
from vllm.renderers.chat_utils import (
ChatCompletionContentPartImageEmbedsParam,
ChatCompletionContentPartImageParam,
ChatCompletionContentPartTextParam,
)
from vllm.entrypoints.pooling.scoring.typing import ScoreMultiModalParam

from ....conftest import HfRunner, VllmRunner

Expand Down
8 changes: 4 additions & 4 deletions tests/models/multimodal/pooling/test_llama_nemotron_vl.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
from PIL import Image
from transformers import AutoModel, AutoModelForSequenceClassification, AutoProcessor

from vllm.entrypoints.chat_utils import (
ChatCompletionContentPartImageParam,
ChatCompletionContentPartTextParam,
)
from vllm.entrypoints.pooling.scoring.typing import ScoreMultiModalParam
from vllm.model_executor.layers.fusion.mm_input_norm import FusedMMInputNorm
from vllm.platforms import current_platform
from vllm.renderers.chat_utils import (
ChatCompletionContentPartImageParam,
ChatCompletionContentPartTextParam,
)
from vllm.transformers_utils.processors.nemotron_vl import (
SIGLIP_MEAN,
SIGLIP_STD,
Expand Down
2 changes: 1 addition & 1 deletion tests/models/multimodal/processing/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
PlaceholderMetadataResolver,
collect_ec_item_metadata,
)
from vllm.entrypoints.chat_utils import _get_embeds_data
from vllm.inputs import MultiModalDataDict, MultiModalInput
from vllm.multimodal import MULTIMODAL_REGISTRY
from vllm.multimodal.cache import MultiModalProcessorOnlyCache
from vllm.multimodal.inputs import MultiModalFeatureSpec, batched_tensors_equal
from vllm.multimodal.processing import BaseMultiModalProcessor, InputProcessingContext
from vllm.platforms import current_platform
from vllm.renderers.chat_utils import _get_embeds_data
from vllm.tokenizers import TokenizerLike, cached_tokenizer_from_config
from vllm.utils.mistral import is_mistral_tokenizer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@
from vllm.assets.image import ImageAsset
from vllm.assets.video import VideoAsset
from vllm.config import ModelConfig
from vllm.entrypoints.chat_utils import (
from vllm.exceptions import VLLMValidationError
from vllm.inputs import MultiModalDataDict, MultiModalUUIDDict
from vllm.multimodal.utils import (
encode_audio_url,
encode_image_url,
encode_video_url,
)
from vllm.renderers.chat_utils import (
MEDIA_CONNECTOR_REGISTRY,
AsyncMultiModalItemTracker,
ChatCompletionMessageParam,
Expand All @@ -26,13 +33,6 @@
parse_chat_messages_async,
validate_chat_template,
)
from vllm.exceptions import VLLMValidationError
from vllm.inputs import MultiModalDataDict, MultiModalUUIDDict
from vllm.multimodal.utils import (
encode_audio_url,
encode_image_url,
encode_video_url,
)
from vllm.utils.serial_utils import tensor2base64

KIMI_K2_5_MODEL_ID = "moonshotai/Kimi-K2.5"
Expand Down
6 changes: 3 additions & 3 deletions tests/renderers/test_chat_utils_prompt_embeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
import torch
from transformers import AutoTokenizer

from vllm.entrypoints.chat_utils import (
from vllm.exceptions import VLLMValidationError
from vllm.renderers import TokenizeParams
from vllm.renderers.chat_utils import (
_ENABLE_PROMPT_EMBEDS_ERROR,
_PROMPT_EMBEDS_MISSING_DATA_ERROR,
_RESERVED_PLACEHOLDER_IN_TEXT_ERROR,
Expand All @@ -26,8 +28,6 @@
parse_chat_messages,
parse_chat_messages_async,
)
from vllm.exceptions import VLLMValidationError
from vllm.renderers import TokenizeParams
from vllm.renderers.hf import (
_PROMPT_EMBEDS_PLACEHOLDER_SPAN_MISMATCH_ERROR,
_build_mixed_prompt_embeds,
Expand Down
2 changes: 1 addition & 1 deletion tests/renderers/test_hf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import pytest

from vllm.config import ModelConfig
from vllm.entrypoints.chat_utils import load_chat_template
from vllm.entrypoints.openai.chat_completion.protocol import ChatCompletionRequest
from vllm.exceptions import VLLMValidationError
from vllm.renderers.chat_utils import load_chat_template
from vllm.renderers.hf import (
_consolidate_system_messages,
_convert_developer_to_system,
Expand Down
2 changes: 1 addition & 1 deletion tests/renderers/test_warmup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

import pytest

from vllm.entrypoints.chat_utils import ChatTemplateResolutionError
from vllm.multimodal.processing import BaseMultiModalProcessor
from vllm.renderers.base import BaseRenderer
from vllm.renderers.chat_utils import ChatTemplateResolutionError
from vllm.renderers.params import ChatParams


Expand Down
2 changes: 1 addition & 1 deletion tests/tokenizers_/test_deepseek_v4.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest
import torch

from vllm.entrypoints.chat_utils import parse_chat_messages
from vllm.renderers.chat_utils import parse_chat_messages
from vllm.renderers.registry import RENDERER_REGISTRY
from vllm.tokenizers.deepseek_v4 import get_deepseek_v4_tokenizer
from vllm.tokenizers.registry import TokenizerRegistry
Expand Down
2 changes: 1 addition & 1 deletion tests/tokenizers_/test_mistral.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from mistral_common.guidance.grammar_factory import GrammarFactory
from mistral_common.tokens.tokenizers.base import SpecialTokenPolicy, SpecialTokens

from vllm.entrypoints.chat_utils import ChatCompletionMessageParam
from vllm.entrypoints.openai.chat_completion.protocol import ChatCompletionRequest
from vllm.exceptions import VLLMValidationError
from vllm.renderers.chat_utils import ChatCompletionMessageParam
from vllm.tokenizers.mistral import (
MistralTokenizer,
_validate_apply_chat_template_args,
Expand Down
2 changes: 1 addition & 1 deletion vllm/entrypoints/anthropic/serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
AnthropicToolChangeDefinition,
AnthropicUsage,
)
from vllm.entrypoints.chat_utils import ChatTemplateContentFormatOption
from vllm.entrypoints.generate.base.protocol import (
JsonSchemaResponseFormat,
ResponseFormat,
Expand All @@ -54,6 +53,7 @@
from vllm.entrypoints.serve.exception_handling.utils import sanitize_message
from vllm.entrypoints.serve.utils.request_logger import RequestLogger
from vllm.logger import init_logger
from vllm.renderers.chat_utils import ChatTemplateContentFormatOption
from vllm.renderers.hf import HfRenderer, resolve_chat_template
from vllm.renderers.online_renderer import OnlineRenderer

Expand Down
4 changes: 2 additions & 2 deletions vllm/entrypoints/cohere/serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
from pydantic import BaseModel

from vllm.engine.protocol import EngineClient
from vllm.entrypoints.chat_utils import ChatTemplateContentFormatOption
from vllm.entrypoints.cohere.cohere_chat_message import (
CitationSource as InternalCitationSource,
)
Expand Down Expand Up @@ -91,6 +90,7 @@
from vllm.entrypoints.serve.exception_handling.utils import sanitize_message
from vllm.entrypoints.serve.utils.request_logger import RequestLogger
from vllm.parser.abstract_parser import Parser
from vllm.renderers.chat_utils import ChatTemplateContentFormatOption
from vllm.renderers.cohere import (
MESSAGES_CITATIONS_KEY,
POSITION_TO_SOURCE_KEY,
Expand Down Expand Up @@ -509,7 +509,7 @@ def _convert_tool_message(cls, msg: ToolChatMessageV2) -> dict[str, Any]:
# ``TextToolContent`` and ``DocumentToolContent``. The latter
# produces ``{"type": "document", "document": {...}}`` blocks,
# which vLLM's shared ``_parse_chat_message_content_parts`` in
# ``vllm/entrypoints/chat_utils.py`` rejects because the OpenAI
# ``vllm/renderers/chat_utils.py`` rejects because the OpenAI
# ``ChatCompletionContentPartParam`` union only knows text /
# image / audio / etc. Emitting them anyway triggers a Pydantic
# ``ValidatorIterator`` failure at chat-parsing time, so we
Expand Down
8 changes: 4 additions & 4 deletions vllm/entrypoints/common/offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
SamplingParams,
)
from vllm.config import ModelConfig
from vllm.entrypoints.chat_utils import (
ChatCompletionMessageParam,
ChatTemplateContentFormatOption,
)
from vllm.exceptions import VLLMValidationError
from vllm.inputs import EngineInput
from vllm.logger import init_logger
from vllm.lora.request import LoRARequest
from vllm.renderers import BaseRenderer, ChatParams, merge_kwargs
from vllm.renderers.chat_utils import (
ChatCompletionMessageParam,
ChatTemplateContentFormatOption,
)
from vllm.renderers.inputs.preprocess import (
conversation_to_seq,
parse_model_prompt,
Expand Down
2 changes: 1 addition & 1 deletion vllm/entrypoints/generate/api_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async def init_generate_state(
default_chat_template_kwargs: dict[str, Any],
):
from vllm.entrypoints.anthropic.serving import AnthropicServingMessages
from vllm.entrypoints.chat_utils import load_chat_template
from vllm.renderers.chat_utils import load_chat_template

# The Cohere serving handler depends on the optional `cohere` SDK for
# its wire-format protocol models, and is additionally gated on the
Expand Down
2 changes: 1 addition & 1 deletion vllm/entrypoints/generate/base/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

import vllm.envs as envs
from vllm.config.utils import replace
from vllm.entrypoints.chat_utils import make_tool_call_id
from vllm.entrypoints.serve.engine.protocol import OpenAIBaseModel, UsageInfo
from vllm.exceptions import VLLMValidationError
from vllm.logger import init_logger
from vllm.renderers.chat_utils import make_tool_call_id
from vllm.sampling_params import StructuredOutputsParams

logger = init_logger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion vllm/entrypoints/generate/structured_decisions/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
from pydantic import Field, model_validator

from vllm.config import ModelConfig
from vllm.entrypoints.chat_utils import ChatTemplateContentFormatOption
from vllm.entrypoints.generate.base.protocol import validate_cache_salt
from vllm.entrypoints.serve.engine.protocol import OpenAIBaseModel
from vllm.renderers import ChatParams, TokenizeParams, merge_kwargs
from vllm.renderers.chat_utils import ChatTemplateContentFormatOption
from vllm.utils import random_uuid


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

from vllm.config import ModelConfig
from vllm.engine.protocol import EngineClient
from vllm.entrypoints.chat_utils import ChatTemplateContentFormatOption
from vllm.entrypoints.generate.label_reads import next_token_label_reads
from vllm.inputs import EngineInput, tokens_input
from vllm.lora.request import LoRARequest
from vllm.renderers.chat_utils import ChatTemplateContentFormatOption
from vllm.renderers.inputs.preprocess import extract_prompt_components
from vllm.renderers.online_renderer import OnlineRenderer
from vllm.sampling_params import SamplingParams
Expand Down
Loading
Loading