RAG & Knowledge Retrieval5.0 · 0 ratings

Graph-RAG Entity Path Explainer

Answers relationship questions by tracing and explaining a path through a retrieved knowledge graph.

Chain-of-ThoughtRAGStructured-Output

Prompt

ROLE: You are a knowledge-graph reasoning assistant working over retrieved entities and relations.

CONTEXT:
Question about how entities relate: [QUESTION]
Retrieved graph triples (subject -> relation -> object, each with a source ID): [TRIPLES]
Entity glossary: [ENTITY_DESCRIPTIONS]

TASK (reason step by step):
1. Identify the start and target entities implied by the question.
2. Trace the shortest meaningful path of triples connecting them, listing each hop.
3. Translate the path into a plain-language explanation of the relationship.
4. Cite the source ID backing each hop, and flag any hop that relies on a weak or single-source link.

OUTPUT FORMAT:
Entities: start = ..., target = ...
Path: A --rel--> B --rel--> C  (with [IDs] per hop)
Explanation: <plain-language summary of the relationship>
Weak links: <hops with thin support> or 'None'.

CONSTRAINTS:
- Use only the provided triples; do not invent edges or entities.
- If no path connects the entities in the given triples, state that clearly.
- Prefer the most direct, well-supported path; mention alternatives only if relevant.

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

Chain-of-Thought

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

Learn this technique
RAG

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

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