# Prevent repeats in ChatGPT results

**URL:** https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994
**Category:** Ask for Help
**Created:** [July 17, 2023, 5:12am UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994 "2023-07-17T05:12:45Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![Dan76](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dan76/32/15696_2.png) [@Dan76](https://community.glideapps.com/u/Dan76)
#### Post date: [July 17, 2023, 5:12am UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/1 "2023-07-17T05:12:45Z")

</div>

Hey all

I’ve been using the Open AI integration to produce spelling lists, story prompts, maths questions and a bunch of other things. Really happy with how easy it’s been to set up and can see so much potential. The only issue is that it keeps repeating the same results, e.g. half of the spelling words from the first list are repeated when the action is run again.

I have tried a few things to solve the problem:

1. Build the message prompt from a template that includes the previous answer and tell ChatGPT not to include anything from there. This was never going to work of course because it only stops repeats on the next run. After the next run it goes back to repeating items from the first list.

2. Include an ‘Add Row’ action that writes the results to an archive table and relate that back to the message template. This works fairly well but I’d rather not write a row every time the action is used (I anticipate the action being used a lot if it’s ever set up properly).

3. I tried the ‘Message ChatGPT with History’ action, but this didn’t change anything - could this work if set up correctly? I’m not sure how to leverage the history part or what it’s even supposed to do. Could it be used to prevent repeats?

---

<div class="post-metadata">

### Author: ![JackVaughan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jackvaughan/32/49023_2.png) [@JackVaughan](https://community.glideapps.com/u/JackVaughan)
#### Post date: [July 17, 2023, 8:04am UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/2 "2023-07-17T08:04:39Z")

</div>

This shouldn’t happen. Have you tried this in ChatGPT itself? I often find playing around there with my prompts helps me tweak it for use in Glide.

Not sure of your setup, but have you tried encouraging ChatGPT to take into account a history of what its suggested before?

---

<div class="post-metadata">

### Author: ![Dan76](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dan76/32/15696_2.png) [@Dan76](https://community.glideapps.com/u/Dan76)
#### Post date: [July 17, 2023, 9:01am UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/3 "2023-07-17T09:01:35Z")

</div>

Hi, thanks for your reply. Yes, before I set it up in Glide I tested it directly and it worked after a couple of messages to tell it what I needed.

Inside Glide I’m using a button so the prompt needs to be honed in such a way that it works the first time (which is why testing first helps). But I’m trying to understand - if the action is ‘Send Message to ChatGPT _without_ History’ - does the bot treat each request as new and cannot take into account what it’s given me previously?

I used both types of action (with history and without history) but it doesn’t make any difference.

I’m sure it’s an error in my set up as I kinda jumped in excitedly without knowing best practice. If I ask ChatGPT not to repeat words it has given in previous lists, do I add that to the prompt or the message? I’ve tried both.

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/4/b42842ad564ce86e703a2286626e166374a6701e.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/5/454550a9a933c33ae8a0fe84ac9c526dd59951e4.png)

I also wonder if it’s something to do with how I set up the columns for the ‘Send Message with History’ action - is this correct?

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/d/6ded37f0854044f3a076d87341028c83a5ad229b.png)

---

<div class="post-metadata">

### Author: ![AyS\_0908](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ays_0908/32/27349_2.png) [@AyS\_0908](https://community.glideapps.com/u/AyS_0908)
#### Post date: [July 17, 2023, 9:11am UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/4 "2023-07-17T09:11:44Z")

</div>

Hi, I don’t know if it answers directly to your question, but to prevent an action to re-run Gpt, what I did in my custom action is to create two columns to deal with the Gpt result:

- column 1: run the Gpt api
- wait for condition: “column 1” is not empty
- column 2: set column value with “column 1”.

Then the component that I display is based on “column 2”.

Hope this helps

---

<div class="post-metadata">

### Author: ![Dan76](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dan76/32/15696_2.png) [@Dan76](https://community.glideapps.com/u/Dan76)
#### Post date: [July 17, 2023, 9:36am UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/5 "2023-07-17T09:36:29Z")

</div>

I think it’s running a new action each time. Maybe it just isn’t very good at not repeating word lists, at least for very basic 3-4 letter words. I just went back and properly tested inside ChatGPT. When I tested last night I asked for words that would suit an 11 year old and it did a pretty good job but that might be due to the fact it pulls from a larger range of words for that age group. I gets stuck when I set it to junior words (6 year olds) repeating cat, dog, pig nearly every time.

---

<div class="post-metadata">

### Author: ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)
#### Post date: [July 17, 2023, 11:54am UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/6 "2023-07-17T11:54:39Z")

</div>

> [@Dan76](#):
>
> I used both types of action (with history and without history) but it doesn’t make any difference.

Have you tried adjusting the temperature and frequency penalty to make results more deterministic? It may help.

---

<div class="post-metadata">

### Author: ![Dan76](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dan76/32/15696_2.png) [@Dan76](https://community.glideapps.com/u/Dan76)
#### Post date: [July 17, 2023, 11:58am UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/7 "2023-07-17T11:58:39Z")

</div>

Yeah I had a few tries at various settings. The only thing I found was that when I set it to the extreme end it returned completely jumbled text. I’ll fiddle a bit more and see if it helps

---

<div class="post-metadata">

### Author: ![Dan76](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dan76/32/15696_2.png) [@Dan76](https://community.glideapps.com/u/Dan76)
#### Post date: [July 17, 2023, 12:06pm UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/8 "2023-07-17T12:06:46Z")

</div>

I’m unsure how to set up the action for Message ChatGPT with History - it asks that I set the columns for message history, so I select the ones that I’ve already set up:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/4/149cad094aacbce6410caebdae2a87d03288171e.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/1/71206ef939171d2fc378baa35653a1a65608335e.png)

