fix: enable thinking for all reasoning models on alibaba-cn (DashScope) (#12772)
Co-authored-by: lujia <lujiax@zmn.cn>
This commit is contained in:
@@ -643,6 +643,20 @@ export namespace ProviderTransform {
|
||||
}
|
||||
}
|
||||
|
||||
// Enable thinking for reasoning models on alibaba-cn (DashScope).
|
||||
// DashScope's OpenAI-compatible API requires `enable_thinking: true` in the request body
|
||||
// to return reasoning_content. Without it, models like kimi-k2.5, qwen-plus, qwen3, qwq,
|
||||
// deepseek-r1, etc. never output thinking/reasoning tokens.
|
||||
// Note: kimi-k2-thinking is excluded as it returns reasoning_content by default.
|
||||
if (
|
||||
input.model.providerID === "alibaba-cn" &&
|
||||
input.model.capabilities.reasoning &&
|
||||
input.model.api.npm === "@ai-sdk/openai-compatible" &&
|
||||
!modelId.includes("kimi-k2-thinking")
|
||||
) {
|
||||
result["enable_thinking"] = true
|
||||
}
|
||||
|
||||
if (input.model.api.id.includes("gpt-5") && !input.model.api.id.includes("gpt-5-chat")) {
|
||||
if (!input.model.api.id.includes("gpt-5-pro")) {
|
||||
result["reasoningEffort"] = "medium"
|
||||
|
||||
Reference in New Issue
Block a user