From f06ddbbb34a72ed60ec6eda18f15a0fa3156c343 Mon Sep 17 00:00:00 2001 From: Aniruddh Krovvidi Date: Wed, 28 Oct 2026 11:10:37 -0700 Subject: [PATCH] fix(responses): apply reasoning effort and request metadata Signed-off-by: Aniruddh Krovvidi (cherry picked from commit 6ec73be618f31023308669e97fa595474b7f83a8) Signed-off-by: Ettore Di Giacinto --- core/http/middleware/request.go | 11 +++++++++++ core/http/middleware/request_test.go | 15 +++++++++++++++ 2 files changed, 26 insertions(+) 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 // ---------------------------------------------------------------------------