๐ฌ
STUDENT NOTES ยท DAY 18 OF 24
Project Day: Your Own AI Chatbot ๐ฌ
Day 1 you built a bot that followed YOUR rules. Today you give it a real brain โ and a memory.
1The secret of "memory"
๐
Py: Surprise: the AI remembers NOTHING between requests. The "memory" is just you re-sending the whole conversation every time!
2Roles: who said what
Every message is labelled: "user" (you), "assistant" (the AI), and one special "system" message that sets the bot's personality:
๐ฆ
Professor Hoot: The system message is the bot's job description. "You are a patient Python tutor who loves chai analogies" โ and suddenly it IS.
3The chat loop โ Day 1 pattern, Day 18 brain
๐ค
Bittu: while True + input + break on "bye" โ literally your Day 1 chatbot skeleton. Now with an actual mind attached.
4Don't forget to remember!
๐
Bugly: Forget to append the AI's reply to the history andโฆ it forgets its own last sentence. The conversations get VERY awkward. Hehehe.
5Quick quiz! ๐ง
How does your chatbot "remember" earlier messages?
๐ก The API is stateless โ memory is the messages list YOU maintain and resend.
The "system" message is forโฆ
๐ก It's the invisible instruction on top: who the bot is and how it should behave.
6Your mission ๐
Mission 1: Build the chat loop in class and have a 5-message conversation with your bot.
Mission 2: Give it a personality via the system message โ a pirate teacher? A Bollywood villain? Your call.
Mission 3: Prove the memory works: tell it your name, chat a bit, then ask "what's my name?"
Day 18 done โ you BUILT an AI! ๐ค
Next: NumPy โ maths at superhero speed.
Go to Day 19: NumPy โ