Qwen 3.5 tool calling

For tool calling to work on Qwen 3.5, I had to apply the following patch:

import langchain_community.chat_models.llamacpp as _lcpp
# Patch Qwen3 chat template: expects tool-call arguments as dict, not JSON string.
_lcpp._lc_tool_call_to_openai_tool_call = lambda tc: {
    "type": "function",
    "id": tc["id"],
    "function": {"name": tc["name"], "arguments": tc["args"]},
}

Anyone else experiencing this issue?

Hi @fcorneli

could you report an issue in the repo? I might know what’s the root cause and have a fix for it