GPT api: sometimes this works, sometimes it doesn't

I am trying to create a chat app using the openai chat api.

I have the conversation “seed” loaded upon page load and then i’m trying to have the api answer the first question.

here are my steps in order: (I skipped step 5 b/c it just clears inputs.)

The error I get about half the time is a JSON parsing error.

Any help here appreciated. I’ve been at this for 2 days.

here are the data typesL

I’d do a couple of things:

  1. Make sure to explicitly put a comma between the JSONs in the list. This can be done via :formatted as text on the list of Jsons.
  2. find&replace on dynamic parts of the JSONs to remove problematic characters like " { } [ ] ` ’ and line spaces
  3. Then run the WF a Step-by-Step via the Inspector to analyse exactly what content is being generated - this will help you get to the bottom if it very quickly