lesson 3 of 5 · retrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipslesson 3 of 5 · retrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipslesson 3 of 5 · retrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipslesson 3 of 5 · retrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipslesson 3 of 5 · retrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipslesson 3 of 5 · retrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipslesson 3 of 5 · retrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipslesson 3 of 5 · retrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipslesson 3 of 5 · retrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipslesson 3 of 5 · retrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipslesson 3 of 5 · retrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skipsretrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skips
Checkpoint
One last thing before we move on. pass this to mark the lesson done, or skip and keep moving. hop to the next when you're ready.
Final drill. Build rag_retrieve(query_vec, indexed, k, threshold)
that:
- Takes
indexedas a list of(chunk_id, doc_vec)pairs. - Computes cosine similarity between
query_vecand eachdoc_vec(usecosineprovided in the starter). - Filters by
score >= threshold. - Dedupes by
chunk_id, keeping the highest-scoring occurrence. - Returns the top-k chunk_ids in descending score order.
Three cases run. Expected output:
['policy/refund_terms', 'policy/refund_eligibility']
[]
['policy/refund_terms']