mirror of
https://github.com/ollama/ollama.git
synced 2025-11-10 23:57:32 +01:00
openai: change the reasonin_effort field to also take none
This commit is contained in:
@@ -567,18 +567,24 @@ func FromChatRequest(r ChatCompletionRequest) (*api.ChatRequest, error) {
|
||||
}
|
||||
|
||||
var think *api.ThinkValue
|
||||
var effort string
|
||||
|
||||
if r.Reasoning != nil {
|
||||
if !slices.Contains([]string{"high", "medium", "low", "none"}, r.Reasoning.Effort) {
|
||||
return nil, fmt.Errorf("invalid reasoning value: '%s' (must be \"high\", \"medium\", \"low\", or \"none\")", r.Reasoning.Effort)
|
||||
effort = r.Reasoning.Effort
|
||||
} else if r.ReasoningEffort != nil {
|
||||
effort = *r.ReasoningEffort
|
||||
}
|
||||
|
||||
if effort != "" {
|
||||
if !slices.Contains([]string{"high", "medium", "low", "none"}, effort) {
|
||||
return nil, fmt.Errorf("invalid reasoning value: '%s' (must be \"high\", \"medium\", \"low\", or \"none\")", effort)
|
||||
}
|
||||
|
||||
if r.Reasoning.Effort == "none" {
|
||||
if effort == "none" {
|
||||
think = &api.ThinkValue{Value: false}
|
||||
} else {
|
||||
think = &api.ThinkValue{Value: r.Reasoning.Effort}
|
||||
think = &api.ThinkValue{Value: effort}
|
||||
}
|
||||
} else if r.ReasoningEffort != nil {
|
||||
think = &api.ThinkValue{Value: *r.ReasoningEffort}
|
||||
}
|
||||
|
||||
return &api.ChatRequest{
|
||||
|
||||
Reference in New Issue
Block a user