From 2aa5470ac586f1603eb9d9b30d6c41ba3b5b9cd4 Mon Sep 17 00:00:00 2001 From: Sebastian Schoennenbeck Date: Thu, 15 May 2025 18:00:21 +0200 Subject: [PATCH] [Frontend] Fix chat template content format detection (#18190) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sebastian Schönnenbeck --- vllm/entrypoints/chat_utils.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/vllm/entrypoints/chat_utils.py b/vllm/entrypoints/chat_utils.py index 6f5514a6f8011..adfacf2b47194 100644 --- a/vllm/entrypoints/chat_utils.py +++ b/vllm/entrypoints/chat_utils.py @@ -387,7 +387,6 @@ def resolve_hf_chat_template( def _resolve_chat_template_content_format( chat_template: Optional[str], tools: Optional[list[dict[str, Any]]], - given_format: ChatTemplateContentFormatOption, tokenizer: AnyTokenizer, *, model_config: ModelConfig, @@ -408,7 +407,7 @@ def _resolve_chat_template_content_format( detected_format = ("string" if jinja_text is None else _detect_content_format(jinja_text, default="string")) - return detected_format if given_format == "auto" else given_format + return detected_format @lru_cache @@ -451,7 +450,6 @@ def resolve_chat_template_content_format( detected_format = _resolve_chat_template_content_format( chat_template, tools, - given_format, tokenizer, model_config=model_config, ) @@ -462,7 +460,8 @@ def resolve_chat_template_content_format( detected_format=detected_format, ) - return detected_format + return detected_format if given_format == "auto" else given_format + ModalityStr = Literal["image", "audio", "video", "image_embeds"]