When calling the ChatGPT api endpoint using the External API Request, no matter how I enter the parameters/set up my function, I keep getting this error:
Exception:Â xano extension xs Strings::xano extension xs {closure}(): Return value must be of type string, array returned
I import this curl as the template:
curl https://api.openai.com/v1/chat/completions -H 'Content-Type: application/json' -H 'Authorization: Bearer $OPENAI_API_KEY' -d '{
'model': 'gpt-3.5-turbo-16k-0613',
'messages': [
{
'role': 'system',
'content': 'You are a helpful assistant.'
},
{
'role': 'user',
'content': 'Hello!'
}
]
}'
I have tried debugging statements before and after the function, the error occurs sometime during the execution of the External API Request. I used Postman to check the curl command, and everything worked just fine. I tried using this curl command identical to the way it's posted now (with a replaced env variable for the OpenAI API key), but still the same error. The strangest part is, there are other functions in my workspace that call OpenAI Chat Completion endpoint, and work just fine, returning the appropriate response. I've tried copying the working API call from those functions identically, I've tried recreating this function in a new function, deleting the original and remaking it. Is this some kind of error within Xano itself, outside of my ability to fix?
How can I resolve this error?
5 replies