Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package openai
import (
"net/http"
"regexp"
"strings"
)

const (
Expand Down Expand Up @@ -70,7 +71,11 @@ func DefaultAzureConfig(apiKey, baseURL string) ClientConfig {
APIType: APITypeAzure,
APIVersion: "2023-05-15",
AzureModelMapperFunc: func(model string) string {
return regexp.MustCompile(`[.:]`).ReplaceAllString(model, "")
// only 3.5 models have the "." stripped in their names
if strings.Contains(model, "3.5") {
return regexp.MustCompile(`[.:]`).ReplaceAllString(model, "")
}
return strings.ReplaceAll(model, ":", "")
},

HTTPClient: &http.Client{},
Expand Down
4 changes: 4 additions & 0 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ func TestGetAzureDeploymentByModel(t *testing.T) {
Model: "gpt-3.5-turbo-0301",
Expect: "gpt-35-turbo-0301",
},
{
Model: "gpt-4.1",
Expect: "gpt-4.1",
},
{
Model: "text-embedding-ada-002",
Expect: "text-embedding-ada-002",
Expand Down
Loading