Transform response open ai

Hello everyone,

I am building a scenario using the OpenAI API. This scenario begins with a “Search Rows” operation on a Google Sheets sheet, which retrieves the name of a company. Then, from this list of companies, I created a prompt that gives me the information I need, namely the website URL, the market, the industry, and the value proposition.

I have a problem with the output format of this information. Even though the output icon shows an Array format, the data I receive is still in text form, and all the information is pasted together. I tried using the “Iterator” module to split this information, but it is still returned as text.

My goal is to turn this information into separate variables that can then be mapped into my Google Sheets. Specifically, I want to use these variables in an “Add Rows” module to add this information to my sheet.

Thank you in advance for your answers

History-Make

Hi @diaby_niang,

I think you can change the prompt to return the result from ChatGPT as a JSON, which you can then pass to the ParseJSON module to pick the desired values.

Something like this, perhaps?

2 Likes

Thanks for the share !

It can be really easy by using the split function with new line.

Watch this: Quick Solution for Output Segregation | Loom

Just try that and you will see the entire output will be splitted under separate values.

{{split(7.var; newline)}}

2 Likes