Back to section lessons
Free overview · medium · Lesson 3 of 5

Pack the context

Choose one paragraph that answers how long backups are kept and keep its source label.

Context is the text the model can see when answering. In RAG it includes the question and the passages that retrieval found. The model has a limited input capacity, so you may have to choose even among relevant documents.

A small example

Imagine you have room for one more paragraph. An employee asks how long backups are kept. One paragraph explains how to create a backup, another gives the retention period. Keep the second and retain its source label so the reader can check the number.

What fits in the request?

A model measures text length in tokens. A token can cover a word or just part of one. Suppose you have 30 tokens left for sources after allowing for the question and labels. The paragraph about creating a backup takes 24 tokens and the retention rule takes another 16. If you include the creation steps first, six tokens remain. Can you still include the whole rule? It would have fit on its own, but now you need to reconsider the selection. Inspect the text the model will actually receive.

See it happen

From a question to a checked answer

Follow one fact. Retrieval supplies a source; generation and answer checking are separate steps.

  1. Question
  2. Retrieve
  3. Context
  4. Generate
  5. Check

A question about a document

What is the Zora retry delay?

The weights have not been trained on this new fact.

1/5: Question

A numerical illustration. Training and model generation run in the local project.

Done reading?

Mark the lesson as read to move your track progress forward.

Now build your own version

Pack retrieved chunks for the model while preserving the question and token budget.

What practice includes and how much it costs

MCP includes the full lesson and a local project with starter files. Work through the task with your agent, ask for a hint and run the checks on your computer.

$134 $67.00 for one year −50%

One payment, no auto-renewal · Terms

Buy for $67.00