Course overview

Filter constraints before ranking preferences

The best-looking result may be unacceptable

A spicy chicken bowl may match the query better than a tofu bowl. If vegetarian is a hard requirement, the chicken bowl should never win. Separate eligibility from ranking.

For our fictional dataset, first exclude unavailable, stale, non-matching dietary, or over-budget items. Then rank eligible items using query relevance. A preference score must not buy its way past a hard constraint.

Check your understanding

A non-vegetarian dish has the highest relevance score. What should happen?

Calculate a total with explicit assumptions

The lab adds item price, delivery, fees, tax, and the chosen tip in integer cents. That avoids simple decimal rounding surprises and makes the calculation easy to audit. These values are training fixtures, not current charges.

The user’s “under $25” means strictly less than 2500 cents. “At most $25” would permit equality. Preserve that distinction rather than changing it silently. Unknown charges cannot be treated as zero in a real checkout calculation.

Check your understanding

For a strict “under $25” limit, the total must be less than ___ cents.

Explain why an item was excluded

The lab lists exclusions as well as results. “Outside the budget” and “unavailable” point to different next actions. When nothing qualifies, ask whether a preference can change; do not silently relax a hard requirement.

Dietary tags in a sample dataset are not a guarantee about real preparation or cross-contact. If a user reports an allergy, avoid inferring safety from a missing ingredient and require appropriate verification before presenting a safe-food claim.

Check your understanding

No sample item satisfies the current constraints. How should the assistant respond?

Build checkpoint

Open the Retrieval Lab and follow the practice above. Each lab explains its inputs, its actual logic, and its limits. Save your observations below; your check-ins and reflection remain in Product Academy.

For an AI-assisted code change, download the lab bundle from the lab page. Ask your coding assistant to explain the relevant function first, change one behavior, and add one test that could fail. Compare the result with your prediction.

Save your experiment and check-in

Record your prediction, what you tried, what happened, and the evidence for your conclusion. Name one thing you can now do independently and one uncertainty to revisit.

Key takeaways

  • Filter hard constraints before scoring preferences.
  • Make all price components and boundary conditions explicit.
  • Treat an empty eligible set as a reason to clarify.
Ask AI
AI Learning Assistant