Array/Collection into plain text

After an array aggregation in my scenario I have collection ? (array?) like this which I need in one simple text to pass on to OpenAI

Which simple function can I use? Just a simple long text string “From: User, concent: c, timestamp, …” how can I achive this. I tried flatten() even two times but it doesnt work. Documentation is also spotty on these transformations

[
{
“array”: [
{
“from”: “user”,
“content”:c",
“timestamp”: “2023-08-08T13:31:10.844Z”
},
{
“from”: “operator”,
“content”: “c”,
“timestamp”: “2023-08-08T13:36:59.366Z”
},
{
“from”: “operator”,
“content”: “c”,
“timestamp”: “2023-08-09T09:55:32.154Z”
},
{
“from”: “operator”,
“content”: {
“namespace”: “state:resolved”
},
“timestamp”: “2023-08-09T09:55:34.756Z”
},
{
“from”: “user”,
“content”: “c”,
“timestamp”: “2023-08-10T07:21:54.891Z”
}
],
IMTAGGLENGTH”: 5
}
]

I only want to call OpenAI once with all messages concatenated…

2 Likes

Hi @leotulipan

I think you need to aggregate the parameter into text. So please use Text aggregator with suitable separation(, or space) accordingly with your requirements.

image

This will result text data

MSquare Support
Visit us here
Youtube Channel

2 Likes

But how do you use this in what order. It is not clear to me. Sometimes I feel I’d rather make python code than to find out how these modules work

Doing this

yields:

“value”: “[Collection], [Collection]” as input and therefore as output as well. See the structure that comes out of the array module above…

Again, I fell I need to flatten or convert this multi-dimensional array, but I do not know how. This should be a built in function? Even outputting the above JSON like structure would be fine

1 Like

Hi

Simply use an iterator after your array aggregator and map the aggregator’s output to the iterator. Then you will get the operator, content and time stamp as mappable variables.

MSquare Support
Visit us here
Youtube Channel

2 Likes

I do not want separate bundles. I WANT ONE TEXT

  • Get message results
  • aggregate multiple messages into one element
  • MISSING: Get this output in some form of PLAIN TEXT to send over to OpenAI e.g. in the simple form “From: user On: Timestmap Content: 1; From …”

Using another iterator after the aggregator just splits up the elements again and would call OpenAI for each Bundle (in this case two times).

Ideally Make would be intelligent enough when I put the array element in the Message Content to turn this into plain text and not “[collection], [collection]”

BUT: A transform to JSON did the trick: That way I got ONE text output and this I can paste into OpenAI

3 Likes