Skip to content

Commit b4d54d0

Browse files
committed
fix: bring back unwanted changes
1 parent a70e942 commit b4d54d0

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
@@ -193,6 +193,41 @@ D.prepare_payload = function(messages, model, provider)
193193
return payload
194194
end
195195

196+
if provider == "ollama" then
197+
local payload = {
198+
model = model.model,
199+
stream = true,
200+
messages = messages,
201+
}
202+
203+
if model.think ~= nil then
204+
payload.think = model.think
205+
end
206+
207+
local options = {}
208+
if model.temperature then
209+
options.temperature = math.max(0, math.min(2, model.temperature))
210+
end
211+
if model.top_p then
212+
options.top_p = math.max(0, math.min(1, model.top_p))
213+
end
214+
if model.min_p then
215+
options.min_p = math.max(0, math.min(1, model.min_p))
216+
end
217+
if model.num_ctx then
218+
options.num_ctx = model.num_ctx
219+
end
220+
if model.top_k then
221+
options.top_k = model.top_k
222+
end
223+
224+
if next(options) then
225+
payload.options = options
226+
end
227+
228+
return payload
229+
end
230+
196231
local output = {
197232
model = model.model,
198233
stream = true,

0 commit comments

Comments
 (0)