How would you get all values from specified elements without using iterator?

Hi, I’m trying to make a scenario that gets audio transcript data from Google Cloud Speech to Text API, then send to OpenAI for summary.

The problem I have is that Google Cloud Speech result is returned like this.

I need to concatenate all values in “transcript” into one variable in one shot, so I can effectively send the transcribed data to OpenAI. The number of items in the array (numbered 1-50 etc) can change. If you were me, how would you approach this?

Why I need to do this in one shot: In a straightforward approach, I could iterate through all of these items to concatenate one by one into a variable, but that would spend too many operations. This would result in spending the Make operation quota too much to the point that it wouldn’t make sense for us to utilize Make.

I tried using the get(), map() functions but no luck so far. If you can give any insights/advice, I’d appreciate so much.

Thanks!

1 Like

maybe you can try to use text aggregator?

5 Likes

Hi thanks for your reply. Would you mind to explain more details?

I could set up a text aggregator like this, but this only pulls the very first “transcript” value, and the rest are ignored.

Maybe you can use get and map together with the text aggregator.
In the “text” - try to use a name and basically pull the entire “transcript” and separate them with a comma.

3 Likes

Hi @rikuto_MM ,

You should look at these courses in Make Academy:

You could also add an example of output bundle, it may help the community for some tests.

2 Likes

Itay_Zerem and Philippe_Billet,

Thank you for your response! Will give it a try and see how it goes.

1 Like

You do not need any Iterator or Text Aggregator modules.

1. Get all the values into an array

You can use the built-in function map to get all the transcript values.

e.g.:

{{ map(2.results; "alternatives.1.transcript") }}

2. Join them all with a newline

You can use the built-in function join to join all the values.

e.g.:

{{ join(map(2.results; "alternatives.1.transcript"); newline) }}

3. Insert into the OpenAI prompt

You can simply use the above directly into the OpenAI prompt (Message Content) field:

Links

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

General

Help Center Basics

Articles & Videos

3 Likes

samliew, thank you so much, that worked like magic!! Wow. Thank you for providing me with helpful links as well.

2 Likes

No problem, glad I could help!

Like I mentioned above, you can save one operation by mapping directly into the OpenAI module, and remove the Set variable module. This is just a personal preference though, and we should aim to use as fewer operations as possible because we are “billed” by the operations!

1. If you have a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.

2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.

This marks the topic as solved, so that:

others can save time when catching up with the latest activity here, and

  • allows others to quickly jump to the solution if they come across the same problem

To do this, simply click the checkbox at the bottom of the post that answers your question:
Screenshot_2023-10-04_161049

3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!

2 Likes