Skip to content

Commit 857d7e0

Browse files
authored
Fix apibase (#43)
* 🐛 set `api_base=/v1` as default value * 🐛 fix EndpointUrl=nil when `InitFromEnvironmentVariables` * ✨ add notebook examples * 💚 fix ci err, fmt for log.Fatalf
1 parent 2f4a6e6 commit 857d7e0

File tree

2 files changed

+240
-0
lines changed

2 files changed

+240
-0
lines changed

azure/init.go

+6
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func Init() error {
4242
}
4343

4444
// ensure apiBase likes /v1
45+
viper.SetDefault("api_base", "/v1")
4546
apiBase := viper.GetString("api_base")
4647
if !strings.HasPrefix(apiBase, "/") {
4748
apiBase = "/" + apiBase
@@ -73,10 +74,15 @@ func InitFromEnvironmentVariables(apiVersion, endpoint, openaiModelMapper string
7374
log.Fatalf("error parsing %s, invalid value %s", constant.ENV_AZURE_OPENAI_MODEL_MAPPER, pair)
7475
}
7576
modelName, deploymentName := info[0], info[1]
77+
u, err := url.Parse(endpoint)
78+
if err != nil {
79+
log.Fatalf("parse endpoint error: %s", err.Error())
80+
}
7681
ModelDeploymentConfig[modelName] = DeploymentConfig{
7782
DeploymentName: deploymentName,
7883
ModelName: modelName,
7984
Endpoint: endpoint,
85+
EndpointUrl: u,
8086
ApiKey: "",
8187
ApiVersion: apiVersion,
8288
}

0 commit comments

Comments
 (0)