← All lessons

Lesson 11 of 14 · Building · 4 minutes

The Pantry: answering from your documents

An oven only knows what it learned long ago. It doesn't know your prices, your opening hours or your return policy. The Pantry fixes that: you put your own documents on shelves, and bakers look things up in them before they answer. The industry name is RAG, short for "retrieval-augmented generation": first find, then write.

How it works

Think of an index card box:

  1. Reading. Granny reads each file you add (text, Markdown, CSV, Word or PDF) on this PC.
  2. Cutting. She cuts it into short pieces, like index cards.
  3. Measuring meaning. An embedding oven turns every piece into numbers that capture its meaning. That's the only part that costs money, and it happens once per file. Big imports over 5 cents wait for your OK.
  4. Finding. When you ask something, Granny finds the pieces closest in meaning to your question and hands them to your baker.
  5. Answering. The baker answers from those pieces and shows where each fact came from.

Your files and the pieces stay on this PC. Only the text of each piece is sent once to be measured, and the matching pieces are sent with each question.

Pieces

Granny cuts at headings first, then between paragraphs, then between sentences, so a piece is usually 500 to 800 tokens. Pieces per message (1 to 20, usually 5) sets how many cards go with each question. More cards give the baker more to go on but cost a little more to send.

Measuring meaning

The numbers come from an embedding model (see model types). Each embedding model measures meaning its own way, so if you change it in Settings, a shelf has to be read again ("Re-embed").

How close is close enough?

Every piece gets a score from 0 (unrelated) to 1 (the same meaning). Closest match needed (usually 0.2) is the lowest score a piece may have and still be handed over. Lower finds more, but also less related pieces.

Sources

Answers built from the Pantry show numbered sources like [1] and [2]. Click one to see the exact piece, the file and the page. If an answer has no sources, the baker didn't find anything on its shelves.

Try it with Ask this shelf on any shelf in the PantryPantry before giving the shelf to a baker.

Granny's rule of thumb: clear documents make clear answers. A tidy price list with headings works better than a scanned photo of one.

Missing a lesson?

Tell me which AI topic still feels like a mystery, and Granny will explain it.

Ask for a lesson