mirror of
https://github.com/ollama/ollama.git
synced 2025-11-10 21:17:32 +01:00
openai: always provide reasoning
We were missing passing along thinking if content was nil (as opposed to empty string) Also added a test for content not being passed, which was the real cause of <https://github.com/ollama/ollama/issues/11704>, since with the way `Content` is typed, not passing it and empty string are distinct
This commit is contained in:
@@ -478,6 +478,7 @@ func fromChatRequest(r ChatCompletionRequest) (*api.ChatRequest, error) {
|
||||
if toolName != "" {
|
||||
messages[len(messages)-1].ToolName = toolName
|
||||
}
|
||||
messages[len(messages)-1].Thinking = msg.Reasoning
|
||||
}
|
||||
default:
|
||||
// content is only optional if tool calls are present
|
||||
@@ -493,7 +494,7 @@ func fromChatRequest(r ChatCompletionRequest) (*api.ChatRequest, error) {
|
||||
return nil, errors.New("invalid tool call arguments")
|
||||
}
|
||||
}
|
||||
messages = append(messages, api.Message{Role: msg.Role, ToolCalls: toolCalls})
|
||||
messages = append(messages, api.Message{Role: msg.Role, Thinking: msg.Reasoning, ToolCalls: toolCalls})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user