feat: add shortcut detection for multimodal templates in Jinja format (#11209)

This commit is contained in:
Xinyuan Tong
2025-10-05 21:13:17 -07:00
committed by GitHub
parent b6b4b56395
commit 0cd1996eae

View File

@@ -89,6 +89,12 @@ def detect_jinja_template_content_format(chat_template: str) -> str:
- If template has loops like {%- for content in message['content'] -%} → 'openai'
- Otherwise → 'string'
"""
# Shortcut for multimodal templates
if any(
keyword in chat_template for keyword in ["image", "audio", "video", "vision"]
):
return "openai"
jinja_ast = _try_extract_ast(chat_template)
if jinja_ast is None:
return "string"