OPENAI API call - Invalid type for 'messages': expected an array of objects, but got a string instead.

Database & APIs

Hi everyone,

I am having an issue while experimenting with OPENAI API calls.

I have a JSON page parameter that I populate dynamically via a custom code launched from a button.

Then, I use its content for the API call but I get the following error.

{error: {message: Invalid type for 'messages': expected an array of objects, but got a string instead., type: invalid_request_error, param: messages, code: invalid_type}}

For some reason, the JSON variable is taken as String even though I defined it as JSON type page parameter levels.

Any suggestion of what I might be doing wrong?

Many thanks in advance.

What have you tried so far?

I double-checked that the variable is JSON type at page parameter level.

Also, I manually copied and pasted its value directly to the API test and response page, and the call worked fine.

Did you check FlutterFlow's Documentation for this topic?
Yes
1 reply