0

I have created a flow in Power Automated which calls AzureOpenAI Chat Playground through HTTP Post method

image

But if I run it, it says :

''[{"role":"user","content":"Who is mahatma gandhi?"}]' is not of type 'array' - 'messages''

image

How can I solve the issue?

Talha Tayyab
  • 8,111
  • 25
  • 27
  • 44
  • Have you tried removing the backslashes? It looks like you escaped the properties and values in the array. So it probably now thinks it is just one big string value. Try something like this in the first line of your body: `"message": [{"role":"user","content":"Who is mahatma ghandi?"}],` – Expiscornovus Apr 21 '23 at 09:12

1 Answers1

0

See REST API documentation, especially this operation: as stated in the error you got, the messages field must contains an array.

In your case, you passed a string (containing something looking like an array, but it's a string as you enclosed it in " quotes). You need to have a real JSON array.

So to fix it, in your Body field of the call, fix your messages field:

  • remove the quotes surrounding its content
  • remove the escaping characters before the quotes within this value
Nicolas R
  • 13,812
  • 2
  • 28
  • 57