Overview
Domain configurations control what entity types and relation types sift-kg extracts from documents. You can use bundled domains or create custom schemas for your specific use case.load_domain
Signature
Parameters
Path | None
default:"None"
Path to custom domain YAML file. Takes priority over
bundled_name.str
default:"schema-free"
Name of bundled domain to load if no
domain_path given. Available bundled domains:"schema-free": LLM discovers entity/relation types from data"biomedical": Medical/clinical entities and relations"legal": Legal documents and contracts"academic": Research papers and citations
Returns
DomainConfig
Validated domain configuration
Examples
DomainConfig
Fields
str
required
Domain name (e.g.
"biomedical", "legal")str
default:"1.0.0"
Schema version for tracking changes
str
default:""
Human-readable description of the domain
dict[str, EntityTypeConfig]
default:"{}"
Entity type definitions (e.g.
PERSON, ORGANIZATION, LOCATION)dict[str, RelationTypeConfig]
default:"{}"
Relation type definitions (e.g.
WORKS_FOR, LOCATED_IN)str | None
default:"None"
Optional system context injected into LLM prompts for better extraction
str | None
default:"None"
Fallback relation type for relationships that don’t fit defined types
bool
default:"False"
If
True, LLM discovers entity/relation types from the data instead of using predefined schemaMethods
get_entity_type_names
get_relation_type_names
get_extraction_hints
EntityTypeConfig
Fields
str
default:""
Human-readable description (also used as LLM extraction hint)
list[str]
default:"[]"
Additional hints to guide LLM extraction (e.g.
["full name", "aliases"])list[str]
default:"[]"
Known canonical entity names (e.g.
["United States", "USA", "US"] for a country)str | None
default:"None"
Fallback entity type for canonical name matching
RelationTypeConfig
Fields
str
default:""
Human-readable description (also used as LLM extraction hint)
list[str]
default:"[]"
Allowed source entity types (empty list = any type)
list[str]
default:"[]"
Allowed target entity types (empty list = any type)
bool
default:"False"
If
True, relation is symmetric (e.g. COLLABORATES_WITH)list[str]
default:"[]"
Additional hints to guide LLM extraction
bool
default:"False"
If
True, relations of this type are flagged for human reviewCreating Custom Domains
YAML Format
Create a domain YAML file:my_domain.yaml
Using Custom Domain
Programmatic Domain Creation
Schema-Free Mode
For exploratory analysis when you don’t know the schema upfront:DomainLoader Class
For advanced use cases, you can use theDomainLoader class directly: