diff --git a/core/http/middleware/request.go b/core/http/middleware/request.go index e60aa33939..8bddd002a5 100644 --- a/core/http/middleware/request.go +++ b/core/http/middleware/request.go @@ -862,6 +862,17 @@ func MergeOpenResponsesConfig(config *config.ModelConfig, input *schema.OpenResp config.Maxtokens = input.MaxOutputTokens } + // reasoning.effort and request metadata reach the backend the same way as + // on chat/completions (see mergeOpenAIRequestAndModelConfig). + var effort string + if input.Reasoning != nil { + effort = input.Reasoning.Effort + } + config.ApplyReasoningEffort(effort) + if len(input.Metadata) > 0 { + config.RequestMetadata = input.Metadata + } + // Convert tools to functions - this will be handled in the endpoint handler // We just validate that tools are present if needed diff --git a/core/http/middleware/request_test.go b/core/http/middleware/request_test.go index afaf8d9c80..d2d1d539df 100644 --- a/core/http/middleware/request_test.go +++ b/core/http/middleware/request_test.go @@ -426,6 +426,21 @@ var _ = Describe("MergeOpenResponsesConfig tool_choice parsing", func() { }) }) +var _ = Describe("MergeOpenResponsesConfig reasoning", func() { + It("applies reasoning.effort and forwards request metadata", func() { + cfg := &config.ModelConfig{} + req := &schema.OpenResponsesRequest{ + Reasoning: &schema.ORReasoningParam{Effort: "none"}, + Metadata: map[string]string{"enable_thinking": "false"}, + } + Expect(MergeOpenResponsesConfig(cfg, req)).To(Succeed()) + + Expect(cfg.ReasoningEffort).To(Equal("none")) + Expect(cfg.ReasoningConfig.DisableReasoning).To(HaveValue(BeTrue())) + Expect(cfg.RequestMetadata).To(Equal(req.Metadata)) + }) +}) + // --------------------------------------------------------------------------- // SetModelAndConfig + SetOpenAIRequest - /v1/chat/completions tool_choice parsing // ---------------------------------------------------------------------------