fix(azure): use max_completion_tokens and omit temperature for reasoning deployments - #2807
Merged
esokullu merged 3 commits intoAug 16, 2026
Conversation
…ing deployments Azure OpenAI deployments of reasoning models (o1, o3, o4, gpt-5, gpt-4.1) reject the legacy max_tokens parameter and any temperature override, so every chat, Ask, and connection-test request 400s. Mirror the _isNewOpenAIContract detection from the OpenAI-compatible provider and switch to max_completion_tokens with the API's default temperature. Legacy deployments (gpt-4o, gpt-35-turbo) keep max_tokens and 0.7 temperature; config.omitTemperature is now honored on any deployment.
Deployment names do not reveal the model behind them (prod-chat may back o3-mini, o365-assistant may back gpt-35-turbo), so name-guessing both misses reasoning deployments and misfires on look-alike names. Drop the heuristic; the Compatibility panel's max tokens field is now the explicit per-deployment switch. Setting it to max_completion_tokens also omits temperature, since a reasoning deployment rejects any non-default temperature. The panel and the wire contract stay consistent.
|
@alectimison-maker is attempting to deploy a commit to the esokullu's projects Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Author
|
Thanks — you're right that deployment names don't reveal the model, and the guess misfired in both directions. I've reworked the approach to drop name-guessing entirely:
This also resolves the untrimmed-read and the settings-panel-drift concerns: there is no name probe to trim, and New tests: o1/o3/o4/gpt-5/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
max_completion_tokensand omittemperature, matching the new OpenAI wire contract these models require.max_tokensandtemperature: 0.7unchanged.config.omitTemperatureis now honored on any deployment.Fixes #2806.
Motivation
Azure rejects
max_tokensand any non-defaulttemperaturefor reasoning-model deployments, so every chat, Ask, and connection-test request 400s and the provider is unusable with those models. The OpenAI-compatible provider already migrated via_isNewOpenAIContract()(src/chrome/src/providers/openai.js:170); the Azure class (src/chrome/src/providers/azure-openai.js:64) still hard-codes the legacy contract, and itstemperaturecould not even be suppressed viaextraBody(it is not inRESERVED_EXTRA_BODY_KEYS).Design
Mirrored the OpenAI-compatible provider's contract detection: a regex over the deployment name (which commonly mirrors the model id) with the same anchored pattern
^(gpt-5|gpt-4\.1|o1|o3|o4). Deployment names that do not match the pattern keep the legacy contract, and custom reasoning deployments can still opt out viaconfig.omitTemperature— both paths are tested. Changes are mirrored to the Firefox tree per the repo's parity convention.Testing
node test/run.js— 1766 passed, 0 failed (3 new tests cover both Chrome and Firefox providers)npm run test:security— 60/60 passednpm run test:toolbar-guard— 33 passedNew tests assert the wire body directly (
_buildRequestBody) for reasoning deployments (max_completion_tokens set, max_tokens and temperature absent), legacy deployments (max_tokens and temperature 0.7 preserved), and theomitTemperatureescape hatch. No network access needed.Compatibility and risks
omitTemperatureescape hatch.api-versionthat supportsmax_completion_tokensfor reasoning models — this was already a requirement for those deployments to work at all.Scope
_isNewOpenAIContractcannot seeopenai/o1-style ids) — noted as a follow-up, not addressed here.