Use the streamed response API
This commit is contained in:
6
main.go
6
main.go
@@ -107,13 +107,13 @@ var newCmd = &cobra.Command{
|
||||
},
|
||||
}
|
||||
|
||||
response, err := CreateChatCompletion("You are a helpful assistant.", messages)
|
||||
err = CreateChatCompletionStream("You are a helpful assistant.", messages, os.Stdout)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error getting chat response: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "An error occured: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
fmt.Println(response);
|
||||
fmt.Println()
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user