Skip to content

Commit

Permalink
Fix apibase (#43)
Browse files Browse the repository at this point in the history
* 🐛 set `api_base=/v1` as default value

* 🐛 fix EndpointUrl=nil when `InitFromEnvironmentVariables`

* ✨ add notebook examples

* 💚 fix ci err, fmt for log.Fatalf
  • Loading branch information
warjiang committed Jun 16, 2023
1 parent 2f4a6e6 commit 857d7e0
Show file tree
Hide file tree
Showing 2 changed files with 240 additions and 0 deletions.
6 changes: 6 additions & 0 deletions azure/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func Init() error {
}

// ensure apiBase likes /v1
viper.SetDefault("api_base", "/v1")
apiBase := viper.GetString("api_base")
if !strings.HasPrefix(apiBase, "/") {
apiBase = "/" + apiBase
Expand Down Expand Up @@ -73,10 +74,15 @@ func InitFromEnvironmentVariables(apiVersion, endpoint, openaiModelMapper string
log.Fatalf("error parsing %s, invalid value %s", constant.ENV_AZURE_OPENAI_MODEL_MAPPER, pair)
}
modelName, deploymentName := info[0], info[1]
u, err := url.Parse(endpoint)
if err != nil {
log.Fatalf("parse endpoint error: %s", err.Error())
}
ModelDeploymentConfig[modelName] = DeploymentConfig{
DeploymentName: deploymentName,
ModelName: modelName,
Endpoint: endpoint,
EndpointUrl: u,
ApiKey: "",
ApiVersion: apiVersion,
}
Expand Down
Loading

0 comments on commit 857d7e0

Please sign in to comment.