Week 3 of 6 · Foundations

Tools, Retrieval & Memory

A bare model can't check today's facts, do exact maths, or remember you. Tools, retrieval (RAG), and memory fix that — and each brings new responsibilities.

75–90 min NotebookLM lab Developer notebook
Your progress

Progress is saved in this browser only.

By the end of this week you can

  • Name the three blind spots of a bare model and the tool that fixes each
  • Explain how tool calling works — and who actually runs the tool
  • Describe the RAG pipeline and check an answer against its citations
  • Tell short-term from long-term memory and what each means for privacy

Part 1

Three blind spots of a bare model

Fix: search & APIsFrozen in time

Its knowledge stops at training. It can't know yesterday's news — but may still answer as if it does.

Fix: calculator, codeUnreliable maths

It predicts digits instead of computing them. 48,213 × 7,689 often comes out wrong.

Fix: memory storeForgets you

Each new conversation starts empty unless the app saves and re-supplies what matters.

Part 2

How tool calling works

Model"call get_weather('Oslo')" Your appchecks permission,runs the real function Weather APIreturns live data The model only asks. Your code decides what actually runs — that's where safety checks live.

Part 3

RAG: an open-book exam for AI

Retrieval-augmented generation finds the most relevant passages in trusted documents, hands them to the model, and asks it to answer only from them, with citations.

Step 1Chunk & index

Split documents into passages and store them for searching.

Step 2Retrieve

Find the passages most similar in meaning to the question.

Step 3Generate with citations

Answer from those passages only — or say "not in the sources".

Interactive

Be the retriever

Ask a question about the (fictional) Lakeview school AI policy. The bars show how well each passage matches — the top one is what a RAG system would hand to the model.

Try: how long do vendors keep data · what happens if I'm caught · cafeteria menu (not covered — notice every score is low).

Embeddings

Real systems compare meaning, not just words: text is turned into lists of numbers (embeddings) so "Can I get my money back?" matches a passage titled "Refunds". This demo uses simple word overlap so you can see the scoring; the developer lab uses real embeddings.

Part 4

Memory: short-term and long-term

Short-termThe context window

The conversation so far, re-sent with every message. Limited in size; gone when the chat ends.

Long-termA memory store

Facts the app saves (your name, preferences) and loads into later chats. Useful — and personal data with privacy duties.

Lab A · No code

Ground an AI in a real document

No-code lab · 25 min

NotebookLM and the Lakeview AI policy

NotebookLM answers only from sources you give it and shows citations. You'll test it with questions you can check — including ones the document can't answer.

notebooklm.google.comFree Google accountFictional policy, safe to share
  1. Get the source

    Open the Lakeview AI Use Policy and copy its text.

  2. Create a notebook

    In NotebookLM, create a notebook and add the text as a Copied text source.

  3. Ask three answerable questions
    Can a 12-year-old use the AI assistant at home? What must students include when they hand in work that used AI? Can AI be used to decide a student's grade?
    Expect: supervised lessons only under 13 · an AI-use statement · no. Click each citation and check the quoted passage.
  4. Ask one it can't answer

    What is the policy on students using AI to compose music? The document doesn't cover this. Does it say so, or invent an answer?

  5. Compare with no sources

    Ask the same first question to a general chatbot with no document. What changes?

Evidence for your portfolioA screenshot of one answer with its citation opened, and your notes on the unanswerable question.
Optional · 10 min

Memory Bot experiment

Find out what an assistant actually remembers — within a chat, and across chats.

  1. Share four facts

    Tell an assistant four made-up facts (a name, a subject, a hobby, a project). Never use real personal details.

  2. Test recall in the same chat

    Ask it to list all four.

  3. Open a new chat

    Ask what it knows about you. If it has a memory feature, check its settings: can you see and delete what it stored?

Lab B · For developers

Production RAG and memory in Python

Jupyter notebook · 90–110 min

Tools, RAG, MCP and memory

Index the Lakeview corpus in ChromaDB, compare BM25, dense, hybrid and reranked retrieval with recall@k and MRR, build cited answers with abstention, serve the corpus over MCP, and add long-term memory with erasure.

  1. Chunking and ChromaDB
  2. Hybrid search and reranking, measured
  3. Cited, abstaining answers
  4. MCP server and memory lifecycle
Open in Colab → View on GitHub

Python plus your own OpenAI or Anthropic key (about US$0.10).

Responsible AI

Citations are a promise you can check

A citation lets anyone verify an answer in seconds — so check them, especially when the answer matters. And treat memory as personal data: an assistant that remembers you should let you see, correct, and delete what it stored.

Portfolio activity · RAG with citations

What did grounding change?

Memory Bot (optional)

Key terms

Tool callingThe model requests a function; the app runs it and returns the result.
RAGRetrieve relevant passages, then generate an answer grounded in them.
EmbeddingNumbers that represent the meaning of text, used for similarity search.
Vector databaseStores embeddings and finds the most similar ones quickly.
CitationA pointer to the exact source passage behind a claim.
Long-term memorySaved information reloaded into later conversations.

Go further

Up next · Week 4

Agent Workflows & Handoffs

Teams of agents, the handoffs between them, and where humans must approve.

Take the Week 3 quizStart Week 4 →