Named Entity Extraction JSON

Anthropic Cookbook

Submit a prompt

Overview

Extract people, organizations, locations, and other named entities with supporting context in JSON.

Use cases

Prompt
Copied 0
Extract named entities from the document. Return ONLY valid JSON:

{
  "entities": [
    {
      "name": "string",
      "type": "PERSON|ORGANIZATION|LOCATION|OTHER",
      "context": "short quote or sentence where it appears"
    }
  ]
}

Rules:
- Prefer types PERSON, ORGANIZATION, LOCATION; use OTHER only when needed.
- Do not invent entities not present in the text.
- Deduplicate exact same name+type pairs.

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

Can AI?

Alternatives

  • Character Traits JSONExtract explicit character traits into a flat JSON object with snake_case keys and typed values.Document intelligence
  • Email Address ExtractionCopy email addresses from text exactly, returning one address per line or N/A when none appear.Document intelligence