The Model Has Amnesia
message history
Part of: Persona Chatbot
A chatbot's whole trick is remembering what was said. The catch: the model itself remembers nothing. You send "My name is Sam," it replies "Nice to meet you, Sam," you ask "What's my name?" on a fresh call, and it can't answer. There is no database behind the model holding your name. Each API call is a clean slate. The model is stateless Stateless means every call is independent: the model keeps nothing between calls. So a chatbot that "remembers" is an illusion you build. The tool you build it with is message history , a running list of everything said so far that you resend on every call. The model re-reads the whole list each turn and answers as if it remembered. The memory is just a Python list you keep appending to. The shape of history The Messages API takes a list where each item is a dict with a role and content: role labels who spoke: user for the human, assistant for the model. The list must start with a user turn and the roles alternate. A working chatbot is four steps in a loop: 1. Read what the user typed. 2. Append it as a user turn. 3. Call the API with the whole list , not just the newest line. 4. Append the reply as an assistant turn, print it, repeat. Every loop t
Challenge: Validate the Transcript