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.

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

ReAct

A react technique used to shape and strengthen the model's response.

Chain-of-Thought

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

Learn this technique
Structured Output

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

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