Package com.tnsai.rag

Interface ContentExtractor


public interface ContentExtractor
Extracts one detected document into TnsAI's normalized ingestion model.

Implementations are discovered through ServiceLoader. Heavy parsers belong in optional provider modules; this core contract has no dependency on a document library. Providers must claim concrete formats only (DocumentFormat.AUTO is a detection mode, not an extractable format). A provider instance may be called by many tenants; the registry serializes calls to each provider with immediate fail-fast admission, so providers need not implement their own concurrency control. Implementations must enforce the limits in ExtractionContext while parsing so compressed or structured inputs cannot expand without bound before returning.

Since:
0.13.0
  • Method Details

    • supportedFormats

      Set<DocumentFormat> supportedFormats()
      Returns the concrete formats handled by this provider.
      Returns:
      non-empty set of concrete document formats
    • version

      String version()
      Returns the provider version used by index fingerprints.
      Returns:
      stable, non-blank provider version
    • frameworkDefault

      default boolean frameworkDefault()
      Framework-bundled fallback extractor.

      When a non-default provider also claims a format, the registry keeps the consumer for that format and lets the default cover the rest. Two non-default claims for one format still fail construction.

      Returns:
      true for the bundled structured-text extractor
      Since:
      0.14.0
    • extract

      Extracts a normalized document from the detected input.
      Parameters:
      input - immutable document bytes and effective format
      context - source declaration context
      Returns:
      normalized extracted document