fix(core): add thinking toggle variants for Vertex MaaS models (#54040)

This commit is contained in:
Aiden Cline
2026-10-08 20:27:23 -05:00
committed by GitHub
Unverified
parent 3a2fa2b9d2
commit ea666727a1
+12 -1
View File
@@ -79,6 +79,17 @@ const openaiChat: Protocol = (_, support) => {
return efforts(support.values ?? EFFORTS, (effort) => ({ settings: { reasoningEffort: effort } }))
}
// Vertex MaaS models switch thinking through the chat template. DeepSeek names the flag `thinking`; the
// others (GLM, Gemma) use `enable_thinking`.
const vertexChat: Protocol = (model, support) => {
if (support.type !== "toggle") return openaiChat(model, support)
const key = modelID(model).toLowerCase().includes("deepseek") ? "thinking" : "enable_thinking"
return toggle(
{ body: { chat_template_kwargs: { [key]: false } } },
{ body: { chat_template_kwargs: { [key]: true } } },
)
}
const openaiResponses: Protocol = (_, support) => {
if (support.type !== "effort") return []
return efforts(support.values ?? ["none", "minimal", ...EFFORTS, "xhigh"], responsesEffort)
@@ -576,7 +587,7 @@ const PROTOCOLS: Readonly<Record<string, Protocol>> = {
"@opencode/ai/providers/openai-compatible": openaiCompatible,
"@opencode/ai/providers/azure/chat": openaiChat,
"@opencode/ai/providers/google-vertex/chat": openaiChat,
"@opencode/ai/providers/google-vertex/chat": vertexChat,
"@opencode/ai/providers/alibaba/chat": alibabaChat,
"@opencode/ai/providers/baseten": basetenChat,
"@opencode/ai/providers/cerebras": openaiChat,