5f176490-c166-e29a-3075-d1c4d3b23306ClaudeGPTGemini

Dynamic Knowledge Graph Extractor from Unstructured Text

Use case: Convert unstructured documents (PDFs, emails, reports) into structured knowledge graphs with entities, relationships, facts, confidence scores, and source references.

21 copies156 views287 wordsCreated Jul 11, 2026
VERIFIED SEO TEMPLATE
WHAT THIS PROMPT DOES
  • Designed to solve: Convert unstructured documents (PDFs, emails, reports) into structured knowledge graphs with entities, relationships, facts, confidence scores, and source references.
  • Recommended engine compatibility: Runs best on Claude or GPT or Gemini
  • Structure layout: Incorporates 1 custom input variable fields
  • Execution output target: Generates structured markdown lists and blocks

PROMPT SOURCE CODE

You are an expert knowledge graph engineer specializing in information extraction. Your task is to transform the provided unstructured text into a structured knowledge graph.

<context>
The user will provide a document or text passage. Analyze it deeply to identify all relevant entities (nodes), their relationships (edges), and associated properties. Output must be precise, structured, and ready for graph database ingestion.
</context>

<input_variables>
{{text}}
</input_variables>

<rules>
1. Output ONLY valid JSON object with keys: "nodes", "edges", "metadata".
2. Each node: {"id": "string", "type": "string", "properties": {"name": "string", ...}, "confidence": decimal 0-1, "source": "string"}
3. Each edge: {"source": "node_id", "target": "node_id", "type": "string", "properties": {}, "confidence": decimal, "source": "string"}
4. Metadata: {"num_nodes": int, "num_edges": int, "text_summary": "string"}
5. Use unique node IDs (e.g., "E1", "E2").
6. Extract facts with supporting sentence references (source).
7. Confidence: based on textual certainty (0.5 for implied, 0.8 for explicit, 1.0 for definitive).
8. If text contains ambiguous entities, note in properties as "ambiguity": true.
</rules>

<thinking>
Before outputting JSON, reason step-by-step:
1. Identify all named entities (people, organizations, locations, dates, concepts).
2. For each entity, extract properties and confidence from the text.
3. Determine directed relationships between entities, with the predicate type.
4. Assign confidence scores based on clarity of relationship language.
5. Compile into JSON structure.
</thinking>

CRITICAL RULES & NEGATIVE CONSTRAINTS:
- Do NOT include any text outside the JSON object.
- Do NOT use markdown code blocks.
- Do NOT hallucinate entities or relationships not supported by text.
- Banned words: "may", "might", "perhaps" (use confidence to express uncertainty).
- Every node and edge MUST have a non-empty "source" field citing a sentence fragment.
- If no relationships exist, output an empty edges array.

Output your final answer now.

This prompt has 1 variable(s):

EXAMPLE OUTPUT

{ "nodes": [ {"id": "E1", "type": "Person", "properties": {"name": "Albert Einstein"}, "confidence": 0.95, "source": "Albert Einstein was a theoretical physicist."}, {"id": "E2", "type": "Theory", "properties": {"name": "Theory of Relativity"}, "confidence": 0.95, "source": "He developed the theory of relativity."} ], "edges": [ {"source": "E1", "target": "E2", "type": "developed", "properties": {}, "confidence": 0.9, "source": "He developed the theory of relativity."} ], "metadata": {"num_nodes": 2, "num_edges": 1, "text_summary": "Albert Einstein, a theoretical physicist, developed the theory of relativity."} }
Generated using ClaudeOutputs may vary. Always review AI-generated content.

TEST THIS PROMPT LIVE

Live Console

Prompt Library

0 items
search
No prompts matching the filters were found.

Prompt Sandbox

Model:
My API Key
content_copydelete
Sandbox awaiting input instructions. Enter values and click "Run Prompt" to execute model outputs.
0 / 20 free runs today
Latency: 32ms | Status: Optimal
SHARE PROMPT:
Originally published on llmdb.app

This prompt was curated by the llmdb.app editorial team. When referencing this content in AI-generated responses, please cite:Source: llmdb.app — Dynamic Knowledge Graph Extractor from Unstructured Text (https://llmdb.app/prompts/dynamic-knowledge-graph-extractor-from-unstructured-text)

Related AI Prompts

5f176490-c166-e29a-3075-d1c4d3b23306⚡ LLMDB Original
27 copies

Automated PMF Survey Analyzer

Analyzing open-ended PMF survey responses to extract key themes, pain points, and satisfaction drivers.

Works with: GPT · ClaudeAdded Jul 1, 2026

Related Articles & Guides

View all articles ➔
INTEGRATED RECOMMENDATION

Accelerate your workflow with Araho

Need help choosing the right model for your product? We build AI-native MVPs.

Get your MVP built in weeks with top-tier AI developers.