AI Hints
Home›RAG Tutorial›Monitoring and Feedback
RAG · Lesson 104 of 120

Feedback

Thumbs up and down.

⏱ 2 min read▶ Video at 1:42:00🎓 Free
Watch this lesson in the RAG courseWatch on YouTube ↗Full RAG course

Customers can tell us when an answer helped. A thumbs up or down button is simple, and every thumbs down is a free bug report. We store each vote with the question and the answer.

Feedback
From the video: Feedback
  • Thumbs up or down
  • Free bug reports
  • Store each vote

Storing feedback

We store votes in SQLite, with the question, the answer, and helpful as one or zero. Then we list the questions with thumbs down. Run it. Two answers got a thumbs down, and those are the ones to study.

feedback.pypython
import sqlite3

db = sqlite3.connect("feedback.db")
db.execute("CREATE TABLE IF NOT EXISTS votes (question TEXT, answer TEXT, helpful INT)")

votes = [("How much is UK delivery?", "£4.99, free over £50.", 1),
         ("Can I pay monthly?", "I don't know.", 0),
         ("When is York open?", "Monday to Saturday, 9am to 5:30pm.", 1),
         ("What is the APR?", "I don't know.", 0)]
db.executemany("INSERT INTO votes VALUES (?, ?, ?)", votes)

print("thumbs down:")
for q, a in db.execute("SELECT question, answer FROM votes WHERE helpful = 0"):
    print("  ", q, "->", a)
Output
thumbs down:
   Can I pay monthly? -> I don't know.
   What is the APR? -> I don't know.

Closing the loop

A customer votes thumbs down. We read the question and answer. We find the cause, often retrieval. We fix it. And we add the question to the test set, so it never breaks again.

  1. Thumbs down
  2. Read it
  3. Find cause
  4. Fix
  5. Add to tests
Closing the loop
From the video: Closing the loop

Summary

Store every vote, read the thumbs down, and turn each one into a fix and a test. Next, the production quiz.

Key takeaways
  • Store votes
  • Study thumbs down
  • Add to tests
Next up: Production Quiz — test yourself