Skip to content

Commit 8038a33

Browse files
steebchenclaude
andcommitted
feat(gateway): make alibaba thinking opt-in via reasoning_effort
Drive Alibaba's enable_thinking from reasoning_effort like other providers (openai/anthropic/google/zai). Unset or "minimal" disables thinking; any other effort enables it. Replaces the qwen3.6-35b-a3b JSON workaround — the empty-output bug only manifests when thinking is on, which now requires explicit user opt-in. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 1a5b5d3 commit 8038a33

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

packages/actions/src/prepare-request-body.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,15 +1031,13 @@ export async function prepareRequestBody(
10311031
}
10321032
}
10331033

1034-
// qwen3.6-35b-a3b returns empty content ~40% of the time when json_object
1035-
// is combined with thinking; force thinking off when JSON is requested.
1036-
if (
1037-
usedProvider === "alibaba" &&
1038-
usedModel === "qwen3.6-35b-a3b" &&
1039-
(response_format?.type === "json_object" ||
1040-
response_format?.type === "json_schema")
1041-
) {
1042-
requestBody.enable_thinking = false;
1034+
// Alibaba's API defaults `enable_thinking` to ON for thinking models.
1035+
// Mirror the OpenAI/Anthropic/Google/ZAI contract: thinking is opt-in via
1036+
// `reasoning_effort`. Unset or `minimal` => off, anything else => on.
1037+
if (usedProvider === "alibaba" && supportsReasoning) {
1038+
const wantsThinking =
1039+
reasoning_effort !== undefined && reasoning_effort !== "minimal";
1040+
requestBody.enable_thinking = wantsThinking;
10431041
}
10441042

10451043
if (forcesToolUse && usedProvider === "moonshot") {

0 commit comments

Comments
 (0)