Initial import

This commit is contained in:
mudler
2024-01-20 19:41:09 +01:00
parent a1203c8f14
commit d22154e9be
9 changed files with 326 additions and 0 deletions

14
llm/client.go Normal file
View 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)
}