-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsession.go
31 lines (29 loc) · 1018 Bytes
/
session.go
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
package gopenai
import (
"github.com/wikylyu/gopenai/api"
"github.com/wikylyu/gopenai/audio"
"github.com/wikylyu/gopenai/chat"
"github.com/wikylyu/gopenai/completions"
"github.com/wikylyu/gopenai/edits"
"github.com/wikylyu/gopenai/embeddings"
"github.com/wikylyu/gopenai/files"
"github.com/wikylyu/gopenai/finetunes"
"github.com/wikylyu/gopenai/images"
"github.com/wikylyu/gopenai/models"
"github.com/wikylyu/gopenai/moderations"
)
func New(cfg *Config) *Session {
client := api.NewClient(cfg.BaseURL, cfg.ApiKey, cfg.MaxIdleConns, cfg.IdleConnTimeout, cfg.HttpsProxy)
return &Session{
Model: models.NewClient(client),
Completion: completions.NewClient(client),
Edit: edits.NewClient(client),
Image: images.NewClient(client),
Embedding: embeddings.NewClient(client),
File: files.NewClient(client),
FineTune: finetunes.NewClient(client),
Moderation: moderations.NewClient(client),
Chat: chat.NewClient(client),
Audio: audio.NewClient(client),
}
}