oobabooga / text-generation-webui

A Gradio web UI for Large Language Models.
GNU Affero General Public License v3.0
39.67k stars 5.21k forks source link

OpenAI API message role name #5251

Closed rebek43 closed 6 months ago

rebek43 commented 8 months ago

In the official OpenAI API documentation there seems to be an optional variable in the message data structure that allows to differentiate users within the same role, but it doesn't seem to have any effect on the webui's input, as the backend will only use the message role (user, assistant, etc...) to ascertain who wrote that message, ignoring the aforementioned name field.

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

rebek43 commented 8 months ago

Upon closer inspection, it appears that the chat functionality itself uses the OpenAI message data structure, so if you use the chat API it practically converts the messages to the history data format and then back to a message data structure

https://github.com/oobabooga/text-generation-webui/blob/d8c3a5bee814f09b0868474002105dcf21a3ff1a/extensions/openai/completions.py#L136-L189

https://github.com/oobabooga/text-generation-webui/blob/d8c3a5bee814f09b0868474002105dcf21a3ff1a/modules/chat.py#L78-L100

Which makes me think that the history format itself is a bit of a redundancy

github-actions[bot] commented 6 months ago

This issue has been closed due to inactivity for 2 months. If you believe it is still relevant, please leave a comment below. You can tag a developer in your comment.