How ChatGPT API remember the whole history?

Right now i am building a chatbot for multiple users by using openai api.
However, the bot seems cannot remember the whole conversation history.
If i want the bot to remember the history, i have to call the api by contatining the whole conversation history?
I am wondering if there is any other easy way to do that?

3 Likes

It doesn’t, you have to use the Chat (OpenAI API) functionality. You basically need to keep the user and assistant messages in a list, append to the list when you keep up the conversation, then feed the updated list back to the API. You can also do fun things with databases if you need longer-term memory, but that is outside of the scope of my expertise.

3 Likes

Yeah and pay more tokens, and get stuck when you exceeded the max tokens.
They must add such feature to give chat history without paying or limiting such feature.