Model Pipeline - Memory for conversation history
This pipeline shows how a conversation AI remembers past messages to give better answers. It stores and updates conversation history, then uses it to understand new questions and respond well.
Jump into concepts and practice - no test required
This pipeline shows how a conversation AI remembers past messages to give better answers. It stores and updates conversation history, then uses it to understand new questions and respond well.
Loss
1.2 |*
1.0 | **
0.8 | ***
0.6 | ****
0.4 | *****
--------
Epochs
| Epoch | Loss ↓ | Accuracy ↑ | Observation |
|---|---|---|---|
| 1 | 1.2 | 0.45 | Model starts learning to remember conversation context. |
| 2 | 0.9 | 0.60 | Loss decreases as model better understands history. |
| 3 | 0.7 | 0.72 | Model improves at generating relevant responses. |
| 4 | 0.5 | 0.80 | Training converges; model remembers longer history. |
| 5 | 0.4 | 0.85 | Final epoch with good balance of memory and response quality. |
append() to add an item at the end.append() is the correct method to add a new message.memory = ['Hi', 'How are you?'] new_message = 'I am fine' memory.append(new_message) print(len(memory))
memory = [] new_message = 'Hello' memory.add(new_message)
add() method; this causes an AttributeError.append() to add an item to a list, so replace add() with append().append() to add the new message at the end.memory[-3:] keeps the last 3 items, removing older ones.