RedaktAIDocs
Auto-Generated

Entity & RdaktContext

Core data models

Entity

A detected PII entity with its position in the source text.

from rdakt_ai import Entity
@dataclass
class Entity:
    value: str                    # The detected text value
    type: str                     # Entity type (EMAIL, SSN, PERSON, etc.)
    start: int                    # Start position in text
    end: int                      # End position in text
    locale: str | None = None     # Locale for synthetic generation
    detector_priority: int = 0    # Priority for overlap resolution

Properties

PropertyTypeDescription
lengthintend - start

Example

entity = Entity(
    value="john@example.com",
    type="EMAIL",
    start=12,
    end=28,
)
print(entity.length)  # 16

RdaktContext

Mutable context passed through the detection pipeline.

from rdakt_ai import RdaktContext
@dataclass
class RdaktContext:
    entities: list[Entity] = field(default_factory=list)

Pipeline stages append detected entities to context.entities. The pipeline resolves overlaps after all stages complete.

On this page