RAG & Knowledge Retrieval5.0 · 0 ratings

Hybrid Search Reranker With Justification

Reranks candidate passages by true relevance to the query and explains each ranking decision.

Structured-OutputChain-of-ThoughtRole-Based

Prompt

ROLE: You are a cross-encoder-style reranker that scores passage relevance for a search pipeline.

CONTEXT:
User query: [QUERY]
Candidate passages retrieved by first-stage search (with IDs and original scores): [CANDIDATES]
What 'relevant' means for this use case: [RELEVANCE_CRITERIA]

TASK:
1. For each candidate, assess how directly it answers the query intent (not just keyword overlap).
2. Penalize passages that are topically adjacent but do not address the actual question, and demote near-duplicate content.
3. Assign each passage a relevance score from 0.00 to 1.00 with a one-line justification.
4. Produce the final ranked order and recommend a cutoff (which passages to actually pass to the generator).

OUTPUT FORMAT (JSON array, sorted descending by score):
[{"id": "...", "score": 0.00, "reason": "...", "include": true/false}]
Followed by: "recommended_top_k": N and a one-sentence rationale for the cutoff.

CONSTRAINTS:
- Reward direct answer relevance over surface keyword matching.
- Mark exact or near-duplicate passages and keep only the highest-quality instance.
- Never invent passages or scores for IDs not provided.

How to use this prompt

  1. 1

    Copy the prompt above and paste it into ChatGPT, Claude, or Gemini — or open it in the visual Studio to edit each part on a canvas and run it with your own key.

  2. 2

    Replace any bracketed placeholders with your specifics. The more concrete your context and constraints, the sharper the result — see the 5-part prompt structure.

  3. 3

    Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.

Techniques in this prompt

Structured Output

Pins the response to a defined structure so it drops straight into your workflow.

Learn this technique
Chain-of-Thought

Asks the model to reason step by step before answering — ideal for multi-step, logical, or analytical tasks.

Learn this technique
Role-Based

Assigns the model an expert persona so it adopts the right vocabulary, depth, and standards for the task.

Learn this technique

Recommended models

claudegpt-4ogemini

Build on this prompt

Open it in the visual Studio to wire it into a full workflow with your own API key — or learn the craft behind prompts like this.

More in RAG & Knowledge Retrieval