Version: 0.0.5 (stable)
agrag.common.data_models.candidate.CandidateRecord
Bases: BaseModel
One rejected extraction item, stored outside the entity graph.
Each job uses a new node id. The key groups sightings across jobs without changing a committed node's count. Entity and property candidates need text. Relation endpoints need an entity id or unresolved text.
Attributes:
- id (
UUID) – Per-job node id, random unless supplied by the caller. - kind (
CandidateKind) – Entity, relation or property candidate. - label (
str) – Proposed entity type, relation type or property name. - text (
str) – Entity surface text or property value. Empty for relations. - source_text (
str | None) – Unresolved source endpoint or property holder text. - target_text (
str | None) – Unresolved target endpoint text. - confidence (
float) – Extractor score from 0 to 1. Use 0 for an unscored item. - reason (
CandidateReason) – Why the extractor rejected the item. - chunk_id (
UUID) – Evidence chunk id. - source_entity_id (
UUID | None) – Source endpoint or property holder, when resolved. - target_entity_id (
UUID | None) – Target endpoint, when resolved. - source_label (
str | None) – Source endpoint or property holder type, when known. - target_label (
str | None) – Target endpoint type, when known. - state (
CandidateState) – Review state, initially pending. - count (
int) – Sightings represented by this node, fixed on creation. - schema_fingerprint (
str) – Schema used to extract the item, empty if unknown.
chunk_id
chunk_id: UUID
confidence
confidence: float = Field(ge=0.0, le=1.0)
count
count: int = Field(default=1, ge=1)
evidence_edge_id
evidence_edge_id: UUID
Return the deterministic evidence edge id.
id
id: UUID = Field(default_factory=uuid4)
key
key: str
Return the stable deduplication key for this record.
kind
kind: CandidateKind
label
label: str = Field(min_length=1)
reason
reason: CandidateReason
schema_fingerprint
schema_fingerprint: str = ''
source_edge_id
source_edge_id: UUID | None
Return the deterministic source edge id when its endpoint exists.
source_entity_id
source_entity_id: UUID | None = None
source_label
source_label: str | None = None
source_text
source_text: str | None = None
state
state: CandidateState = 'pending'
target_edge_id
target_edge_id: UUID | None
Return the deterministic target edge id when its endpoint exists.
target_entity_id
target_entity_id: UUID | None = None
target_label
target_label: str | None = None
target_text
target_text: str | None = None
text
text: str = ''