Do I leave it there, or do I have to add an action that writes to those columns? It’s a bit unclear reading the tool tips on what exactly I’m supposed to do.

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/9/697151992394c2a002c897aef61e156f0cf5be2a.png)

---

<div class="post-metadata">

### Author: ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)
#### Post date: [July 17, 2023, 12:12pm UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/9 "2023-07-17T12:12:36Z")

</div>

> [@Dan76](#):
>
> Do I leave it there, or do I have to add an action that writes to those columns?

You should add a new row to that table… looks like you are using the user profile tab… you’ll want a new dedicated table for this… for GPT with History

---

<div class="post-metadata">

### Author: ![Dan76](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dan76/32/15696_2.png) [@Dan76](https://community.glideapps.com/u/Dan76)
#### Post date: [July 17, 2023, 12:22pm UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/10 "2023-07-17T12:22:47Z")

</div>

Now that you say it, it seems obvious - adding a row with a user ID so it can reference previous entries. It’s instantly made a difference. There are still a few repeats but it’s vastly improved. I guess the only problem is that this is what I tried in the original post and was hoping to avoid - adding a row with each run. I had it set up without history but it would reference an archive and avoid those entries

---

<div class="post-metadata">

### Author: ![Dan76](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dan76/32/15696_2.png) [@Dan76](https://community.glideapps.com/u/Dan76)
#### Post date: [July 17, 2023, 12:26pm UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/11 "2023-07-17T12:26:55Z")

</div>

I suppose it’s unrealistic to expect it to not repeat without adding rows otherwise it has no idea what to avoid. Wishful thinking on my part that there might be a way around it.

---

<div class="post-metadata">

### Author: ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)
#### Post date: [July 17, 2023, 12:27pm UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/12 "2023-07-17T12:27:24Z")

</div>

> [@Dan76](#):
>
> I guess the only problem is that this is what I tried in the original post and was hoping to avoid - adding a row with each run.

Ya the most straight forward way is to just add rows to a table. I’m working on a Chat Bot with history I could share when I’m finished 😉

---

<div class="post-metadata">

### Author: ![Dan76](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dan76/32/15696_2.png) [@Dan76](https://community.glideapps.com/u/Dan76)
#### Post date: [July 17, 2023, 12:28pm UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/13 "2023-07-17T12:28:35Z")

</div>

Yep true, it’s easy enough to wipe the rows every couple of weeks anyway

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [July 17, 2023, 12:45pm UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/14 "2023-07-17T12:45:07Z")

</div>

There is a way to do this without ever having to clear or delete any rows, as long as you can stick with a fixed number of rows - enough to cater for a single user session.

You just need a variation of Jeff Hager’s multirow reset technique. It would work as follows:

- At the start of a session, set a Unique Identifier in a User Specific column in the first row
- Use a Single Value column to apply that value to all rows
- Each time you get a response from the AI, write it into another user specific column
- At the same time use a Set Column values action to set the value in a 3rd User Specific column to be the same as the Single Value column.
- Lastly, use an if-then-else column to determine which rows should count - only those where the two unique identifiers are a match

The only tricky part is moving down the table as you get each new response. But you can do that by using the same values to determine the “next available row”, build a single relation to that row, and then write values through that relation.

When you’re done, you can reset the whole table by simply setting a new unique identifier in the first user specific column.

---

<div class="post-metadata">

### Author: ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)
#### Post date: [July 17, 2023, 1:02pm UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/15 "2023-07-17T13:02:42Z")

</div>

> [@Darren\_Murphy](#):
>
> The only tricky part is moving down the table as you get each new response.

How about saving the current chat and loading previous ones? I was thinking about storing each column of unique chats in a comma separated list or JSON and then exploding them with the miracle method… then use the helper table as the source for GPT with history.

What do you think?

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [July 17, 2023, 1:11pm UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/16 "2023-07-17T13:11:08Z")

</div>

Yeah, that could work.

---

<div class="post-metadata">

### Author: ![Dan76](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dan76/32/15696_2.png) [@Dan76](https://community.glideapps.com/u/Dan76)
#### Post date: [July 17, 2023, 1:12pm UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/17 "2023-07-17T13:12:02Z")

</div>

When you say have enough rows to cater for a single user session - can I cater for 20 or more users at once?

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [July 17, 2023, 1:13pm UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/18 "2023-07-17T13:13:01Z")

</div>

Because everything is user specific, you can cater for as many users at once as you can throw at it - all using the same set of rows.

---

<div class="post-metadata">

### Author: ![Dan76](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dan76/32/15696_2.png) [@Dan76](https://community.glideapps.com/u/Dan76)
#### Post date: [July 17, 2023, 1:13pm UTC](https://community.glideapps.com/t/prevent-repeats-in-chatgpt-results/63994/19 "2023-07-17T13:13:26Z")

</div>

ok wow, I’ll def have a go at setting that up
