Overview
TheCovariate class represents metadata associated with subjects in the knowledge graph. While the class is named “Covariate” in the codebase, it is commonly used to represent claims - specific factual statements or assertions about entities extracted from the text.
Covariates are flexible metadata containers where each subject (e.g., an entity) may be associated with multiple types of covariates. The most common use case is entity claims, which are factual statements about entities.
Covariates inherit from the Identified base class, which provides id and short_id fields.
Schema
Core fields
Unique identifier for the covariate/claim.
Human-readable ID used to refer to this covariate in prompts or texts displayed to users.
The ID of the subject this covariate is associated with. Typically an entity ID.
The type of the subject. Defaults to “entity” but can represent other subject types.
The type of covariate. Defaults to “claim” for factual assertions, but can represent other metadata types.
Relationships
List of text unit IDs in which the covariate information appears. Links the claim back to its source text chunks.
Metadata
Additional attributes containing the actual claim content and metadata. For claims, this typically includes fields like:
description: The claim textstatus: Verification statusstart_date/end_date: Temporal validitysource_text: Original text snippet- Any custom metadata fields
Example
Creating from dictionary
TheCovariate class provides a from_dict() class method to create instances from dictionary data:
Common claim attributes
When using covariates as claims, theattributes dictionary typically contains:
The actual claim text - a factual statement about the subject.
Verification status of the claim (e.g., “verified”, “disputed”, “unverified”).
When the claim became true or valid.
When the claim ceased to be true or valid (if applicable).
The original text snippet from which the claim was extracted.
Confidence score for the claim extraction (0.0 to 1.0).
Use cases
- Fact extraction: Store specific facts and assertions about entities
- Temporal tracking: Track time-sensitive information with start/end dates
- Source attribution: Link claims back to original text via text_unit_ids
- Metadata enrichment: Add structured metadata to entities beyond basic descriptions
- Claim verification: Store and track verification status of extracted facts