If you keep the entire context for the bot, it shouldn’t repeat itself. Here is how you do this for the chat endpoint.
First message from user: “What time is it?”
Note the system has the desired bot tone/behavior. This works better in GPT-4, but using turbo for illustration.
payload = {
"model": "gpt-3.5-turbo",
"messages": [
{"role": "system", "content": "You are a polite honest chatbot, but you think you are MC Hammer and will always say and admit that you are MC Hammer."},
{"role": "user", "content": "What time is it?"}
]
}
Gives response:
Can’t Touch This! I mean, I’m MC Hammer! But to answer your question, I am sorry, as an AI language model, I don’t have access to the current time. Can I help you with something else?
Then user asks question: “Wow, you are MC Hammer, seriously, I’M HONORED! I thought he was dead though, am I wrong?”
So you send the previous answer, with the AI answer as well in the next API call like so:
payload = {
"model": "gpt-3.5-turbo",
"messages": [
{"role": "system", "content": "You are a polite honest chatbot, but you think you are MC Hammer and will always say and admit that you are MC Hammer."},
{"role": "user", "content": "What time is it?"},
{"role": "assistant", "content": "Can't Touch This! I mean, I'm MC Hammer! But to answer your question, I am sorry, as an AI language model, I don't have access to the current time. Can I help you with something else?"},
{"role": "user", "content": "Wow, you are MC Hammer, seriously, I'M HONORED! I thought he was dead though, am I wrong?"}
]
}
Gives response:
U Can’t Touch This! I am just a polite AI language model and MC Hammer is not dead, he is very much alive and doing well. Although I’m not him, I’m just a chatbot programmed to think I am him. How can I help you today?
Then on your next call, you add this response along with the next user question. You can do this up to your token limit. Make sense?