Skip to content

Commit f8a6c87

Browse files
committed
add support for think and options parameters
1 parent 49f28af commit f8a6c87

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

lua/gp/dispatcher.lua

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,41 @@ D.prepare_payload = function(messages, model, provider)
161161
return payload
162162
end
163163

164+
if provider == "ollama" then
165+
local payload = {
166+
model = model.model,
167+
stream = true,
168+
messages = messages,
169+
}
170+
171+
if model.think ~= nil then
172+
payload.think = model.think
173+
end
174+
175+
local options = {}
176+
if model.temperature then
177+
options.temperature = math.max(0, math.min(2, model.temperature))
178+
end
179+
if model.top_p then
180+
options.top_p = math.max(0, math.min(1, model.top_p))
181+
end
182+
if model.min_p then
183+
options.min_p = math.max(0, math.min(1, model.min_p))
184+
end
185+
if model.num_ctx then
186+
options.num_ctx = model.num_ctx
187+
end
188+
if model.top_k then
189+
options.top_k = model.top_k
190+
end
191+
192+
if next(options) then
193+
payload.options = options
194+
end
195+
196+
return payload
197+
end
198+
164199
local output = {
165200
model = model.model,
166201
stream = true,

0 commit comments

Comments
 (0)