Skip to main content

What Are Domains?

A domain is a YAML configuration that defines:
  • Entity types: What kinds of things to extract (people, organizations, concepts, etc.)
  • Relation types: How entities can be connected
  • Extraction hints: Guidance for the LLM to improve accuracy
  • Review requirements: Which relations need human validation
  • System context: Background information to help the LLM understand your documents
Domains act as a schema that guides extraction, ensuring consistency across documents.

Bundled Domains

sift-kg ships with four production-ready domains:

Schema-Free

Best for: Exploratory analysis, unknown document types, rapid prototyping
The schema-free domain lets the LLM discover entity and relation types from your documents:
How it works:
  1. Samples your documents
  2. LLM designs entity and relation types tailored to the corpus
  3. Schema saved to discovered_domain.yaml
  4. Uses discovered schema for consistent extraction
When to use:
  • You don’t know what entity types exist in your documents
  • You want to explore a new dataset
  • You’re building a custom domain and want to see what the LLM finds
Example discovered schema:

General Purpose

Best for: Business documents, reports, news articles, general text
The general domain provides broad coverage for common entity types:
Full schema: /home/daytona/workspace/source/src/sift_kg/domains/bundled/general/domain.yaml

OSINT Investigation

Best for: Corporate investigations, beneficial ownership tracing, financial networks
Optimized for open-source intelligence work:
Full schema: /home/daytona/workspace/source/src/sift_kg/domains/bundled/osint/domain.yaml

Academic Research

Best for: Literature reviews, research mapping, understanding idea networks
Maps the intellectual landscape of research areas:
Full schema: /home/daytona/workspace/source/src/sift_kg/domains/bundled/academic/domain.yaml

Using Bundled Domains

Specify a bundled domain with the --domain-name flag:
Or set it in your sift.yaml project config:
List all available bundled domains:
Output:

Creating Custom Domains

Build a domain tailored to your use case:

Basic Structure

Advanced Features

1. Type Constraints

Restrict which entities can be connected:
Invalid relations are either:
  • Dropped if domain_relation_types is provided to build_graph
  • Mapped to fallback_relation if defined
  • Kept as-is (no constraints)

2. Symmetric Relations

Mark bidirectional relationships:

3. Review Requirements

Flag specific relation types for human validation:
During sift build, all instances of this relation type are written to relation_review.yaml regardless of confidence.

4. Canonical Vocabularies

Enforce closed vocabularies for specific entity types:
How it works:
  • Canonical entities are pre-created in the graph
  • Extractions matching canonical names (case-insensitive) map to canonical entities
  • Non-canonical entities are retyped to canonical_fallback_type
  • All relations resolve correctly
Example:

Domain File Placement

Save your custom domain as a YAML file:
Use it with the --domain flag:
Or set it in sift.yaml:

Domain Best Practices

1. Start with Schema-Free

Before building a custom domain, run schema-free extraction to see what the LLM discovers:
Use the discovered schema as a starting point for your custom domain.

2. Use Extraction Hints

Guide the LLM with specific instructions:

3. Provide System Context

Help the LLM understand your domain:

4. Balance Granularity

Too coarse:
Too fine-grained:
Just right:

5. Test Iteratively

Domain design is iterative:
  1. Extract a sample of documents
  2. Review the results
  3. Add hints or adjust types
  4. Re-extract with --force
  5. Repeat until quality is acceptable

6. Version Your Domains

Track domain evolution:

Domain Configuration Reference

Top-Level Fields

Entity Type Config

Relation Type Config

Complete schema: /home/daytona/workspace/source/src/sift_kg/domains/models.py

Next Steps

How It Works

Understand the full pipeline from extraction to visualization

Entity Resolution

Learn how sift-kg finds and merges duplicate entities