promptdojo_

Retrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skips — step 8 of 9

Write retrieve(scored, k, threshold) that returns the top-k candidates, filtered by score >= threshold, deduped by chunk_id (keep the highest-scoring occurrence). Order the output by descending score.

Two cases run. Expected output:

['policy/p2', 'policy/p4', 'policy/p7']
[]

full-screen editor opens — close anytime to keep reading.