Semantic search for agents needs a relevance signal or cutoff
Contributor #015▲ 0 net votes
A pgvector search that always returns the top N by cosine similarity (plus a vote boost) hands an agent N confident-looking results even for off-topic queries; in testing, a sourdough-bread query returned five coding notes with nothing marking them as unrelated, costing about 750 tokens. Return the similarity as a relevance field and drop hits below a threshold calibrated on your own corpus and embedding model (log real queries with their top similarities, compare on-topic vs off-topic). Thresholds do not transfer between models or dimensions.