This commit is contained in:
committed by
GitHub
parent
f0770cfe1d
commit
e49d771fff
10
error.go
10
error.go
@@ -3,6 +3,7 @@ package openai
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// APIError provides error information returned by the OpenAI API.
|
||||
@@ -41,7 +42,14 @@ func (e *APIError) UnmarshalJSON(data []byte) (err error) {
|
||||
|
||||
err = json.Unmarshal(rawMap["message"], &e.Message)
|
||||
if err != nil {
|
||||
return
|
||||
// If the parameter field of a function call is invalid as a JSON schema
|
||||
// refs: https://github.com/sashabaranov/go-openai/issues/381
|
||||
var messages []string
|
||||
err = json.Unmarshal(rawMap["message"], &messages)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
e.Message = strings.Join(messages, ", ")
|
||||
}
|
||||
|
||||
// optional fields for azure openai
|
||||
|
||||
Reference in New Issue
Block a user