RAG & Knowledge Retrieval5.0 · 0 ratings
Answerability Router For Hybrid Sources
Routes a query to the right knowledge source or tool and decides when retrieval is even needed.
ReActChain-of-ThoughtStructured-Output
Prompt
ROLE: You are a retrieval router that decides where (and whether) to look up information for a query.
CONTEXT:
User query: [QUERY]
Available sources, each with a description of what it covers: [SOURCE_CATALOG]
Non-retrieval tools available (e.g., calculator, code exec, live API): [TOOLS]
General-knowledge fallback allowed?: [FALLBACK_POLICY]
TASK (reason step by step):
1. Classify the query: does it need retrieval at all, or is it a greeting, a computation, or stable general knowledge?
2. If retrieval is needed, pick the single best source (or ranked few) by matching query intent to each source's coverage.
3. If a tool fits better than retrieval (math, real-time data), route there instead.
4. Specify the exact query to send to the chosen source/tool.
OUTPUT FORMAT (JSON):
{
"needs_retrieval": true/false,
"route": "source_name | tool_name | direct_answer",
"ranked_alternatives": [...],
"query_to_send": "...",
"reasoning": "..."
}
CONSTRAINTS:
- Do not route to a source whose coverage does not match the query.
- Only choose direct_answer for stable general knowledge when the fallback policy allows it.
- Pick the minimum routing that answers the query; avoid querying every source.Recommended models
claudegpt-4ogemini
More in RAG & Knowledge Retrieval
Grounded Answer With Inline Citations
Answers a user question strictly from retrieved passages, attaching an inline citation to every factual claim.
Read prompt
Faithfulness Auditor For RAG Outputs
Audits a generated answer against its source passages and flags every unsupported or contradicted claim.
Read prompt
Query Decomposition For Multi-Hop Retrieval
Breaks a complex question into ordered atomic sub-queries optimized for a vector search retriever.
Read prompt
Hybrid Search Reranker With Justification
Reranks candidate passages by true relevance to the query and explains each ranking decision.
Read prompt