The Problem

Extracting structured knowledge from unstructured text typically requires either manual curation or brittle regex/NER pipelines. LLMs can do this extraction, but wiring prompts, chunking text, ontology definitions, and graph assembly into something reusable is repetitive engineering work.

What This Does

graph_maker is an example notebook demonstrating the knowledge-graph-maker pip package. It converts text corpora into knowledge graphs by defining an ontology (entity labels and relationships), chunking input text, and using an LLM to extract entities and relations per chunk.

The core logic lives in lotr_wikipedia_summary.py (1 function, generate_summary) and the walkthrough in graph_maker_example.ipynb. The README points to the upstream library for production use; this repo is a demonstration layer.

How It Is Wired

Static analysis shows a minimal codebase: 1 internal module, 0 import edges, 0 circular dependencies, 1 resolved internal call edge. The notebook is the entry point—it defines generate_summary, which calls a model for inference. That single call is the only external effect: no database, no network I/O, no filesystem writes beyond the notebook itself.

The wiring is effectively: graph_maker_example.ipynbgenerate_summary → LLM inference. The lotr_wikipedia_summary.py file is a thin helper. There is no hub module, no cycle, and nothing to refactor—the blast radius is the notebook itself. The upstream knowledge-graph-maker package (not in this repo) does the heavy lifting.

File map:

  • graph_maker_example.ipynb — the entire demo; owns the ontology definition and the model call
  • lotr_wikipedia_summary.py — single helper function for summarization
  • pyproject.toml / poetry.lock — dependency management via Poetry
  • .env.example — environment template (API keys for the LLM client)
  • assets/ — images and animation for the README

How To Use It

Setup — Poetry is the package manager. From the README:

poetry config --local virtualenvs.in-project true
poetry install

Do not install knowledge-graph-maker manually; Poetry handles it.

Configuration — Copy .env.example to .env and set your LLM API key. The notebook expects environment variables for the model client.

Running it — Open graph_maker_example.ipynb in Jupyter and execute cells in order. There is no CLI entry point; this is notebook-driven.

Real-World Use

For a document corpus—say, legal contracts or support tickets—you would define an ontology matching your domain (parties, obligations, dates), chunk documents, and let the library build a graph. That graph then feeds Graph-RAG: instead of vector similarity, you traverse relationships to answer questions like "what obligations does vendor X have under contract Y?" The notebook shows this pattern with Lord of the Rings text as a toy example.

Code Health & Issues

Static analysis (deterministic, from this pipeline) found:

  • Medium — No test files detected — repository-wide. The extraction logic is untested; a change to the ontology schema or prompt format has no regression guard.
  • Medium — No CI/CD pipeline — no .github/workflows/ or equivalent. Nothing gates commits on tests or linting.
  • Medium — Enable Dependabot or Renovate — 1 manifest (pyproject.toml), no update bot. Advisory patches wait for manual audits.
  • Medium — Large binary in repoassets/GraphMaker.png is 7.0MB. Every clone and CI checkout pays for it; move to LFS or object storage.

SDLC observations from structure: no Dockerfile, no committed secrets detected, license present, lockfile present.

The Bottom Line

A clean, minimal demonstration of the upstream library. It is not a production codebase—one notebook, one helper function, no tests, no CI. Use it as a reference for how to define ontologies and structure a graph-extraction workflow, then depend on the maintained knowledge-graph-maker package for real work.