Skip to content

Commit 6adae51

Browse files
committed
feat: Explicitly reject string values for "enable_thinking"
There are too many possible "truthy" / "falsy" strings and too many ambiguous strings that don't have a clear truthy/falsy value, so the simplest thing to do here is to reject the request. Ideally, this would be a 422 (Unprocessable Entity), but right now it's coming back as a 500. Branch: gabe-l-hart/thinking-model-disabled-agent-prefill Signed-off-by: Gabe Goodhart <[email protected]>
1 parent 4c06dca commit 6adae51

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools/server/utils.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,8 @@ static json oaicompat_chat_params_parse(
772772
inputs.enable_thinking = true;
773773
} else if (enable_thinking_kwarg == "false") {
774774
inputs.enable_thinking = false;
775+
} else if (!enable_thinking_kwarg.empty() && enable_thinking_kwarg[0] == '"') {
776+
throw std::runtime_error("invalid type for \"enable_thinking\" (expected boolean, got string)");
775777
}
776778

777779
// if the assistant message appears at the end of list, we do not add end-of-turn token

0 commit comments

Comments
 (0)