fix: expand tool support to reduce 'Invalid tool name' errors (#11792)

fix: expand tool support to prevent "Invalid tool name" errors

Models not recognized in PROVIDER_TOOL_SUPPORT fall back to a text-based
tool calling format injected into the system message. When models don't
follow this format exactly, the parser throws "Invalid tool name". This
was affecting many models that actually support native tool calling but
weren't listed.

Changes:
- Azure: add gpt-5, gpt-4.1, o1, o4 (was only gpt-4, o3)
- Ollama: add glm-4/5, deepseek, dolphin families
- DeepSeek provider: add deepseek-coder (was only chat/reasoner)
- OpenRouter: add deepseek/deepseek-v3, deepseek/deepseek-coder

Fixes #10678, #11594, #11431, #11218, #10900, #10272, #10156, #10143,
#10050, #9891, #9839
This commit is contained in:
Dallin Romney 2026-03-24 20:23:07 -07:00 • committed by GitHub
parent 09650d4a4f
commit afa6bab1ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -28,9 +28,14 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => boolean> =
return false;
},
azure: (model) => {
const lower = model.toLowerCase();
if (
model.toLowerCase().startsWith("gpt-4") ||
model.toLowerCase().startsWith("o3")
lower.startsWith("gpt-4") ||
lower.startsWith("gpt-5") ||
lower.startsWith("gpt-4.1") ||
lower.startsWith("o1") ||
lower.startsWith("o3") ||
lower.startsWith("o4")
)
return true;
return false;
@ -210,6 +215,10 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => boolean> =
"devstral",
"exaone",
"gpt-oss",
"glm-4",
"glm-5",
"deepseek",
"dolphin",
].some((part) => modelName.toLowerCase().includes(part))
) {
return true;
@ -270,7 +279,12 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => boolean> =
deepseek: (model) => {
// https://api-docs.deepseek.com/quick_start/pricing
// https://api-docs.deepseek.com/guides/function_calling
if (model === "deepseek-reasoner" || model === "deepseek-chat") {
const lower = model.toLowerCase();
if (
lower === "deepseek-reasoner" ||
lower === "deepseek-chat" ||
lower.startsWith("deepseek-coder")
) {
return true;
}
@ -343,6 +357,8 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => boolean> =
"amazon/nova",
"deepseek/deepseek-r1",
"deepseek/deepseek-chat",
"deepseek/deepseek-v3",
"deepseek/deepseek-coder",
"meta-llama/llama-4",
"all-hands/openhands-lm-32b",
"lgai-exaone/exaone",