Unverified Commit 0cd1996e authored by Xinyuan Tong's avatar Xinyuan Tong Committed by GitHub
Browse files

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

parent b6b4b563
...@@ -89,6 +89,12 @@ def detect_jinja_template_content_format(chat_template: str) -> str: ...@@ -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' - If template has loops like {%- for content in message['content'] -%} → 'openai'
- Otherwise → 'string' - 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) jinja_ast = _try_extract_ast(chat_template)
if jinja_ast is None: if jinja_ast is None:
return "string" return "string"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment