Question

How do I pass responses between two GPT assistants and update Google Sheets from the third row in Zapier?


Badge

Hello Zapier Support Team,

I've been working on setting up a ZAP that involves interactions between two GPT-based assistants followed by updating a Google Sheet. However, I've encountered a couple of issues that I'm hoping to get assistance with.

First Issue: Reusing Answer from the First GPT Interaction in the Second Interaction

My workflow involves two separate interactions with GPT-based assistants. The first interaction generates an answer that I need to use as input for the second interaction. I'm having trouble figuring out how to pass the answer from the first GPT assistant to the second one within the same ZAP. Could you provide guidance or steps on how to set this up?

Specifically, I'm looking for how to:

  • Capture the response from the first GPT assistant effectively.
  • Pass that response as an input to the second GPT assistant.

Second Issue: Specifying Google Sheets Filling to Start from the Third Row

Additionally, I need to update a Google Sheet with data resulting from the interactions. However, I want the filling process to start from the third row of the sheet, leaving the first two rows for headers and other information. I'm unsure how to specify this within the ZAP configuration.
 

Could you provide instructions or a workaround that would allow me to achieve these outcomes?

Thank you in advance for your assistance. I'm looking forward to your expert advice to streamline my workflow and make the most out of your incredible tool.

Best Regards,
sKunZel

 

 


22 replies

Userlevel 7
Badge +11

Hi @sKunZel! 👋
 

For the First Issue:

Specifically, I'm looking for how to:

  • Capture the response from the first GPT assistant effectively.
  • Pass that response as an input to the second GPT assistant.

I’d have thought that for “Generating Lyrics” step, in the Message field you’d just need to select the Full Response field that’s output by the “Song name + Description” step. That should ensure that the response from the first OpenAI Assistant is passed over to the second OpenAI Assistant. 

Can you give that a try and let us know how you get on?

If you run into any issues on that can you share a screenshot showing the Action section of the “Generating Lyrics” step, showing what fields and settings have been selected? That will help us to better identify any potential issues on the setup there which might be causing issues. Please remove/hide any private information (like names, emails, addresses etc.) from any screenshots before sharing.

For the Second Issue:

With Google Sheets the spreadsheet needs to be setup up in a specific way with the first row only being used for the headers and subsequent rows being used to contain the relevant data for each row. See our Work with Google Sheets in Zaps guide for more details on this.

That said, the Zap should attempt to add data in to the next empty row that’s available, so if there’s already text in row 2 it should add the data into row 3 (assuming it’s empty) the first time it runs. Then it will add the next lot of data from ChatGPT into row 4 the next time it runs, and so on. Or is it more that you want it to always add data into the same row (row 3)? 

Looking forward to hearing from you on this!

Badge

Hello,

Ok, FullResponse is working! It was fill with an Error message but a ChatGPT one. Seems fixed!
Can I continue a conversation ? I want to process “Next” atleast 9 times with same base input but working iteratively. (and with a fill of each answer into a different row in my GoogleSheet)

Ok for the row. Indeed, i filled my first 2 lines with text.
Ah! I was using “Create Spreadsheet Row” instead of “Update” it. Working fine!
Can I specify the Column ?

Last question, is there any distinction between Manuel et ChatGPT in the Action of GoogleSheet interaction ? ChatGPT answers seems to not be written in the GoogleSheet.

For info : 

 

Badge

Hi,

I noticed a problem in my shared photo, i put the FullResponse of my first assistant GPT in the “Assistant Instructions” instead of putting it directly in the “Message section”.

But i’m encoutering some weird issue. Here’s the generic message i duplicate 9 times. 

“Generate lyrics for each song sequentially. Process each song one by one, ensuring that the specific characteristics and themes of each song are accurately reflected in the lyrics. You already process song starting with "1." & "2." & "3." & "4." & "5." & "6.". Process song 7. Identify it with the "7." preceding NameSong & Description
Here the data set : “Full Response: Output of first assistant”


Every test i made in the zap settings are working fine but when the zap executes, it only answer with the first song, ignoring or not identify the number of the song i’m expecting him to process. And again, outputs from test are correct...

Userlevel 7
Badge +11

Thanks for the update on this @sKunZel! 🙂 

Hmm, does the response from the first OpenAI Assistant contain multiple song ideas or does it generate a single song? 

If it only generates one song idea - then it’s correct that only one song would be processed by the second OpenAI Assistant.

If it generates a list of multiple song ideas - I’d recommend tweaking the instructions so to help make it a bit clearer what you want it to do. For example:
“Generate lyrics for each song idea contained the following list, based on the title and description - ensuring that the songs lyrics are generated for each song sequentially and the specific characteristics and themes of each song are accurately reflected in the lyrics. Song Ideas List: [Full Response: Output of first assistant]”

Check out this guide for tips on how to write more effective prompts here: How to write an effective GPT-3 or GPT-4 prompt

If that doesn’t work, it might be due to the response is being limited when testing in the the Zap editor. If you turn the Zap on and run a live test by triggering the Zap is it able to run through each of the songs and generate the lyrics for each accordingly?

Keen to ensure get this solved so please keep us updated on how you get on with this!

Badge

The first Assistant generated 10 song name + description. 

I don’t think there is any issue with my prompting for the song number ID since my zap settings are correctly identifying each song (Yeah i struggled a bit at first to elaborate this identifier but he seems to be working just fine[I also try it in chatGPT, reacting coherently]).

A possible option would be to multiply the number of occurencies with only 1 song at a time. I would be fine with that but i’m not sure how to trigger a ZAP multiple times a day …

Just to be clear, my test in the Zap Editor are working just fine. But the actual run of the Zap is struggling.

Userlevel 7
Badge +11

 Thanks for clarifying that @sKunZel.

Just to be clear, my test in the Zap Editor are working just fine. But the actual run of the Zap is struggling.

If it’s generating the song lyrics for all of the song ideas in the correct order when testing in the Zap editor but it’s not doing so when the Zap is switched on and running live it may be that you’re running into a bug.

Can you take a look in the Zap History for a recent run of the Zap that failed to generate lyrics for all the song ideas? And check the Data In and Data Out tabs for both ChatCPT actions to see what information was generated and sent. If you can share screenshots of that it would be super helpful to me in seeing where the breakdown occurred.
 

A possible option would be to multiply the number of occurencies with only 1 song at a time. I would be fine with that but i’m not sure how to trigger a ZAP multiple times a day …

Instead of triggering it multiple times you could try using a Looping by Zapier action to run the second ChatGPT individually for each song idea, you’d need to use a Formatter (Text > Split Text) action ahead of the loop to convert the song ideas into line items that it could process individually. You can learn more about how to loop actions here: Loop your Zap actions

Alternatively, perhaps you could split the workflow up into two Zaps to run it separately for each song idea that’s generated?

Zap 1 - generate the song ideas and add them into multiple new rows in Google Sheets

  • Trigger: Every Day (Schedule by Zapier)  triggers every day at the desired time.
  • Action: Conversation With Assistant (ChatGPT) - generates a list of song names and descriptions.
  • Action: Text > Split Text (Formatter) - converts the response from ChatGPT into line items that can be passed to Google Sheets to create multiple rows.
  • Action: Create Multiple Spreadsheet Rows (Google Sheets) - Takes the line items containing each song idea and adds the names and corresponding descriptions into separate rows in the spreadsheet.

 

Zap 2 - when a new row is added, generate the lyrics and add them to the relevant row

  • Trigger: New Spreadsheet Row (Google Sheets)  triggers when a new row is added to the spreadsheet.
  • Action: Conversation With Assistant (ChatGPT) - generates lyrics based on song names and descriptions.
  • Action: Update Spreadsheet Row (Google Sheets) - Takes the lyrics generated by ChatGPT and updates the relevant row in the spreadsheet.

 

Looking forward to hearing from you!

Badge

I will definitly check this Formatter option.

For the Data In&Out, check the image below.
 

 

Userlevel 7
Badge +11

Hi @sKunZel, thanks for sharing that screenshot!

It’s a little hard to tell whether the Full Response field contained all the 10 song ideas that should have been passed to the second ChatGPT action: 
95f7382d7c20f10c8c7b4f0d06c59c63.png

As there appears to be a 10th song idea listed in another area of the screenshot but there’s prompting instructions included there which I wouldn’t expect to see in the Full Response field:

99d16061dc6b71dcf6fe38442788ae10.png

Can you confirm when the Zap ran live, whether all 10 song ideas were definitely output by the first ChatGPT action or were they cut short? If it was cut short then that could well explain why the second ChatGPT action didn’t generate the lyrics for each song as expected.

And if you run into any issues on giving that Formatter action a try do let me know - happy to assist further! 🙂

Badge

