LLM Zoomcamp 1.6 — Building a Prompt

DataTalks.Club
DataTalks.ClubJun 10, 2026

Why It Matters

A well‑crafted prompt bridges retrieved data and the LLM, directly affecting answer accuracy and user trust in AI‑driven knowledge bases.

Key Takeaways

  • Prompt building splits into static instructions and dynamic user template.
  • Context is generated by concatenating search result dictionaries into plain text.
  • Build_prompt function assembles question, context, and strips whitespace.
  • Accurate LLM answers depend heavily on quality of retrieved data.
  • Next step after prompt creation is invoking the LLM for response.

Summary

The video walks through the second stage of the Zoomcamp LLM pipeline—building the prompt that will feed the language model. After retrieving relevant course‑related documents, the instructor explains how to transform those results into a readable context string and combine it with a static instruction block.

Two distinct sections compose the final prompt: immutable instructions that tell the model to answer using the provided context, and a dynamic user template that varies with each query. A helper function iterates over the search results, concatenates them into plain text, and the build_prompt routine stitches the question, context, and instruction together, trimming excess whitespace.

The presenter demonstrates the process with a sample query—"I just discovered the course, can I still join?"—showing how the exact match appears in the context and how irrelevant matches can still surface, highlighting the adage that a model is only as good as its data. He also notes a mis‑prediction (summer 2025) to illustrate data‑quality pitfalls.

The segment concludes by noting that prompt construction is now complete and the next logical step is to pass the assembled prompt to the LLM for inference. Mastering this step is crucial for developers building reliable retrieval‑augmented generation systems.

Original Description

Combining the user's question with search results into a prompt: separating fixed instructions from the per-request template.
LLM Zoomcamp is a free course on building real-world LLM applications: https://github.com/DataTalksClub/llm-zoomcamp
Module 1 (Agentic RAG), Part 1 — lesson 6 of 10.
Chapters:
0:00 Intro: building the prompt
0:54 Instructions vs user prompt
2:14 Building the context
3:40 Building the prompt
5:00 Inspecting the final prompt

Comments

Want to join the conversation?

Loading comments...