Update README.md
This commit is contained in:
36
README.md
36
README.md
@@ -24,18 +24,18 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
gogpt "github.com/sashabaranov/go-openai"
|
openai "github.com/sashabaranov/go-openai"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
client := gogpt.NewClient("your token")
|
client := openai.NewClient("your token")
|
||||||
resp, err := c.CreateChatCompletion(
|
resp, err := c.CreateChatCompletion(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
gogpt.ChatCompletionRequest{
|
openai.ChatCompletionRequest{
|
||||||
Model: gogpt.GPT3Dot5Turbo,
|
Model: openai.GPT3Dot5Turbo,
|
||||||
Messages: []gogpt.ChatCompletionMessage{
|
Messages: []openai.ChatCompletionMessage{
|
||||||
{
|
{
|
||||||
Role: "user",
|
Role: openai.ChatMessageRoleUser,
|
||||||
Content: "Hello!",
|
Content: "Hello!",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -64,15 +64,15 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
gogpt "github.com/sashabaranov/go-openai"
|
openai "github.com/sashabaranov/go-openai"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
c := gogpt.NewClient("your token")
|
c := openai.NewClient("your token")
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
req := gogpt.CompletionRequest{
|
req := openai.CompletionRequest{
|
||||||
Model: gogpt.GPT3Ada,
|
Model: openai.GPT3Ada,
|
||||||
MaxTokens: 5,
|
MaxTokens: 5,
|
||||||
Prompt: "Lorem ipsum",
|
Prompt: "Lorem ipsum",
|
||||||
}
|
}
|
||||||
@@ -96,15 +96,15 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
gogpt "github.com/sashabaranov/go-openai"
|
openai "github.com/sashabaranov/go-openai"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
c := gogpt.NewClient("your token")
|
c := openai.NewClient("your token")
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
req := gogpt.CompletionRequest{
|
req := openai.CompletionRequest{
|
||||||
Model: gogpt.GPT3Ada,
|
Model: openai.GPT3Ada,
|
||||||
MaxTokens: 5,
|
MaxTokens: 5,
|
||||||
Prompt: "Lorem ipsum",
|
Prompt: "Lorem ipsum",
|
||||||
Stream: true,
|
Stream: true,
|
||||||
@@ -146,15 +146,15 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
gogpt "github.com/sashabaranov/go-openai"
|
openai "github.com/sashabaranov/go-openai"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
c := gogpt.NewClient("your token")
|
c := openai.NewClient("your token")
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
req := gogpt.CompletionRequest{
|
req := openai.CompletionRequest{
|
||||||
Model: gogpt.GPT3Ada,
|
Model: openai.GPT3Ada,
|
||||||
MaxTokens: 5,
|
MaxTokens: 5,
|
||||||
Prompt: "Lorem ipsum",
|
Prompt: "Lorem ipsum",
|
||||||
Stream: true,
|
Stream: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user