blob: 11d691f85ac479b4a25fa6cc48cd3ffbd010b9f8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package openai
import (
_ "embed"
"github.com/sashabaranov/go-openai"
)
//go:embed system.txt
var defaultSystemMsg string
const defaultModel = openai.GPT4o
const defaultTemperature = 0.25
type Option func(*Analyzer)
func WithClientConfig(cfg openai.ClientConfig) Option {
return func(a *Analyzer) {
a.client = openai.NewClientWithConfig(cfg)
}
}
func WithDefaultConfig(apiKey string) Option {
return func(a *Analyzer) {
a.client = openai.NewClient(apiKey)
}
}
func WithModel(model string) Option {
return func(a *Analyzer) {
a.model = model
}
}
func WithSystemMsg(msg string) Option {
return func(a *Analyzer) {
a.systemMsg = msg
}
}
func WithTemperature(temp float32) Option {
return func(a *Analyzer) {
a.temperature = temp
}
}
|