Knowledge Graph Extraction JSON

Anthropic Cookbook

Submit a prompt

Overview

Extract central entities, descriptions, and relationships from a document as a knowledge graph in JSON.

Use cases

Prompt
Copied 0
Extract a knowledge graph from the document below.

<document>
<<<paste text>>>
</document>

Return ONLY valid JSON:
{
  "entities": [
    {"name": "string", "type": "PERSON|ORGANIZATION|LOCATION|EVENT|ARTIFACT", "description": "string"}
  ],
  "relations": [
    {"source": "string", "predicate": "string", "target": "string"}
  ]
}

Rules:
- Extract only entities central to what this document is about — skip incidental mentions.
- Every relation must connect two entities you extracted.
- Do not invent facts.

Can AI?

Alternatives

  • Break down an earnings callThis prompt breaks down the transcript of a quarterly results call or investor conference for equity research. It pulls out what management said, the analyst questions, financial and operating signals, warning signs, and less obvious hints, then writes an executive summary in bullets.Research
  • Explain a bill or law, including what it plays downThis prompt summarizes a proposed bill or an existing law, lists the changes it would make, and contrasts how its backers present it with a balanced reading. It also points out parts that may get less attention, such as fees, loopholes, or cut programs, and their likely effects.Research
  • Four-stage fact check of a claimThis prompt tests one claim against a passage from a source in four fixed stages: pull out literal statements, rate the source's reliability, judge whether the claim is supported, then look for other readings. It ends with a verdict of supported, contradicted, or not enough info, plus a brief reason.Research