Skip to content

Commit 5d7a276

Browse files
authored
Stop stripping dots in azure model mapper for models that aren't 3.5 based (#1079)
fixes #978 Signed-off-by: Christopher Petito <[email protected]>
1 parent 8e5611c commit 5d7a276

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

config.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package openai
33
import (
44
"net/http"
55
"regexp"
6+
"strings"
67
)
78

89
const (
@@ -70,7 +71,11 @@ func DefaultAzureConfig(apiKey, baseURL string) ClientConfig {
7071
APIType: APITypeAzure,
7172
APIVersion: "2023-05-15",
7273
AzureModelMapperFunc: func(model string) string {
73-
return regexp.MustCompile(`[.:]`).ReplaceAllString(model, "")
74+
// only 3.5 models have the "." stripped in their names
75+
if strings.Contains(model, "3.5") {
76+
return regexp.MustCompile(`[.:]`).ReplaceAllString(model, "")
77+
}
78+
return strings.ReplaceAll(model, ":", "")
7479
},
7580

7681
HTTPClient: &http.Client{},

config_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ func TestGetAzureDeploymentByModel(t *testing.T) {
2020
Model: "gpt-3.5-turbo-0301",
2121
Expect: "gpt-35-turbo-0301",
2222
},
23+
{
24+
Model: "gpt-4.1",
25+
Expect: "gpt-4.1",
26+
},
2327
{
2428
Model: "text-embedding-ada-002",
2529
Expect: "text-embedding-ada-002",

0 commit comments

Comments
 (0)