Running ChatGPT in a repeater and collating all Outcomes

Hi everyone, I am new to make (not by duration, but by experience) and forgive me in advance if something I ask is stupid. Here’s what I am doing:

  1. I am trying to automate generation of blog content and am using chatgpt to generate and airtable to save.
  2. First I create the outline.
  3. Because I want ChatGPT to generate text for each of the sections in the outline, I am getting a section count (feeding the outline output to another chatgpt to count).
  4. Then I am generating keywords for the topic (this is not important to this question)
  5. Then I am running the repeater from 1 to {section count}
  6. Then I am calling ChatGPT again and telling it to write 500 words on the section. This image should explain better:

(okay, I couldn’t upload image because of some error, so here’s the prompt text)

“I want you to write on this topic: {{36.Question-Topic}} based on this research text: {{3.Research Agent Text}}, using this outline: {{55.choices.message.content}}.
There are {{71.choices.message.content}} sections as per the outline. And I want you to work on only section {{90.i}} and nothing else. I want 500 words for the section.
0.1. Use the same titles…”

And this is where I am stuck. Because it runs in a loop because of the repeater, I get more than 1 outcome. And I don’t know how to get the output of each into Airtable.

Here’s what I have tried.
I used “Set variable” to capture the output from every run and then “text aggregator” (with {{103.sectiontext}}{{newline}}} - where ‘103. sectiontext’ is the variable that is taking the chatgpt content for the current run and {newline} just to separate out the text from the next section)

I finished the repeater by filtering i >= sectioncount, and then am trying to access the aggregator’s text, but I am onl getting the last bit to pass on to airtable.

I thought of using arrays and I tried reading through documentation and youtube videos on the topic, but all those examples are about outputs that come as an array.

I had also tried splitting the outline (using text parser to search for “—head sep—” in the outline text output from ChatGPT. It separated them in bundles, but I don’t know how to convert them into the array because the examples are a bit confusing.

I wish I could upload images to show what I had done and am doing, and apologize for the lengthy text.


PS: There are YT videos that do this in serially (have a daisy chain of chatgpt prompts working on each section, but I don’t think that’s an efficient way of doing things, especially when you can use repeater loops. Just mentioning because that’s my fallback option and I really don’t want to do that.

Hi !

I faced the same issue.
When I generate the outline in my chatgpt module. I asked the output to be in HTML table format.
And get all the headlines in in the output.
Then I use a text parser “Get content from HTML Table” who will parse each headline GPT has created.

Then you can use an iterator → Chat GPT - > text aggregator to create a loop and ask the chatgpt module to write the content you’d like. It will aply the prompt for headline splitted.

Hope it will help you.

1 Like