[Closed] Suggestion: Username field for chat completion

Hi, I wanted to suggest a feature for the chat completions API (GPT-3.5 and GPT-4). I’m not sure how frequently OpenAI’s staff reads this forum, but I’ve been wanting to suggest this feature for a while.

The feature I want to suggest is a username feature, particularly a field in the user dictionary in messages. Example:

messages = [
    {role: 'user', username: 'Greg', content: 'Message.'},
    {role: 'assistant', content: 'Message.'}

It would also be nice to have this for the assistant field too, but it’s not that necessary since for most use cases, the assistant’s name would be the same for each message. However, if you’re using GPT as a chatbot like I am using it for, different users will be talking to the bot, so the user’s name won’t be the same. I store an internal chat log that the chatbot is aware of, and the user’s username is, of course, different depending on who they are.

Currently, there’s no username feature in chat completions, so you have to put the username in the content field. Example:

messages = [
    {role: 'user', content: '[Greg] Message.'},
    {role: 'assistant', content: 'Message.'}

I first tried using username: but now use [username] . I also have to tell the AI that the username isn’t a part of the message in the system prompt, but it still doesn’t work perfectly. The AI still thinks that the username is part of the message itself, even when told that it’s not, and I have to use extra code to remove [username] from the AI’s message, which is useful if it’s asked to, say, repeat a message. This is a hacky workaround, and it’d be much nicer if the AI knew that the username wasn’t a part of the message itself, but it doesn’t understand that despite being a part of the system prompt. I’ve experimented with different wording, but nothing works well.

I don’t know if this has been suggested before, but I couldn’t find anything when searching this forum.

I also tried using a second system prompt for certain information, placed after the user message, and that worked relatively well, except the AI would often ‘apologize for the confusion’, thinking that the second system message was something that the user or a user was saying to the AI.

When I used the Davinci models and other text completion models (Ada, Babbage, or Curie), just adding the username to the start of each message in the prompt, like ‘Greg: Hello, how are you?’ worked perfectly. But this does not work with chat completions. Since chat completions uses a list of dictionaries instead of just a string prompt, it definitely needs a username field.

TL;DR: If you use chat completions for creating a chatbot, you have to place the user’s username/display name in the message itself and tell it that it’s not part of the message, but the AI gets confused by that. It would be very useful to have an optional username field so that the AI knows who it’s talking to without having to deal with any confusion.

Suggestion, check out documentation. There is already a “name” key.


Example I just ran:
“role”: “user”,
“name”: “Joe_Stegomana”,
“content”: “Hi there. Do you know my name already?”


Hello Joe_Stegomana! No, I don’t have access to personal information unless you provide it to me. As an AI language model, I don’t have the ability to retrieve or remember personal details about individuals unless explicitly shared in the conversation. My purpose is to provide information and assist with any questions you may have. How can I help you today?

The awkward prompt is OpenAI training the AI too much on what our own products can’t do. Spaces are also not permitted in the name value.

Oh, thank you so much. Is this a new feature? I don’t remember seeing it before.

My apologies for not realizing it was a feature already! That’s quite useful. I do hope they update it to support spaces and non-English characters, but other than that, this is a much better solution than putting the user’s username in the message content!