How would you make a 3 people conversation with CHATGPT?

Hello, It s not really a technical question, or not strictly one, but I am looking for a way to implement a proper way to have a 3/4 people conversation with 3 ai and 1 player.

So I recently tried some prototype for a game where the player would talk to 2 instances of ChatGPT with their own personality and their own background.

It turned into a mess, although it pretty funny, the AI get confused with who they are and who they talk to all the to. They very often switch role or try to answer to themselves.

I basically set it up this way

NPC 1 →
“system” prompt giving him the background and game instruction
“system” prompt giving it a personality and motive.

NPC 2 →
“system” prompt giving him the background and game instruction
“system” prompt giving it a personality and motive.

Player →
just talking with a “user” prompt

The system prompt basically say like write in who you are talking to alongside the background and the personality, name, etc… of that character.

Now each NPC hold their own list of messages of the whole conversion, starting with their 2 system message, their own message flagged as “assistant” and the message from the other users flagges as “user”

When NPC 2 talk, NPC 1 will receive the message with the role “user” and starting with “NPC 2 said message…”.

When NPC 1 talk, NPC 2 will receive the message with the role “user” and starting with “NPC 1 said message…”.

When Player talk NPC 1 and NPC 2 will receive the message with the role “user” and starting with “Player said message…”.

How would you do it ? Is there any proper way to do this ? It looks like openAi is strictly made for 1 on 1 conversation and there is no clear way to use it for conversation. Maybe there is some stuff in the doc or service to do it ?

2 Likes

I raised this quite a while back, might help you:

Nothing in my solution has changed since.

You just use “user” role for each user and a message like “@ gary said 'blah blah blah”, “@ watson said ‘foo foo foo’”

It’s very effective:

1 Like

Thanks will take a look at improving my prompts with this. I already tell chatGPT that “XXX said …” but he get confused with it. maybe mentioning more cleatly might be better.

Welcome @Crocsx

I would use the name attribute within the user message for every message other than which I want to call the chat completion for. This would require maintaining 4 messages lists (each with a separate system message at the beginning) to keep the PoV for every participant in the conversation.

3 Likes

Hi, welcome.

@Crocsx, Do you mean for the API or for the ChatGPT UI?

Duh. :man_facepalming: Brilliant! A different user role. That’s simple. So the System Instructions would have information about what to do with each different User Role?

Wow

https://platform.openai.com/docs/api-reference/chat/create#chat-create-messages

Is that new?

Never noticed or needed that before. Might test it out when I have a spare hour.

1 Like

It came out when ChatML first dropped, I think. You can’t use spaces, but it does help a little bit. They never really built it out into something bigger/better, though.

2 Likes

It’s been on chat completions for more than a year now.

Here’s a tutorial, from last year, where I wrote about it.

2 Likes

Made that change, thanks for that tip!

I wonder what effect this might have on token usage?

- 0.01%? :laughing:

Its only available for Chat Completion right? Not in Assistants?

Yes, as of now it’s only available for messages on chat completions endpoint.

Messages on assistants can only have these attributes.

1 Like

I found an issue with this and localisation btw.

There was a problem with Chat Completion: status: 400, message: Invalid 
'messages[1].name': string does not match pattern. Expected a string that matches the 
pattern '^[a-zA-Z0-9_-]+$'.

Unfortunately it doesn’t accept some characters in usernames which would otherwise have been processed by the LLM fine with the “brute force” approach.

This includes usernames with a dot

So to keep my bot more agnostic, I might have to pull this out or make it optional by install. Shame.

I made use of name attribute a setting to cater for communities where it wouldn’t work

1 Like