mirror of
https://github.com/stulzq/azure-openai-proxy.git
synced 2025-12-19 15:24:24 +01:00
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
This commit is contained in:
@@ -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
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
234
examples/simple-langchain-examples.ipynb
Normal file
234
examples/simple-langchain-examples.ipynb
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user