Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 11.6 — User Feedback Loops
LLM Engineering · Example 1 of 1

Join feedback to requests

12 logged requests and 8 votes. The join compares two prompt versions, counts reasons and lists golden-set candidates.

Thumbs up and down, with a reason, tell you what automatic metrics cannot: whether the answer was useful. Join each vote to the request that produced it, compare prompt versions, and send the bad answers into your golden set.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 5 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Write score(votes) for a list of "up"/"down" strings that returns a string like "3 of 4 up (75%)" (whole percent, rounded down) or "no votes".

02

Write join_feedback(requests, feedback) where requests is a dict of id to question and feedback a list of (id, vote); return the questions of the thumbs-down in input order, skipping votes for unknown ids.

Explain it without notes

01

Why must feedback carry a request id, and what do you do with it?

02

What are the weaknesses of thumbs up and down as a quality signal?

03

How does feedback turn into regression tests?

Join feedback to requests
Sign in to run this example in your browser.

Expected output

feedback on 8 of 12 requests
v1: 4 votes, 3 up, 1 down, 75% up
v2: 4 votes, 1 up, 3 down, 25% up
reason wrong_answer: 3
reason too_long: 1
add to the golden set:
  r3: Can I change my delivery date?
  r7: Where is my order 5120?
  r9: Can I return a gift?