-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
34 lines (28 loc) · 835 Bytes
/
main.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
32
33
34
package main
import (
"context"
"fmt"
otiai10 "github.com/otiai10/openaigo"
sashabaranov "github.com/sashabaranov/go-openai"
"github.com/emikhalev/chatgpt-golang-examples/utils"
)
func main() {
ctx := context.Background()
apiKey := utils.APIKey()
{ // otiai10
client := otiai10.NewClient(apiKey)
moderation, err := client.CreateModeration(ctx, otiai10.ModerationCreateRequestBody{
Input: "I want to kill them.",
})
fmt.Printf("otiai10 CreateModeration: %v \n (err: %+v)\n\n",
utils.SPrintStruct(moderation), err)
}
{ // sashabaranov
client := sashabaranov.NewClient(apiKey)
moderation, err := client.Moderations(ctx, sashabaranov.ModerationRequest{
Input: "I want to kill them.",
})
fmt.Printf("sashabaranov CreateModeration: %v \n (err: %+v)\n\n",
utils.SPrintStruct(moderation), err)
}
}