Skip to content

fix: use identity mapper as default for AzureModelMapperFunc - #957

Open
lxcxjxhx wants to merge 1 commit into
cloudwego:mainfrom
lxcxjxhx:fix/939-azure-default-identity-mapper
Open

fix: use identity mapper as default for AzureModelMapperFunc#957
lxcxjxhx wants to merge 1 commit into
cloudwego:mainfrom
lxcxjxhx:fix/939-azure-default-identity-mapper

Conversation

@lxcxjxhx

Copy link
Copy Markdown

Description

Use an identity function as the default for AzureModelMapperFunc instead of the upstream SDK's dot/colon stripping behavior.

Problem

With ByAzure: true and 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

  1. Set a default identity mapper (func(model string) string { return model }) when AzureModelMapperFunc is nil, so deployment names pass through unchanged.
  2. Update the doc comment to reflect the actual default and explain the historical context.

Users who rely on the legacy gpt-3.5-turbogpt-35-turbo convention can explicitly set the mapper.

Changes

  • libs/acl/openai/chat_model.go: Default to identity mapper + updated doc comment

Testing

  • go build ./... pass
  • go vet ./... pass (pre-existing test compat issue with Go 1.24 t.Context() unrelated to this change)

Related

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Azure: default AzureModelMapperFunc strips dots from the deployment name, docs say it strips commas

1 participant