fix(agent): preserve dots in model names for custom providers#16429
Open
vominh1919 wants to merge 1 commit into
Open
fix(agent): preserve dots in model names for custom providers#16429vominh1919 wants to merge 1 commit into
vominh1919 wants to merge 1 commit into
Conversation
Custom providers point at user-configured endpoints. The dot-to-hyphen conversion in normalize_model_name() is specific to the Anthropic API (claude-opus-4.6 -> claude-opus-4-6) and must not be applied when the user explicitly configured a model name on a custom provider. Add custom to _anthropic_preserve_dots() so model names like claude-sonnet-4.6, glm-4.7, qwen3.5-plus are sent unchanged. Fixes NousResearch#16417 Fixes NousResearch#13061
|
Personal opinion: At the end of the day, adopting a whitelist mechanism is a very poor design. The user-configured model should be trusted as valid, rather than applying such conversions by default. The default should be to not convert dots to hyphens, and only perform the replacement for providers that are known to require hyphens instead of dots. |
Collaborator
|
Likely duplicate of #13068 — same fix: add 'custom' to _anthropic_preserve_dots() provider set. |
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.
Problem
When using a custom provider with the
anthropic_messagesprotocol,normalize_model_name()converts dots to hyphens in model names (e.g.claude-sonnet-4.6→claude-sonnet-4-6). This is correct for the Anthropic API but wrong for custom endpoints that expect the model name unchanged._anthropic_preserve_dots()has an allowlist of providers that preserve dots, but "custom" is not included.Fix
Add
"custom"to the provider set in_anthropic_preserve_dots(). When the provider is "custom", the user has explicitly configured an external endpoint with a specific model name — dot-to-hyphen conversion is Anthropic-specific and must not be applied.Affected model names:
claude-sonnet-4.6,glm-4.7,qwen3.5-plus,MiniMax-M2.7, etc.Tests
New regression test in
tests/agent/test_custom_preserve_dots.py:Fixes #16417
Fixes #13061