GroupChatGPT
What happens when you make an AI talk to itself? Waterstons Innovation: The Dots #8
Usually, in a “conversation” with ChatGPT at least one person involved has to be human. However, what happens when ChatGPT talks to another instance of ChatGPT, one with its own distinct “personality” and “goals”? This week, Alex has been making something to investigate just this. What happens when you make a group chat full of AI?
What is this? This is The Dots, our newsletter about exciting things we find in the world of innovation. We imagine innovation as connecting the dots; putting together a jigsaw. Our puzzle pieces are the pieces of interesting information we absorb in the world, our partners and their products. Innovation happens when we connect these pieces in new and interesting ways. This newsletter is about these dots we find and connect.
Creating GroupChatGPT
I’ve (Alex) been playing with the Open AI API recently. The API is just a way of using ChatGPT from within another program instead of simply through the web interface. It means you can get a little more fine control over the things you’re asking it to do for you.
Usually, when you use ChatGPT through the web it’s like you’re having a conversation with a helpful virtual assistant; you ask it to do things for you and it does them. You request information and it provides you with a (possibly) correct answer. You can get a bit fancier and get it to pretend to be things that it isn’t in order to have a bit more fun, but you’re limited to that back-and-forth conversation between you and the computer.
It turns out, however, that with a bit of tinkering and a bit of code, you can do some pretty fun things including getting ChatGPT to have conversations with itself. I’m going to try to keep this explanation clear and simple because there is some really interesting stuff to explore whether you’re a technical expert or not.
So buckle in and let’s explore how you get ChatGPT to have a conversation with itself...
Step 1: Conversations
The first thing to understand is that ChatGPT doesn’t really remember anything. When you are having a conversation with it through its chat interface there are some clever shenanigans going on in the background that are sending your whole conversation up to this point through every single time to make a request. ChatGPT then parses the whole conversation again and comes up with a new response. When we use the API we have to manually tell it what has happened before or each time we ask a question it has completely forgotten the context. This sounds like a hassle but we can use that by manipulating the conversation history to our advantage!
Step 2: Characters
The second thing you need to know is that when we ask ChatGPT a question we can provide a lot of additional contextual information alongside our statement. Not only can we put the conversation history into that context we can also tell ChatGPT to pretend to be someone.
Armed with these two pieces of information I got ChatGPT to start having conversations with itself. I created two characters that I named and then briefly described. And then I simulated a conversation by asking ChatGPT to pretend to be each character and to continue the conversation.
So when my character called Andrew is ready to say something, the prompt we send looks like this:
You are Andrew. You are an extremely enthusiastic innovation consultant from Shetland. You love to rap sometimes. You really, really love Warhammer. You have a lot of hair. You are creative and thoughtful and inclusive.
Reply to the conversation in character.
Then we go back and forth between our characters including all the prior conversations until we either get bored or we run out of credits for the API.
This works pretty well and, in fact, we can extend it out to have more than two characters quite easily. If we randomly switch between characters the conversation can look quite natural. We can, however, go further.
Step 3: Hopes and Dreams
The next thing we need to know is that we can convince ChatGPT to return its answers in a specific format, and we can use that to include additional information in the replies. If I include an instruction to structure replies in a certain way in the prompt then it will do its best to comply. Here I ask it to reply in json which is a commonly used data structure that lets us include a lot of additional bits of information in an easily readable and accessible format:
Output the response to the prompt above as json. The output should be a tuple where the tuple is in the form of:
{
"name" : <Name>,
"utterance" : <Utterance>
}
The magical thing about this is that we can extend it out with whatever additional data we think ChatGPT could dream up for us and the most interesting thing we could add to our conversation engine is an understanding of each character’s thoughts and feelings.
So now our prompt might look like this:
Context: You are a character called Alex. You are an extremely excitable and very creative innovation consultant. You love stories and games. You like to tell jokes. You have a lot of unruly curly hair. You used to be a game developer. You once worked on Crash Bandicoot. You love to cook.
You really dislike sports.
You are discussing: The best fruit.
Current feeling: Happy.
Last thought: Fruit are really delicious. Especially apples. Everyone should eat apples.
Keep your answers concise and conversational.
Reply to the conversation in character.
{prior_conversation}
---
Output the response to the prompt above as json. The output should be a tuple where the tuple is in the form of
{
"name" : <Name>,
"utterance" : <Utterance>,
"feeling" : <Feeling>,
"thoughts" : <Thoughts>
}
If the conversation has come to a natural conclusion then the <Feeling> should end with "The conversation has ended."
Example output json:
{
"name" : "Alex",
"utterance" : "Hello. I've been working down the mines today.",
"feeling" : Bored",
"thoughts" : "Working in the mines is awful. I must find a better job"
}
Adding an example output to the prompt seems to help the AI to nail the format every time.
The Results
Here’s a conversation about naming our CEO Michael’s hamster that we had with Lady Gaga. The stuff in brackets are the characters’ thoughts and dreams.
Andrew : Well, Michael, given the lively character of your new but older hamster, I'd suggest we name him 'Innovator'. It captures both his bitey spirit and our topic of discussion. What do you think? (I hope Michael likes the name suggestion for his hamster and that it also serves as a creative reminder of our innovation conversation.)
Michael : Innovator, huh? That's quite a fitting name considering our line of work. But does it have the same ring to it when I'm cheering on Tottenham or listening to Suede? What do you think, Alex? (I like the idea behind the name Innovator, but I'm not sure if it fits the hamster's personality.)
Gaga : Innovator's a name that's pretty neat, but maybe something with more beat? How about 'Biter' or 'Snappy', something to make you feel happy? (I hope Michael likes these names. They reflect the hamster's biting habit.)
Alex : Ah, 'Innovator', 'Biter', and 'Snappy' are all great names! But considering his scrappy nature and your love for cheering on Tottenham, why not combine them to name him 'Scrappy-Spurs'? It's got a sporting ring to it, even if I'm not much for the pitch myself. (I think this name is a fun compromise. It includes Michael's interests and reflects the hamster's personality.)
Gaga : 'Scrappy-Spurs' has got a sound, a name with spirit, quite profound. But to make it truly fine, let's add a touch of Gaga's line. How about 'Scrappy-Star', a name that will go far? (I hope Michael likes this name. It combines his interests, reflects the hamster's personality, and also includes a bit of my own influence.)
Alex : 'Scrappy-Star', eh? That's got a nice beat to it, Gaga. And 'star' does remind me of those twinkling lights in Crash Bandicoot levels. We've got sports, we've got personality, and a touch of nostalgia! What's not to love, Michael? (I think this name really encapsulates everything we've discussed. It's creative and fun, just like the hamster.)
Five More Things to Know
GPT-4 is much better than GPT-3.5 at this.
GPT-4 is also twenty times as expensive as 3.5 You can very quickly rack up a hefty OpenAI bill doing this kind of thing. Be very careful.
With some tinkering, it is possible to get this working with a local llama2 model if you have enough memory and a fast enough computer but the results are nowhere near as good.
OpenAI is obviously careful about misinformation and users getting ChatGPT to pretend to be real people. If you try to get it to do something sketchy or to run a phishing scam they will rightly ban you.
If you’re recreating conversations with real people you know then please be careful that you’re not stereotyping or down-talking them with this. It should go without saying that it would be very easy to write a description of someone that hurt them.
If you want us to test a conversation out for you then drop us a comment!
You Might Have Missed It…
Can you outsmart an AI? This game tasks you with outsmarting an AI. Gandalf.ai has one goal: to never tell you the password it knows. You have to craft prompts to trick it into giving up the info. A fun and insightful way to learn more about how large language models work.
Check it out here
AI Chatbot in a day! It’s amazing (or I think it is at least) how quickly you can create AI tools now. Until very recently, creating a useful AI model was an almost academic experience. You had to do a lot of work. Now, using tools like Streamlit, the process is now very simple. Last week, our new innovation consultant Katie made a chatbot app in a day, check it out here
And check out Streamlit here
The Next Start-Up Unicorn
It’s a company that doesn’t just organise tribute bands, but tribute everything. Missed the Wimbledon final? Don’t worry, we can organise a tribute version! Can’t afford a Ferrari? Don’t worry, we’ll make you a slightly worse but much cheaper version.