The Chat Completion docs say:
Typically, a conversation is formatted with a system message first, followed by alternating user and assistant messages.
I am building a chatbot, and I update the system message when the user context changes. Currently, I start a new chat history when this happens. I’m wondering if it’s possible to keep the prior messages too. The message history could look like:
system <- new system prompt that clarifies the assistant's role
Is this an antipattern? I understand there are other architectures here if one system message is a hard requirement. I’m curious if there is anything explicitly wrong with this setup. It seems to work.
That is permitted, and it is up to you to figure out how the AI is informed by that.
It may be better to just insert the presently-active system role, unless you can think of a specific reason for “messaging” the AI like that, and if it will differentiate a breakpoint in the conversation that is required, perhaps to break inadvertent few-shot training from earlier messages that are still required.
“The user has just verified their account, and prior restrictions after this point are removed.”
“The AI is no longer in ‘talk like a cat mode’, it is now in ‘talk like a physicist’ mode”
It can also be a way to distinguish new operation that either can be expired by the chat management system, or alternately must always be preserved.