feat: supports openai o1-preview

* feat: make O1 models on openai work by handle non-streams & correct
parameters

* chore: set temperature automatically when using o1 models
This commit is contained in:
Sapir Shemer
2024-09-27 16:08:10 +03:00
committed by GitHub
parent 64f26b9e72
commit d74c9d0417
2 changed files with 56 additions and 6 deletions

View File

@@ -114,6 +114,10 @@ M.stream = function(opts)
if data_match then Provider.parse_response(data_match, current_event_state, handler_opts) end
end
local function parse_response_without_stream(data)
Provider.parse_response_without_stream(data, current_event_state, handler_opts)
end
local completed = false
local active_job
@@ -170,6 +174,14 @@ M.stream = function(opts)
end
end)
end
-- If stream is not enabled, then handle the response here
if spec.body.stream == false and result.status == 200 then
vim.schedule(function()
completed = true
parse_response_without_stream(result.body)
end)
end
end,
})