Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

openai: change the reasonin_effort field to also take none

Patrick Devine1b91d4dda1dd
diff --git a/openai/openai.go b/openai/openai.go
index a9169445e..a01c5d35c 100644
--- a/openai/openai.go
+++ b/openai/openai.go
@@ -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{