Description
Description
Qwen2.5 models fail to perform tool calls when using the oa-compat provider format. The same model works correctly in Open WebUI.
Root Cause
In packages/console/app/src/routes/zen/util/provider/openai-compatible.ts, the toOaCompatibleRequest function has two issues:
-
Assumes flat tool format only — The tools mapping does tool.name, tool.description, tool.parameters directly, but CommonTool objects arriving from other format converters may already be in the nested OpenAI format { type: "function", function: { name, description, parameters } }. When tools arrive nested, tool.name is undefined and the tool definition sent to the model is empty.
-
Missing strict field — The CommonTool interface in provider.ts defines strict?: boolean, but toOaCompatibleRequest drops it during tool mapping. Some models (including Qwen2.5) rely on this field.
Current code (line 189)
const tools = Array.isArray(body.tools)
? body.tools.map((tool: any) => ({
type: "function",
function: {
name: tool.name,
description: tool.description,
parameters: tool.parameters,
},
}))
: undefined
### Plugins
_No response_
### OpenCode version
_No response_
### Steps to reproduce
_No response_
### Screenshot and/or share link
_No response_
### Operating System
_No response_
### Terminal
_No response_
Description
Description
Qwen2.5 models fail to perform tool calls when using the
oa-compatprovider format. The same model works correctly in Open WebUI.Root Cause
In
packages/console/app/src/routes/zen/util/provider/openai-compatible.ts, thetoOaCompatibleRequestfunction has two issues:Assumes flat tool format only — The tools mapping does
tool.name,tool.description,tool.parametersdirectly, butCommonToolobjects arriving from other format converters may already be in the nested OpenAI format{ type: "function", function: { name, description, parameters } }. When tools arrive nested,tool.nameisundefinedand the tool definition sent to the model is empty.Missing
strictfield — TheCommonToolinterface inprovider.tsdefinesstrict?: boolean, buttoOaCompatibleRequestdrops it during tool mapping. Some models (including Qwen2.5) rely on this field.Current code (line 189)