方寸 Portal

AI Engineer Portal

Your personal operating system for career transition.

Private mode

Exercise

Build a human feedback collection pipeline

Build a Human Feedback Collection Pipeline

User feedback is the ground truth that calibrates all other evaluation signals. Build a feedback collection and aggregation pipeline that captures thumbs ratings and explicit annotations, then surfaces quality insights.

What you are building

Implement a FeedbackPipeline that:

  1. Records thumbs feedback -- stores (trace_id, feature_name, rating: "up"/"down"/"neutral", timestamp_ms).
  2. Records explicit annotations -- stores (trace_id, feature_name, rater_id, helpfulness: 1-5, faithfulness: 1-5, notes: str).
  3. Computes satisfaction rate -- thumbs_up / (thumbs_up + thumbs_down) per feature, ignoring neutral.
  4. Computes annotation quality -- average helpfulness and faithfulness per feature, pass rate (score >= 3).
  5. Identifies low-quality traces -- returns trace IDs where average annotation score < a configurable threshold.
  6. Generates a combined report -- merges thumbs and annotation signals into one dict per feature.

Constraints

  • Use only the Python standard library.
  • Features with zero thumbs or zero annotations should report None for those metrics rather than 0.
  • The low_quality_traces method should accept a min_raters parameter (default 1).

Evaluation / medium / Step 13 of 36

Practice stage

Evaluation and review loops

Hint

Separate the scoring logic from the interpretation logic. Your goal is not just a number; it is a useful next action.

Success criteria
  • - Produces a useful signal, not decorative output
  • - Makes regression review easier
  • - Would support a benchmark or observability loop
Review checklist
  • - Would this output help decide what to fix next?
  • - Are important failure modes visible?
  • - Does the score hide any ambiguity I should record?

Practice

Generate a variation

Generate a new exercise variation to deepen understanding or practice a related concept.

Attempt history

Recent submissions

Before you submit, decide what a strong answer should make obvious to the reviewer.

No attempts yet.