Skip to content

Commit dcd5c2c

Browse files
authored
fix: allow optional temperature and/or top_p (#276)
This change ensures that the payload only includes temperature and top_p if the corresponding model arguments are provided. This gives users the option to use Sonnet with both parameters, and leaving top_p empty for Opus.
1 parent b6cde06 commit dcd5c2c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lua/gp/dispatcher.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ D.prepare_payload = function(messages, model, provider)
155155
messages = messages,
156156
system = system,
157157
max_tokens = model.max_tokens or 4096,
158-
temperature = math.max(0, math.min(2, model.temperature or 1)),
159-
top_p = math.max(0, math.min(1, model.top_p or 1)),
158+
temperature = model.temperature and math.max(0, math.min(2, model.temperature)) or nil,
159+
top_p = model.top_p and math.max(0, math.min(1, model.top_p)) or nil,
160160
}
161161
return payload
162162
end

0 commit comments

Comments
 (0)