Enable tool calling for MLLM/VLM chat paths by passing tools and tool_choice into chat templates#116
Conversation
|
@waybarrios, @swaylenhayes: status note plus coordination. This PR passes PR currently shows CONFLICTING merge status. Last activity Feb 25 (~6 weeks ago). Coordination note: PR #139 (kargarisaac, "fix: pass tools to chat template in MLLM path") targets the same problem with a narrower scope (just Worth a rebase status update if you are still active on this branch. |
|
Still active. I agree #116 is stale as opened and should not be revived blindly. Given that #139 covers the narrower core bug (
If you would prefer one consolidated branch instead, I can rebase and refresh the broader path, but my bias is toward the smaller landing. |
|
@swaylenhayes thanks for the constructive response. The smallest-fix-first approach is the right call. The order I would suggest:
That gives smaller focused reviews for waybarrios and bounds the failure mode of any one piece. If #139 stalls on the rebase, your consolidated-#116 fallback is also fine. Tagging @waybarrios for the path-forward call. Happy to help with the follow-up narrow PR if useful. |
|
Hey @swaylenhayes — thanks for this PR! All the functional changes are now in
These landed via PR #278 (production backport) and PR #258 (sampling params). The documentation guide ( Closing as superseded. Thanks for the contribution! |
VLM/MLLM Tool Calling Support
Problem
Multimodal models served with
--mllmacceptedtoolsin API payloads,but tool metadata was not consistently passed into MLLM chat-template paths.
This left many VLM requests without structured
tool_callsoutput even whenparser flags were enabled.
Fix
Pass
toolsandtool_choicethrough MLLM chat/template paths in both engines:SimpleEnginetools+tool_choicein MLLMchatandstream_chatBatchedEngine_apply_chat_templatenow acceptstool_choicetool_choicethrough prompt/prefix-boundary flowsMLXMultimodalLMtools+tool_choicein chat-template invocation with safe fallbackserver.pytool_choicewhentoolsare suppliedValidation
in
tests/test_simple_engine.py.Usage
Notes
tool_choicesupport is best-effort: templates that don't supporttool_choicefall back cleanly without raising template errors.