Creating Pre-Prompting for OpenAI

The idea is to create a pre-prompt for ChatGPT and loop through a bunch of queries to classify a bunch of articles I have. Instead of creating a pre-prompt for each loop. Is there a way to set up N8N and OpenAI to loop through a number of requests with one pre-prompt?

Hi @rainmanjam ,
you could merge all the articles’ contents in a single array, add the whole array to the prompt, and then ask Open AI for the classification (explaining that the articles are in an array).

To merge all the articles into a single n8n item you could use the Items Lists node (Concatenate Items).

A couple of potential problems I see are:

  1. If the articles are very long you could reach the maximum number of allowed characters
  2. In the prompt, you should ask Open AI to provide the classification in an array (where each item corresponds to each provided article) which is a more complex task for Chat GPT and could produce some unwanted results.

By the way, you could give it a try and see if it works, let me know if you need more support

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.