Here’s the typology of my messages (There is indeed all song included in each prompt sent to the second assistant)

I’m not sure about my parameters for Formatter. Should I set it up like this but keep filling my GoogleSheets with the FullResponse of my second assistant ? (Or apply [in the GoogleSheets] the “Suno Song” Looped again)
 


Aniway, the division part of the Formatter tool is working fine, but i’m probably dealing with the same bug, since i can’t output every song as expected.

Userlevel 7
Badge +11

Great to hear from you on this, @sKunZel

The selected data set in the second ChatGPT action doesn’t look quite right, so the Formatter action likely hasn’t split the song details up quite right. I’ve just run a quick test in one of my own Zaps and was able to get the song ideas separated and passed into to the loops as follows:

This was the output from the first ChatGPT action:
b83c92c2f37676003aec6d2a9dc05008.png

I had two new lines separating the song ideas that were output by the first ChatGPT action so the Separator was set to [:newline:][:newline:] and the Segment Index was set to output them ALL (as line items):
7feda44a0651f67c787370a176ab243b.png

Next a Create Loop from Line Items action was used to create a “loop” for each song line item output by the Formatter action:
a6267f4b9d49a7bbdfa8784d2439d03f.png

PLEASE NOTE: When testing loop actions only the first loop item will be tested but when the Zap is switched on and all loop items will be run individually.

Then I referenced the individual song idea like so:
f76ba868f0216b90284c567a5588302f.png
For each loop run the value in that selected Songs field would change, so the first loop would run the first song, the next loop would run the second song etc.

As all the song details were contained within a single line and they need to be added into separate fields in Google Sheets I added another Formatter (Text > Extract Pattern) action to extract the number, name and description into separate fields. The pattern I used was:

(\d+)\.\s*Name:\s*(.+)\s*Description:\s*(.+)

But depending on how the song details are output on your setup you may need to tweak the pattern if it doesn’t work for you - let me know if you need any help with that.

And be sure to set the Match All field to Yes:
89cc5f332662e3ffab6f346eca18cdf1.png
That then allows each of the song ideas and lyrics to be selected individually:
bcf0e2a6d16bebe30ba258c4516f69bf.png
And added into a new row in Google Sheets:
f77c5e2235673cc037920a151393f071.png

Hope that helps. Can you give the above a try and let me know if you get stuck at all - happy to assist!

Badge

I used the Create Loop From Text since i have multiple lines in my lyrics for each songs.
 

