-
Notifications
You must be signed in to change notification settings - Fork 680
feat: Enable multimodal tool calling #4232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Indrajit Bhosale <[email protected]>
Signed-off-by: Indrajit Bhosale <[email protected]>
Signed-off-by: Indrajit Bhosale <[email protected]>
Signed-off-by: Indrajit Bhosale <[email protected]>
WalkthroughThe change reworks message content preprocessing in the OpenAI prompt template formatter to flatten content arrays into single strings with multimodal placeholders, and adjusts template selection logic to prioritize tool-use templates when tools are present. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes
Poem
Pre-merge checks✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (2)📓 Common learnings📚 Learning: 2025-09-16T19:47:30.312ZApplied to files:
🧬 Code graph analysis (1)lib/llm/src/preprocessor/prompt/template/oai.rs (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (17)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| for (idx, part) in content_array.iter().enumerate() { | ||
| if idx > 0 { | ||
| // Use newline for text-only, space for multimodal | ||
| content_string.push(if is_text_only { '\n' } else { ' ' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: if you have two text portions back to back - would you have a newline in between those?
Overview:
Extends multimodal content array handling in the Rust preprocessor to support tool calling with multimodal requests (images, video, audio).
Details:
Previously only handled text-only content arrays (PR feat: Convert message[content] from list to string. #3067)
Now flattens multimodal arrays by replacing image_url, video_url, audio_url with
Where should the reviewer start?
may_be_fix_msg_content()function - Core logic for flattening multimodal content arraysTesting
Verified Unit tests for
may_be_fix_tool_schemaand tested multimodal flow withpython3 -m dynamo.vllm --model Qwen/Qwen2.5-VL-7B-Instruct --max-model-len 1000 --custom-jinja-template tool_chat_template_hermes.jinja --dyn-tool-call-parser hermesSummary by CodeRabbit
New Features
Improvements