server: answer reasoning_effort levels the template rejects with 400 (#32332)
The reasoning effort probe already renders every candidate level, but it dropped the ones the template raises on, so a request with such a level (e.g. max on Qwen3.8) reached the template and came back as a 500 on /v1/chat/completions, /v1/responses and /v1/messages. Keep the raising levels in reasoning_effort_rejected and reject them in oaicompat_chat_params_parse with an invalid_argument, which the server answers with a 400 listing the supported levels. Aliases and levels a template ignores are not rejected, so high on Qwen3.8 still renders as xhigh. Also trim the output_config.effort test to a single level.
This commit is contained in:
1 parent
05db09a4d3
commit
a946eb541a
8 files changed
+54
-4
No files matched your search
@@ -1646,6 +1646,11 @@ json oaicompat_chat_params_parse(
|
||||
inputs.enable_thinking = false;
|
||||
inputs.chat_template_kwargs.erase("reasoning_effort");
|
||||
} else if (!reasoning_effort.empty()) {
|
||||
const auto rejected = caps.at("reasoning_effort_rejected").get<std::vector<std::string>>();
|
||||
if (std::find(rejected.begin(), rejected.end(), reasoning_effort) != rejected.end()) {
|
||||
const auto levels = caps.at("reasoning_effort_levels").get<std::vector<std::string>>();
|
||||
throw std::invalid_argument("reasoning_effort \"" + reasoning_effort + "\" is not supported by the chat template, supported levels: " + string_join(levels, ", "));
|
||||
}
|
||||
inputs.chat_template_kwargs["reasoning_effort"] = json(reasoning_effort).dump();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user