mirror of https://github.com/ollama/ollama
openai: change the reasonin_effort field to also take none
This commit is contained in:
parent
7d965258ce
commit
1b91d4dda1
|
|
@ -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 r.Reasoning.Effort == "none" {
|
||||
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 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{
|
||||
|
|
|
|||
Loading…
Reference in New Issue