Creating a list of things from a GPT prompt

Hi there :slight_smile:
I want to create multiple things from a GPT output

simple example"

Say I have a input box that asks a user for a music artist, and they enter Elvis

ChatGPT then parses that input and outputs the three most popular songs in this exact format

Artist,song,year
Elvis,love me tender, 1965
Elvis,another one,1934
Elvis,yet another one,1969

I can get this far

I also have a database called “songs” with the fields artist, song and year

but in a workflow I want a step where bubble uses the output of a prior step (where the above csv text is created), and then uses it to create those three things in the “songs” table

I can output the songs, I can create a single thing containing the data in CSV format… but I can’t figure out how to create the three individual things from the one text output… but it feels like it’s logically possible…

There is a built in bubble action called “Upload Data as CSV”. I think that will help you for sure.

Thanks, I’ll take another look, I did give that a try, but it errored with an invalid url message, I assumed it was expecting a url for an actual hosted csv rather than being able to dynamically create a csv from the text output of the previous step?

On the text use “find and replace with regex and find \n replace with ;”. Then you can say “split by(;)”. Now you have a list of four items like this: [“Artist,song,year”, “Elvis,love me tender, 1965”, “Elvis,another one,1934”, “Elvis,yet another one,1969”]. Pass that list to a backend workflow and you can make key value pairs like artist: text, title: text, and year: number and split those items by using split by(,) and adding them to the database.

1 Like

Well I got to the list of four items, but im unclear on how to “make key value pairs like artist: text, title: text, and year: number and split those items by using split by(,) and adding them to the database.”

heheh, thanks for the help here :slight_smile: