Dino Geek, try to help you

How to manage a multi-user conversation with the ChatGPT API?


As of now (as per March 2022), OpenAI’s gpt-3.5-turbo, which powers ChatGPT, does not officially support multi-user conversations. In the chat models, a conversation is typically framed as between a system and a user. However, you can work around this by managing conversation roles in your application.

You can include multiple user messages in the messages array and can use the ‘role’ field to indicate who is speaking. For ‘role’, you can use ‘user’, ‘assistant’, or any other role you want (like ‘User1’, ‘User2’, etc.), but you will need to manage the state and flow of the conversation. This approach can be used to implement a chat system with multiple users.

Here is an example of how you might include multiple users in a conversation:

```
‘messages’: [ {‘role’: ‘user1’, ‘content’: ‘Hello, how are you?’}, {‘role’: ‘user2’, ‘content’: ‘I am fine, thank you. How about you?’}, {‘role’: ‘system’, ‘content’: ‘Translate this conversation into French.’}
]
```

In the current model, this is a workaround and not officially supported behavior. Do take note that the assistant does not know the context that ‘user1’ and ‘user2’ are different. You can include ‘role’ in the ‘content’ to give more context to the assistant:

```
‘messages’: [ {‘role’: ‘user’, ‘content’: ‘User1 says: Hello, how are you?’}, {‘role’: ‘user’, ‘content’: ‘User2 says: I am fine, thank you. How about you?’}, {‘role’: ‘system’, ‘content’: ‘Translate this conversation into French.’}
]
```

For future updates, please refer to OpenAI’s documentation.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use