And it seems to be just fine until i launch the Zap .. :(
Here the details of the differents parts well integrated.


For info : 

 

Badge

Oh, I found a new anomaly.
Now the looping Zap send a second answer, and only one, in the googlesheets that include the second song and description only without even processing the second assistant.

Userlevel 7
Badge +11

Sorry to hear that @sKunZel, let’s see if we can identify what’s causing that!

Hmm, looking at the output of the Looping action it appears that it’s not correctly splitting the songs into separate loops. It’s taking the number for the first song idea and seeing it as one loop, then taking the song name and description for the first song as the second loop, then using the song number of the second song idea for the third loop, then then taking the song name and description of the second song as the fourth loop and so on…

This is due to the song numbers and the descriptions both having full stops:

625f8b2f38b9b9c4dcd05c111c077bcf.png

So using a full stop (.) as the Text Delimiter isn’t going to work. Instead, can you try setting the Text Delimiter field to use a newline to split the song ideas up into separate loops, like so:
7fb1d7c1330e3091d87e52dce442c089.png

That should help to get each song idea correctly output put into a separate loop. 

Can you give that a try and let me know if that fixes it?

Oh, I found a new anomaly.
Now the looping Zap send a second answer, and only one, in the googlesheets that include the second song and description only without even processing the second assistant.

I wonder if this is related to the issue of the song ideas not being split correctly into the correct loops. Once you’ve tried the above suggestion of changing the Text Delimiter can you confirm whether this second issue is then also resolved?

Thanks, I’ll keep an eye out for your reply!

Badge

Hi,

It is working fine for the first iteration
Title: "Psychedelic Ballot"
Style: Conscious Hip Hop
Lyrics:

[INTRO]
Yo, this ain't just another ballot,
[Chorus]
Psychedelic ballot, voting for my dreams,
[Verse 1]
In the sociopolitical jungle, navigate the treacherous,
[Chorus]
Psychedelic ballot, casting conscious strikes,
[Verse 2]
Through McKenna's lens, peep the illusions of power,
[OUTRO]
So here's my psychedelic ballot, a conscious shot,


After the first iteration, every single line (splitting the lyrics) is added to the GoogleSheets, written over and over on same row (2nd one) :/

Userlevel 7
Badge +11

Glad to hear it’s working correctly for the first iteration, @sKunZel. 🙂

After the first iteration, every single line (splitting the lyrics) is added to the GoogleSheets, written over and over on same row (2nd one) :/

That’s odd, a Create Spreadsheet Row action shouldn’t be overwriting the exact same row when the Zap is running. With the lyrics it shouldn’t be splitting those out into separate rows.

Can you share a screenshot showing the setup of the Create Spreadsheet Row action that’s adding the song ideas and lyrics? It should look something like this:

4e31a2dd69f2a793821a3a1b68d8b767.png

Keen to get to the bottom of this so will keep an eye out for your response here!

Badge

And here are the details of the wrong iterations values with the [:newline:] delimiter : 

 

Loop Iteration

loop_iteration

1

Suno Song

SunoSong

1. "Prophetic Frequencies"

preview_loop_values

preview_loop_values

1

0

Preview Loop Values Loop Iteration

loop_iteration

1

Preview Loop Values Suno Song

SunoSong

1. "Prophetic Frequencies"

2

1

Preview Loop Values Loop Iteration

loop_iteration

2

Preview Loop Values Suno Song

SunoSong

Style: Conscious hip hop

3

2

Preview Loop Values Loop Iteration

loop_iteration

3

Preview Loop Values Suno Song

SunoSong

An audacious commentary on the non-linear nature of time, spotlighting how perceptions can manipulate our encounters with existence.

4

3

Preview Loop Values Loop Iteration

loop_iteration

4

Preview Loop Values Suno Song

SunoSong

5

4

loop_iteration

loop_iteration

5

SunoSong

SunoSong

2. "Quantum Government"

6

5

loop_iteration

loop_iteration

6

SunoSong

SunoSong

Style: Mystical rap

7

6

Preview Loop Values Loop Iteration

loop_iteration

7

Preview Loop Values Suno Song

SunoSong

Postulating democracy in a superposition, this track employs quantum mechanics metaphors to represent political volatility and manipulation.

8

7

Preview Loop Values Loop Iteration

loop_iteration

8

Preview Loop Values Suno Song

SunoSong

9

8

Preview Loop Values Loop Iteration

loop_iteration

9

Preview Loop Values Suno Song

SunoSong

3. "Machine Elves of State"

10

9

loop_iteration

loop_iteration

10

SunoSong

SunoSong

Style: Conscious hip hop

11

10

loop_iteration

loop_iteration

11

SunoSong

SunoSong

A surrealistic portrayal of governmental entities as proverbial 'machine elves', orchestrating societal dynamics from behind political dimensions.

12

11

loop_iteration

loop_iteration

12

SunoSong

SunoSong

13

12

loop_iteration

loop_iteration

13

SunoSong

SunoSong

4. "Shamanic Constitutions"

14

13

Preview Loop Values Loop Iteration

loop_iteration

14

Preview Loop Values Suno Song

SunoSong

Style: Psychedelia hip hop

15

14

loop_iteration

loop_iteration

15

SunoSong

SunoSong

A mystical exploration of sacred plant knowledge, criticizing the suppression of natural wisdom by political establishments.

16

15

loop_iteration

loop_iteration

16

SunoSong

SunoSong

17

16

loop_iteration

loop_iteration

17

SunoSong

SunoSong

5. "Stoned Ape Hypothesis"

18

17

loop_iteration

loop_iteration

18

SunoSong

SunoSong

Style: Mystical rap

19

18

loop_iteration

loop_iteration

19

SunoSong

SunoSong

A dazzling discourse on human evolution, challenging mainstream narratives and calling out humanity's disconnection from nature.

20

19

loop_iteration

loop_iteration

20

SunoSong

SunoSong

21

20

loop_iteration

loop_iteration

21

SunoSong

SunoSong

6. "Illusory Democracy"

22

21

loop_iteration

loop_iteration

22

SunoSong

SunoSong

Style: Conscious hip hop

23

22

loop_iteration

loop_iteration

23

SunoSong

SunoSong

Penetrating critique of capitalist norms, depicting democracy as McKenna's 'Archaic Revival', an illusion brew swallowed by mass populace.

24

23

Preview Loop Values Loop Iteration

loop_iteration

24

Preview Loop Values Suno Song

SunoSong

25

24

loop_iteration

loop_iteration

25

SunoSong

SunoSong

7. "Third Eye Politics"

26

25

loop_iteration

loop_iteration

26

SunoSong

SunoSong

Style: Psychedelia hip hop

27

26

loop_iteration

loop_iteration

27

SunoSong

SunoSong

An audacious exposition of interdimensional politics, advocating for the achievement of personal and societal enlightenment.

28

27

loop_iteration

loop_iteration

28

SunoSong

SunoSong

29

28

loop_iteration

loop_iteration

29

SunoSong

SunoSong

8. "Alien Legislation"

30

29

loop_iteration

loop_iteration

30

SunoSong

SunoSong

Style: Mystical rap

31

30

loop_iteration

loop_iteration

31

SunoSong

SunoSong

Alien laws as metaphoric references, exploring the concept of 'otherness' in socio-political structures and advocating for inclusive governance.

32

31

loop_iteration

loop_iteration

32

SunoSong

SunoSong

33

32

loop_iteration

loop_iteration

33

SunoSong

SunoSong

9. "Reality Rhetoric"

34

33

loop_iteration

loop_iteration

34

SunoSong

SunoSong

Style: Conscious hip hop

35

34

loop_iteration

loop_iteration

35

SunoSong

SunoSong

Confronts the conventional political discourse, using McKenna's philosophy of perceived reality as a reflective mirror.

36

35

loop_iteration

loop_iteration

36

SunoSong

SunoSong

37

36

Preview Loop Values Loop Iteration

loop_iteration

37

Userlevel 7
Badge +11

Thanks for sending over that screenshot, @sKunZel. Hmm, it looks like the song ideas (no. + name + description) still aren’t being split correctly. In your Create Loop from Text action can you try changing the Text Delimiter field to contain a period followed by a newline e.g. .[:newline:] 

For example:
6949abcc875678aca08269c5ee482717.png

Hopefully that should help to get the song ideas separated into the correct number of individual loops to they can then be added into Google Sheets correctly.

Can you give that a try and let me know whether that fixes it?

Badge

It better but not much quite it yet, not processing the second assistant after first song.

 

Userlevel 7
Badge +11

Sorry to hear that @sKunZel. Looking at the screenshot it seems that everything is being output into the same field in Google Sheets. 

Double-checking a past screenshot of your Google Sheets action, it appears that there’s only one column set up in the spreadsheet and it’s called TextGPT:

471128780ff3f8bfeb451d98a029bd81.png

If you want the song number, name, description and lyrics to be added into separate columns you’re going to need to set up additional column headers in the spreadsheet see: Work with Google Sheets in Zaps.

Then you’d need to split the song ideas information up so you can select them for the separate column fields in the Google Sheets action. I’d recommend giving that Formatter (Text > Extract Pattern) action I mentioned earlier here a try, as it should be able to extract all the different parts of information for the songs:

89cc5f332662e3ffab6f346eca18cdf1.png

And output them into separate fields which you can then select for the different columns, in the row that’s being created:

bcf0e2a6d16bebe30ba258c4516f69bf.png
That should allow the Zap to add the different songs into separate rows with all the information added into relevant columns:

13f830ca2a1e7022c21167249a1ebc4f.png

Hope that helps, please do keep us updated on how you get on! 

Badge

Hi, 
I don’t have thoses inputs possibilities : Number/Name/Description/Lyrics. (in fact, i just want Name & Lyrics)

I used (\d+\.)\s*SongName\s*:\s*(.+)\s*Lyrics\s*:\s*(.+) and my test shows nothing (might be problematic) :
 

 

Userlevel 7
Badge +11

Hi @sKunZel. The lyrics should already be separate from the song number, name and description since it’s generated by the second ChatGPT step. So you’d just need to extract the song name using that Formatter action.

To extract just the song name from the example in your screenshot you’d want to use a pattern that’s more like ^\d+\.\s*(.+) since your output from the ChatGPT step doesn’t appear to include “Name:” like it did on mine previously. You can learn more about using regex patterns to extract text here:


For example: 

c8c93adc4251dd62b3be0391a2b1cd4d.png

Should output just the song name:

dc3f052cc04eee7134a8887dd8114004.png

Please give that a try and let us know whether that fixes it? 🙂

Badge

I won my first badge thanks to you, thank you!

Sadly, only first song as output.

Reply