Skip to main content

Introduction

While sift-kg is primarily a CLI tool, you can also use it as a Python library in your notebooks, web apps, or data pipelines. The Python API gives you full control over the extraction pipeline with explicit parameters instead of CLI arguments.

Installation

For embedding-based entity resolution:

Quick Start

Core Imports

Pipeline Architecture

The sift-kg pipeline consists of several stages:
  1. Extract (run_extract): Parse documents and extract entities/relations using an LLM
  2. Build (run_build): Construct a knowledge graph from extractions
  3. Resolve (run_resolve): Find duplicate entities using LLM-based comparison
  4. Apply Merges (run_apply_merges): Apply human-reviewed entity merges
  5. Narrate (run_narrate): Generate narrative summaries using community detection
  6. View (run_view): Create interactive HTML visualizations
  7. Export (run_export): Export to GraphML, GEXF, CSV, or SQLite
You can run the full pipeline with run_pipeline() or individual stages for more control.

Basic Example: Step-by-Step

Using Custom Domains

Working with the Knowledge Graph

Environment Setup

Set your LLM API keys before running:

Next Steps