You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fabric/vendors/grocq/grocq.go

24 lines
499 B
Go

package grocq
import (
"github.com/danielmiessler/fabric/vendors/openai"
goopenai "github.com/sashabaranov/go-openai"
)
func NewClient() (ret *Client) {
ret = &Client{}
ret.Client = openai.NewClientCompatible("Grocq", ret.configure)
return
}
type Client struct {
*openai.Client
}
func (oi *Client) configure() (err error) {
config := goopenai.DefaultConfig(oi.ApiKey.Value)
config.BaseURL = "https://api.groq.com/openai/v1"
oi.ApiClient = goopenai.NewClientWithConfig(config)
return
}