fix: match gpt-5 and o-series model names case-insensitively#12138
Open
Igralino wants to merge 2 commits intocontinuedev:mainfrom
Open
fix: match gpt-5 and o-series model names case-insensitively#12138Igralino wants to merge 2 commits intocontinuedev:mainfrom
Igralino wants to merge 2 commits intocontinuedev:mainfrom
Conversation
Azure deployments are frequently named in uppercase (e.g. "GPT-5"), which failed the previous regex checks and caused Continue to send max_tokens instead of max_completion_tokens, triggering a 400 from the provider. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
isOSeriesOrGpt5PlusModelincore/llm/llms/OpenAI.tsand the equivalent check inpackages/openai-adapters/src/apis/OpenAI.tsare case-sensitive, so model names likeGPT-5,Gpt-5-mini, orO1slip past the regex and never get theirmax_tokensrewritten tomax_completion_tokens.GPT-5). The provider then returns400 Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.iflag to the regexes inisOSeriesOrGpt5PlusModel, and normalize to lower-case before thestartsWith("o")/includes("gpt-5")/startsWith("o3")checks in the adapter. Added uppercase/mixed-case test cases.This mirrors the existing case-insensitive pattern in
packages/openai-adapters/src/apis/openaiResponses.ts(/^(?:gpt-5|gpt-5-codex|o[0-9])/i).Summary by cubic
Make GPT-5 and o‑series model detection case-insensitive. This fixes
max_tokens→max_completion_tokensrewriting for uppercase Azure deployments (e.g.,GPT-5) and prevents 400 errors.core/llm/llms/OpenAI.ts: addiflag too[0-9]+andgpt-[5-9]regexes.packages/openai-adapters/src/apis/OpenAI.ts: usemodel.toLowerCase()forstartsWith("o"),includes("gpt-5"), andstartsWith("o3").GPT-5,Gpt-5.4,O1,O3-mini).Written for commit 0576ec7. Summary will update on new commits.