Exercise on prompting
Time: 15–20 minutes
Apply all four prompt engineering techniques to a weak baseline prompt, measuring the score lift from each change. By the end you should be able to show the progression numerically — clarity, specificity, XML structure, examples — on the same dataset with the same grader.
Step 1—Set Up
Reuse the PromptEvaluator setup from the module introduction. Generate a small dataset (2–3 cases) for the meal plan task, or pick a different structured-output task of your own if you prefer — a code reviewer prompt, a customer-support classifier, a summarisation prompt with specific format requirements.
Write a deliberately weak baseline prompt. Something like:
prompt = f"""
What should this person eat?
- Height: {prompt_inputs["height"]}
- Weight: {prompt_inputs["weight"]}
- Goal: {prompt_inputs["goal"]}
- Dietary restrictions: {prompt_inputs["restrictions"]}
"""
Run the eval and write down the baseline score. This is the number every subsequent iteration has to beat.
You can now apply iterative prompt improvement in your own projects.