I am taking in the response com gpt3.5turbo:
The starting prompt to create the 12 Steps is this one here:
Generate a table of contents, the article title is "How to find friends as an introvert".
Add at the beginning of each step "Step 1: ", "Step 2: ", etc.
The first point is always "Introduction" and the last point is always "Conclusion", make sure these 2 steps also include "Step" at the beginning.
Do not write "Table of Contents:" at the beginning.
and using this js code to get the total number of steps openai came up with to use it for the iteration of loops.
const responseText = items[0].json.text;
// Extract the last number from each step
const regex = /Step (\d+)/g;
let match;
let lastNumber;
while ((match = regex.exec(responseText)) !== null) {
lastNumber = parseInt(match[1], 10);
}
return [
{
response: lastNumber
}
];
In this case the response is 12
And i want to use this integer to loop the chat completion 12x with this simple user prompt:
Write about step {{ $node.Code1.json.response }}
I am trying to accomplish this somehow but i don’t know what to do as I am not a developer, all the things seen here are just me coming up with an idea how to do this.
The next step would be to append the response to html and save it.
In the end, a nice 3000 words article should come together.