Prompt LibraryEngineering

LLM Reranking Prompt for RAG Retrieval

Use a model as a cross-encoder-style reranker for retrieved chunks.

The prompt

Query: {{query}}

Candidates (numbered):
{{candidates}}

For each candidate, score 0-10 on how directly it answers the query (not how related the topic is).
Return a JSON array sorted by score descending: [{ "id": n, "score": n, "reason": "one clause" }].
Penalise chunks that are topically relevant but do not contain the actual answer.

Replace the {{fields}} with your own context and tighten the rules to match your domain.

Share this prompt