fix: use identity mapper as default for AzureModelMapperFunc - #957
Open
lxcxjxhx wants to merge 1 commit into
Open
fix: use identity mapper as default for AzureModelMapperFunc#957lxcxjxhx wants to merge 1 commit into
lxcxjxhx wants to merge 1 commit into
Conversation
The upstream SDK defaultAzureConfig strips dots and colons from model names (legacy Azure convention where gpt-3.5-turbo deployed as gpt-35-turbo). Modern Azure Foundry deployments can contain dots in their names, so this silent transformation causes 404s with no hint that the name was rewritten. Use an identity function by default instead, so deployment names are passed through unchanged. Users who need the legacy stripping behavior can explicitly set AzureModelMapperFunc. Also update the doc comment to reflect the actual default behavior. Fixes cloudwego#939
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.
Description
Use an identity function as the default for
AzureModelMapperFuncinstead of the upstream SDK's dot/colon stripping behavior.Problem
With
ByAzure: trueand a deployment name containing a dot (e.g.gpt-5.6-luna), the request silently targets a non-existent deployment because the upstream SDK's default mapper strips dots from the name. The 404 error gives no hint that the name was rewritten.The doc comment says it removes
[,:]but the SDK implementation removes[.:]— either way, silently transforming user-provided deployment names is surprising behavior for modern Azure Foundry deployments.Fix
func(model string) string { return model }) whenAzureModelMapperFuncis nil, so deployment names pass through unchanged.Users who rely on the legacy
gpt-3.5-turbo→gpt-35-turboconvention can explicitly set the mapper.Changes
libs/acl/openai/chat_model.go: Default to identity mapper + updated doc commentTesting
go build ./...passgo vet ./...pass (pre-existing test compat issue with Go 1.24t.Context()unrelated to this change)Related