readme example print error (#147)

This commit is contained in:
Qihang Hu
2023-03-11 15:32:39 +08:00
committed by GitHub
parent 9428f6cc3d
commit 6580bd7289

View File

@@ -45,6 +45,7 @@ func main() {
)
if err != nil {
fmt.Printf("ChatCompletion error: %v\n", err)
return
}
@@ -80,6 +81,7 @@ func main() {
}
resp, err := c.CreateCompletion(ctx, req)
if err != nil {
fmt.Printf("Completion error: %v\n", err)
return
}
fmt.Println(resp.Choices[0].Text)
@@ -113,6 +115,7 @@ func main() {
}
stream, err := c.CreateCompletionStream(ctx, req)
if err != nil {
fmt.Printf("CompletionStream error: %v\n", err)
return
}
defer stream.Close()