📓 Machines That Talk · Day 16

Give the Bot a Notebook

A chatbot doesn't know your stuff — your school, your club, your pet. So we give it a tiny notebook, let it look up the right note first, paste that note into the prompt, and then answer. Grounded, not guessed.

↓ ask the notebook
📓 Lab · The Notebook

Look it up, then answer

Here's a notebook of 6 facts about a made-up school. Ask a question. The bot searches for the best-matching note, pastes it into its prompt, and answers from it. Compare: no notebook = a shrug; with notebook = the real answer.

❓ Your question 🔎 Search notebook 📌 Paste best note 🤖 Answer

🤷 Without notebook

Ask something to see the bot guess…

📓 With notebook

…and see it answer for real.

0INPUT TOKENS · no notebook
0INPUT TOKENS · with note
+0extra tokens (grounding costs $)

Pasting the note in makes the prompt longer — and you pay per token. That's the deal: a little extra cost buys a grounded, correct answer instead of a guess.

😈 Break-It Challenge

Feed it the wrong note

The answer is only as good as the note you grab. Hit the button: we ask about the Robotics Club but hand the bot the class-pet note instead. It won't say "hmm, that's wrong" — it'll answer with total confidence.

Garbage in, garbage out. The bot trusts whatever note it's given. If retrieval grabs the wrong note, the answer is wrong — but it still sounds sure. That's why good search matters as much as a good bot.
🏷️ The pro wordLooking things up and feeding them into the prompt is called Retrieval-Augmented Generation (RAG). The notes you paste in are the grounding context. Instead of the model guessing from memory, it answers from real facts you handed it — that's how bots use your documents.
🎯 Boss Build · Find the Right Note

Be the retriever

Retrieval is just picking the right note. A question appears with 3 notes — tap the one that actually answers it. Get 3 right to earn the badge and finish the day.

Right: 0 / 3
🚀 Beyond the Basics

How the pros really do it

Our notebook matched on shared words. Real RAG is the same shape — search, paste, answer — but each step levels up:

✍️

Paste facts by hand (what you'd try first)

Just glue the note into the prompt yourself. ✅ Dead simple. ⚠️ Only works if you already know which note to grab.

🔎

Keyword search (what you built)

Score notes by shared words, grab the best. ✅ Automatic. ⚠️ Misses "car" vs "automobile" — different words, same meaning.

🧠

Semantic search (the real deal)

Turn every note into a list of numbers that captures meaning, then find the closest ones. ✅ Matches ideas, not just words. ⚠️ Needs a database and tuning.

🏷️ Pro names to look upThe meaning-numbers are embeddings, stored in a vector database (FAISS, Chroma, pgvector). Long docs get split into chunking; results get reordered by reranking; and good bots add citations so you can check the source. Pro win: no lies from memory. Pro cost: extra tokens, extra plumbing, and it's only as good as your notes.
🔬 Real Model Lab

Real semantic search — on your device

Keyword search only matches shared words. This is a real embedding model (all-MiniLM) running on your device — it turns each note into a list of numbers that captures meaning, so it can match ideas that share no words at all. Load it once (~25 MB) and try to fool it!

not loaded

🎉 Day 16 Complete!

You gave the bot a notebook. Now it looks a fact up, pastes it in, and answers from it — grounded, not guessed. That's RAG: the trick that lets a chatbot use your documents, your club, your world.

Day 17: The Sneaky Instruction Trap →
Tomorrow: if a bot will read any note you paste in… what if a note contains sneaky instructions? We spring the prompt-injection trap. 🕵️
AI Adventure · Machines That Talk · Day 16 — made for young inventors 🚀