fix(responses): apply reasoning effort and request metadata

Signed-off-by: Aniruddh Krovvidi <akrovvidi05@gmail.com>
This commit is contained in:
Aniruddh Krovvidi committed 2026-11-01 00:22:10 -07:00
1 parent 832dff3c74
commit 6ec73be618
2 files changed
+26

No files matched your search

+11
View File
@@ -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
+15
View File
@@ -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
// ---------------------------------------------------------------------------