JSON to create a string from all objects/collections from the Aggregator's output

I need my OpenAI module to read the news, and select top 3. I’m feeding it JSON that contains fields mapped to the array of those news. It reads only the first Collection in the array and therefore puts in a JSON string only info from 1 Collection.

How to have it combine the string from all collections?

More SS of settings:

Hi @katka2707

Instead of an Aggregator and Create JSON, use an Aggregate to JSON module. Create a structure with 3 fields of type text: title, url and summary. You can probably use the jsonlinked you created. Once it receives the result, it will output a json array with N collections containing these 3 fields. Instruct your prompt to receive the JSON array and iterate it.

@damato

@damato thank you for your attention to this :folded_hands: the struggle is real ))

i tried aggregate to JSON prior, pls take a look at screenshots - still gives me the string only from Collection 1

Remove the Aggregator altogether and use only the json aggregator. Map the fields directly from the RSS module (or Iterator, wherever your values come from).

thank you @damato for pointing me to the direct connection to openai module.

what happens now: i have multiple operations going on, while I need only one output from openai. I resolved that earlier with adding an aggregator after the RSS feed which allowed me to put everything in one bundle (=> one operation).

although, Aggregator to JSON produces now correct string per RSS feed TU

additionally here is my openai prompt:

how would combine all the strings now? aggregate text module and put that in openai?

thank you for your patience with me

UPDATE:

resolved both issues

Aggregate to JSON (instead of Iterator) worked to get one combined output.

Aggregate to JSON should source from the initial iterator; this way it produces only one operation.

Now that I’ve got my super long JSON string, I’m working on trimming it so openai can process it, as it currently stops due to length. :smiley:

3 Likes