Skip to content

Commit

Permalink
add btpopenai
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanxin committed Sep 29, 2023
1 parent 525e3a0 commit 79617d2
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions pkg/ai/btpopenai.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package ai
import (
"context"
"encoding/base64"
"errors"
"fmt"
"net/http"
"strings"
Expand All @@ -28,21 +27,6 @@ type BTPAIClient struct {
func (c *BTPAIClient) Configure(config IAIConfig, lang string) error {
token := config.GetPassword()
baseURL := config.GetBaseURL()
engine := config.GetEngine()
defaultConfig := openai.DefaultAzureConfig(token, baseURL)
defaultConfig.APIType = "SAP_API"
defaultConfig.AzureModelMapperFunc = func(model string) string {
// If you use a deployment name different from the model name, you can customize the AzureModelMapperFunc function
azureModelMapping := map[string]string{
model: engine,
}
return azureModelMapping[model]

}
client := openai.NewClientWithConfig(defaultConfig)
if client == nil {
return errors.New("error creating Azure OpenAI client")
}
c.language = lang
c.model = config.GetModel()
c.temperature = config.GetTemperature()
Expand Down

0 comments on commit 79617d2

Please sign in to comment.