fix: do not allow max_tokens & max_completion_tokens at the same time (#1633)
* fix: do not allow max_tokens & max_completion_tokens at the same time * chore: fix formatting
This commit is contained in:
@@ -32,8 +32,7 @@ function M:parse_curl_args(prompt_opts)
|
||||
end
|
||||
end
|
||||
|
||||
-- NOTE: When using reasoning models set supported parameters
|
||||
self.set_reasoning_params(provider_conf, request_body)
|
||||
self.set_allowed_params(provider_conf, request_body)
|
||||
|
||||
return {
|
||||
url = Utils.url_join(
|
||||
|
||||
@@ -69,13 +69,14 @@ end
|
||||
|
||||
function M.is_reasoning_model(model) return model and string.match(model, "^o%d+") ~= nil end
|
||||
|
||||
function M.set_reasoning_params(provider_conf, request_body)
|
||||
function M.set_allowed_params(provider_conf, request_body)
|
||||
if M.is_reasoning_model(provider_conf.model) then
|
||||
request_body.temperature = 1
|
||||
request_body.reasoning_effort = request_body.reasoning_effort
|
||||
else
|
||||
request_body.reasoning_effort = nil
|
||||
end
|
||||
-- If max_tokens is set in config, unset max_completion_tokens
|
||||
if request_body.max_tokens then request_body.max_completion_tokens = nil end
|
||||
end
|
||||
|
||||
function M:parse_messages(opts)
|
||||
@@ -305,8 +306,7 @@ function M:parse_curl_args(prompt_opts)
|
||||
request_body.include_reasoning = true
|
||||
end
|
||||
|
||||
-- NOTE: When using reasoning models set supported parameters
|
||||
self.set_reasoning_params(provider_conf, request_body)
|
||||
self.set_allowed_params(provider_conf, request_body)
|
||||
|
||||
local tools = nil
|
||||
if not disable_tools and prompt_opts.tools then
|
||||
|
||||
Reference in New Issue
Block a user