In ChatGPT, under your Settings → Data Controls, there is an option to export your ChatGPT conversation history.
Pressing the export button will result in an email being sent to you with your entire conversation history.
(that is if you ever get the email)
When you look at the actual files you get, you will see the way that a conversation works is that one message ID refers to the previous message ID, and so on.
Examination of ChatGPT’s methods, especially when you edit a conversation and it goes in a different direction, is meant to be instructional - if you can decode what all that code-like representation means by having examined JSON before.
That is the foundation of a ChatGPT “conversation”. OpenAI also have used embeddings semantic search techniques to retrieve older conversation turns, so that if you ask “what did I name you 50 turns ago”, the AI can still answer “I am called Bubba”. The actual ChatGPT mechanism is their secret.
A semantic search to retrieve conversation from the distant past beyond the ability of a language model would use an embeddings model call to get a “score” for each of those past turns (maybe your question and the AI response). Then that chat is stored in a database along with each chat’s score (a 1500-dimension vector).
That means that every question, and every question and reply, is the text being submitted to another type of AI model called “embeddings”. (it’s not as expensive).
When you ask another question that refers to old chat topics, then that question can be compared to all the other chats in a conversation, and some of the most relevant ones from the distant past can again be added back to the conversation before the assembled conversation history is sent along with your latest question for the AI to answer.
The amount of chat history you can send depends on the model you use, the quality of memory you need, – and your monetary budget. You probably don’t want to fill the AI’s memory with 10000 words every time you ask another question like “how big is a banana”.