RAG by Hand
Paste the facts in.
Before we automate anything, let's do RAG by hand. We copy the right paragraph from the shop's shipping page, paste it into the prompt, and ask our question. That's all RAG really is.

- Copy the facts
- Paste into the prompt
- Ask the question
Facts in the prompt
The facts variable holds a paragraph from the shipping page. The prompt tells the model to answer using only these facts. Then it asks about next day delivery. Run it. Now the model gives the shop's real price, because we gave it the facts.
from langchain.chat_models import init_chat_model
llm = init_chat_model("google_genai:gemini-flash-lite-latest", temperature=0)
facts = """Next-day delivery is available for parts and accessories ordered
before 1pm, for £7.99. It is not available for bikes."""
prompt = f"""Answer using only these facts.
Facts: {facts}
Question: How much does next-day delivery cost? One sentence."""
print(llm.invoke(prompt).text.strip())Next-day delivery costs £7.99.
What we did by hand
We did three things by hand. We chose the right paragraph. We built a prompt with it. And we asked the model. The rest of this course is about doing the first step automatically, and doing it well.
| key | value |
|---|---|
| Retrieve | we picked the paragraph |
| Augment | we built the prompt |
| Generate | the model answered |
| Next | automate retrieval |
Summary
RAG by hand means pasting the right facts into the prompt. The hard part is finding the right facts automatically. Next, meet our knowledge base.
Key takeaways- Pick the facts
- Build the prompt
- Model answers