Back to catalog / Document automation
Build an entity graph to answer cross-document questions
Extract typed entities and relation triples, resolve name variants, then answer multi-hop questions over the graph.
Goal
Connect dispersed facts through explicit relations that can be audited.
Steps
- Define Pydantic entities, relations, and source fields; extract with
client.messages.parse(...)as in the notebook. [graph] - Extract subject-predicate-object triples per document, resolve alias candidates, and retain provenance. [graph]
- Build a relevant subgraph and answer a multi-hop question; include node/edge sources for review. [graph]
How to verify
Aliases resolve while original mentions remain traceable; a two-edge question is answered via graph paths, not model recall.
Troubleshooting
If entities merge incorrectly, review canonical-ID evidence and allow manual splits; uncertain relations remain candidates.
Permissions
Prerequisites
- Python 3.11+, anthropic SDK, Anthropic API key, and an authorized text corpus.
Permissions
- Preserve document-level ACLs; graph only authorized material and filter inaccessible nodes/edges before output.
Limitations
Extraction can miss or mislink entities/relations; the in-memory graph is not a transactional graph database.
Pinned upstream source
- Repository
- anthropics/anthropic-cookbook
- File path
- capabilities/knowledge_graph/guide.ipynb
- Pinned commit
9c1e493ddd2b82df399d2a61b9c806c539e18be6- Source checked
- 2026-10-14 · Reviewed against the pinned upstream source
Repository metrics
These values describe the upstream repository, not popularity or likes for an individual skill or playbook.
- Stars
- Not collected
- Forks
- Not collected
- Observed at
- Not collected
No metrics snapshot is available yet.
License: MIT
Main topic
Turn ecommerce campaign materials into a reviewable weekly brief