RedaktAIDocs
Auto-Generated

Pipeline Stages

RdaktStage, DetectorStage, and aliases

RdaktStage (ABC)

Base class for pipeline stages. Implement both process (async) and process_sync methods.

from rdakt_ai import RdaktStage

Abstract Methods

async def process(
    self, text: str, context: RdaktContext, call_next: CallNext
) -> None: ...

def process_sync(
    self, text: str, context: RdaktContext, call_next_sync: CallNextSync
) -> None: ...
ParameterTypeDescription
textstrInput text to analyze
contextRdaktContextMutable context — append entities here
call_next / call_next_syncCallableInvoke the next stage in the chain

DetectorStage

Wraps any Detector protocol implementation into a pipeline stage.

from rdakt_ai import DetectorStage, RegexDetector

stage = DetectorStage(RegexDetector())
ParameterTypeDescription
detectorDetectorObject with a detect(text: str) -> list[Entity] method

Detector Protocol

class Detector:
    def detect(self, text: str) -> list[Entity]: ...

Any object matching this protocol can be wrapped in DetectorStage.

Aliases

RegexStage = DetectorStage   # Backwards compatibility
NerStage = DetectorStage     # Backwards compatibility

On this page