fr
This commit is contained in:
@@ -19,6 +19,7 @@ func NewClient(token string) *Client {
|
||||
}
|
||||
|
||||
func (c Client) ChatCompletions(prompt string) (*CompletionResponse, error) {
|
||||
fmt.Println("using prompt: ", prompt)
|
||||
body := &ChatCompletionPayload{
|
||||
Model: "gpt-3.5-turbo",
|
||||
Prompt: prompt,
|
||||
@@ -40,6 +41,14 @@ func (c Client) ChatCompletions(prompt string) (*CompletionResponse, error) {
|
||||
return nil, fmt.Errorf("failed to query openai. Error: %s", err.Error())
|
||||
}
|
||||
|
||||
var test interface{}
|
||||
if err := json.Unmarshal(res.Body(), &test); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse the openai test response. Error: %s", err.Error())
|
||||
}
|
||||
fmt.Println()
|
||||
fmt.Println("inteface: ", test)
|
||||
fmt.Println()
|
||||
|
||||
var r CompletionResponse
|
||||
if err := json.Unmarshal(res.Body(), &r); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse the openai response. Error: %s", err.Error())
|
||||
|
||||
Reference in New Issue
Block a user