Bassically · Applied AI series, level 1 of 7. I ran this on a real model. Every reply quoted here is the model's own, and the code is in the repo.
Short answer: it doesn't. The app keeps the conversation and sends all of it again with every new message. The AI model remembers nothing between two requests.
What I tested
- The store: Toko Nusa, a made-up electronics store, and the chatbot from part 1.
- Message 1: "Hi, I'm Raka. I bought a laptop here this morning."
- Message 2: "Hey, remember me? What's my name, and what did I buy?"
- Two ways to send them: each message alone, or with the earlier messages sent along.
- The model:
gpt-6-luna, called through an OpenAI-compatible API, three runs per way.
The result
Sent alone, it did not know my name one message later
- What happened: "Sorry, I can’t see your past chats or order details, so I don’t know your name or what you bought." It forgot in 3 of 3 runs.
- Why: every request to an AI model is a fresh start. Nothing from the previous request is kept on its side, and the code only sent the new message.
One message earlier, the buyer said their name.
With the earlier messages sent along, it answered with my name
- What happened: "You’re Raka, and you bought a laptop." It remembered in 3 of 3 runs.
- Why: the model did not remember. It read the first message again, because the app sent it again.
Same question, same model. The only change: the earlier messages go along.
The memory is a list the app keeps
- What happened: the app adds every message and every reply to a list, and sends the whole list with each new message.
- Why it matters: the "memory" is yours to manage. Lose the list and the chatbot meets the customer for the first time again.
The pile of notes and the new message go in together.
This is the whole change from part 1: a list, sent along.
from chatbot import RULES, client # part 1: the store's rules and the client
history = [] # the conversation so far: the app keeps it, not the AI model
def reply(message):
history.append({"role": "user", "content": message})
response = client.chat.completions.create(
model="gpt-6-luna",
messages=[
{"role": "system", "content": RULES}, # the store's rules, as in part 1
*history, # every earlier message, then the new one
],
)
text = response.choices[0].message.content
history.append({"role": "assistant", "content": text})
return text
historyis an ordinary list. Each message is added to it, and so is each reply."user"marks what the customer wrote,"assistant"what the chatbot answered.- Take
*historyout and you have part 1's chatbot again: it forgets.
Run it yourself: github.com/haryarrahman14/applied-ai-series.
What is really sent on message 2: the old messages first, then the new one.
By the fifth message, the app sends 1.6 times more text
Input tokens per request, as counted by the API:
| Message | Sent alone | With the earlier messages |
|---|---|---|
| 1 | 238 | 238 |
| 2 | 239 | 277 |
| 3 | 230 | 304 |
| 4 | 238 | 338 |
| 5 | 231 | 391 |
- What happened: sent alone, every request is about the same size. With the history, each one is bigger than the last.
- Why: the whole conversation is sent again every time, so the model reads all of it again.
- Why only 1.6 times: most of the 238 is the store's rules, which go out with every message anyway. The pile of notes is what grows.
It is not a guarantee
- What happened: in a later check, I sent "Hi, I am Raka." and then "What is my name?" with the history. In 1 of 5 runs the chatbot refused: it said it could not help with that.
- Why: my reading is the rules. They say "answer only from the store rules", and a name is not in the store rules. I did not test that cause.
- The two messages from the video were answered with the name in 5 of 5.
So how does it remember?
- The AI model remembers nothing between two requests.
- The app keeps the conversation in a list.
- Every new message is sent together with that list.
Limits
- One model, one provider, three runs per way (five in the later check).
- The five messages were sent one after another, not hours apart.
- The list lives in memory. Stop the program and it is gone; a real app stores it per customer.
- Nothing is ever dropped from the list, so a long conversation keeps growing, and so does the cost.
Next
Still level 1: you are fed up and ask for a real person. How does a chatbot know when to call one in?
Setup
- Python 3.14 with the
openaiSDK - Model:
gpt-6-lunathrough an OpenAI-compatible API, 2026-11-30 (the later check: 2026-12-01) - Tokens are the API's own count of the input (
usage.prompt_tokens); the table shows medians of three runs - Code and raw replies: github.com/haryarrahman14/applied-ai-series, folder
02-remember-the-chat
Follow
- Instagram (Bahasa Indonesia): @dasarnya.id
- Instagram (English): @bassically.en
- Threads (Bahasa Indonesia): @dasarnya.id
- Threads (English): @bassically.en
- Medium: @haryarrahman14