Skip to content

Commit 4318517

Browse files
committed
adds reasoning capabilities
1 parent 61811b8 commit 4318517

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

lua/codecompanion/adapters/http/mistral.lua

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,40 @@ return {
149149
return nil
150150
end
151151

152+
local output = {
153+
role = delta.role,
154+
}
155+
156+
if delta.content then
157+
local content = delta.content
158+
if type(content) == "string" then
159+
log:debug("%s", content)
160+
output.content = content
161+
else
162+
output.reasoning = output.reasoning or {}
163+
output.reasoning.content = ""
164+
if content[1].type == "thinking" then
165+
log:debug("content: %s", vim.inspect(content[1]))
166+
output.reasoning.content = content[1].thinking[1].text
167+
else
168+
169+
end
170+
-- for _, it in ipairs(content) do
171+
-- if it["type"] == "thinking" then
172+
-- for _, think in ipairs(it["thinking"]) do
173+
-- log:debug("%s", vim.inspect(it))
174+
-- new_content += think["text"]
175+
-- end
176+
-- end
177+
-- end
178+
end
179+
else
180+
output.content = ""
181+
end
182+
152183
return {
153184
status = "success",
154-
output = {
155-
role = delta.role,
156-
content = delta.content,
157-
},
185+
output = output,
158186
}
159187
end,
160188
tools = {
@@ -184,6 +212,8 @@ return {
184212
-- Premier models
185213
"mistral-large-latest",
186214
["pixtral-large-latest"] = { opts = { has_vision = true } },
215+
["magistral-large-latest"] = { opts = { can_reason = true, has_function_calling = true } },
216+
["magistral-medium-latest"] = { opts = { can_reason = true, has_function_calling = true } },
187217
["mistral-medium-latest"] = { opts = { has_vision = true } },
188218
["mistral-saba-latest"] = { opts = { has_function_calling = false } },
189219
"codestral-latest",

0 commit comments

Comments
 (0)