Initial import
This commit is contained in:
14
llm/client.go
Normal file
14
llm/client.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package llm
|
||||
|
||||
import "github.com/sashabaranov/go-openai"
|
||||
|
||||
func NewClient(APIKey, URL string) *openai.Client {
|
||||
// Set up OpenAI client
|
||||
if APIKey == "" {
|
||||
//log.Fatal("OPENAI_API_KEY environment variable not set")
|
||||
APIKey = "sk-xxx"
|
||||
}
|
||||
config := openai.DefaultConfig(APIKey)
|
||||
config.BaseURL = URL
|
||||
return openai.NewClientWithConfig(config)
|
||||
}
|
||||
Reference in New Issue
Block a user