RisingCoder Full course โ†’
Day 1Day 2Day 3Day 4
๐Ÿ’ฌ
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 โ†’

๐ŸŽฎ Or test yourself in the Python Arcade โ†’