Command Palette

Search for a command to run...

Hectal
Phase 3: Prompting as Engineering
LLM Engineering · Exercise 4 of 6 PreviousNext
Beginner

Build a few-shot message list

Write build_shots(system, examples, text) that returns a list of chat messages (dictionaries with role and content).

Order: one system message, then for each (ticket, label) in examples a user message (the ticket) followed by an assistant message (the label), then a final user message with text.

What Check tests

  1. No examples gives system then user
  2. Each example is a user message then an assistant message
  3. Contents are in order
  4. The real input is the last message

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

main.py
Sign in to run your code.

Output

Press Run to see what your program prints.