Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
0cd1996e
Unverified
Commit
0cd1996e
authored
Oct 05, 2025
by
Xinyuan Tong
Committed by
GitHub
Oct 06, 2025
Browse files
feat: add shortcut detection for multimodal templates in Jinja format (#11209)
parent
b6b4b563
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
python/sglang/srt/parser/jinja_template_utils.py
python/sglang/srt/parser/jinja_template_utils.py
+6
-0
No files found.
python/sglang/srt/parser/jinja_template_utils.py
View file @
0cd1996e
...
...
@@ -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"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment