feat(providers/openai): allow reasoning-model overrides and recognize gpt-6+ - #57
feat(providers/openai): allow reasoning-model overrides and recognize gpt-6+#57ibetitsmike wants to merge 2 commits into
Conversation
Signed-off-by: drew <[email protected]> (cherry picked from commit cfb0530)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Note on CI: the |
Why
Bedrock Mantle and direct OpenAI both expose
gpt-6-astra, but the fork's Responses client still classifies onlygpt-5*(and o-series/codex) as reasoning models. For any newer generation it omits thereasoningparameter entirely (effort and summary are silently dropped) and forwardstemperature, which OpenAI rejects with HTTP 400. Upstream charmbracelet#354 (cherry-picked here as-is) only widened the publicIsResponsesModel/IsResponsesReasoningModelhelpers;getResponsesModelConfig, which gates the request parameters, was left ongpt-5.Every new model generation currently needs a fork release before chatd can use it correctly. Callers need a way to decide the classification themselves.
What
fix: gpt series 6+ (#354)) unchanged.getResponsesModelConfigtreats gpt-5 and every later generation (gpt-6, gpt-10, ...) as reasoning models;-chatvariants stay non-reasoning; gpt-4 is unchanged.openai.WithReasoningModelFunc(fn func(modelID string) bool), mirroringWithResponsesAPIFunc: when set it replaces the built-in name heuristics for both the Responses client (reasoning params, temperature/top_p filtering, developer vs system role) and the Chat Completions client (WithLanguageModelReasoningModelFunc, including the logprobs/logit_bias filtering inDefaultPrepareCallFunc).Validation
go build ./...,go test ./providers/openai/... -count=1,golangci-lint run ./providers/openai/..., gofumpt clean on touched files.TestPrepareParams_ReasoningModelClassification,TestPrepareParams_ChatReasoningModelOverride(plus upstream'sTestIsResponsesModel/TestIsResponsesReasoningModel). Mutation checks confirmed each assertion fails when the corresponding change is removed.gpt-6-astranow sendsreasoning: {"effort":"low"}withouttemperatureand returns 200; forcing non-reasoning ongpt-5.6-lunavia the new option sendstemperatureand gets OpenAI's 400, showing the override takes effect.Follow-up: coder/coder will bump its pin and expose the override as an
openai_config.reasoning_modelmodel-config flag.