Skip to content

BaseProcessor

Sub classes

Name Children Inherits
Processor
llmling.processors.base
Content processor that executes a callable.
    Jinja2Processor
    llmling.processors.jinjaprocessor
    Processor that renders content using Jinja2.

      Base classes

      Name Children Inherits
      ABC
      abc
      Helper class that provides a standard way to create an ABC using

      ⋔ Inheritance diagram

      graph TD
        1058595610["base.BaseProcessor"]
        925645236["abc.ABC"]
        2751680898["builtins.object"]
        925645236 --> 1058595610
        2751680898 --> 925645236

      🛈 DocStrings

      Bases: ABC

      Base class for all processors.

      Source code in src/llmling/processors/base.py
      class BaseProcessor(ABC):
          """Base class for all processors."""
      
          def __init__(self) -> None:
              """Initialize processor."""
              self._initialized = False
      
          async def startup(self) -> None:
              """Initialize processor resources.
      
              Override this method if the processor needs async initialization.
              """
              self._initialized = True
      
          async def shutdown(self) -> None:
              """Clean up processor resources.
      
              Override this method if the processor needs cleanup.
              """
              self._initialized = False
      
          @abstractmethod
          async def process(self, context: ProcessingContext) -> ProcessorResult:
              """Process content with given context."""
      

      __init__

      __init__() -> None
      

      Initialize processor.

      Source code in src/llmling/processors/base.py
      def __init__(self) -> None:
          """Initialize processor."""
          self._initialized = False
      

      process abstractmethod async

      process(context: ProcessingContext) -> ProcessorResult
      

      Process content with given context.

      Source code in src/llmling/processors/base.py
      @abstractmethod
      async def process(self, context: ProcessingContext) -> ProcessorResult:
          """Process content with given context."""
      

      shutdown async

      shutdown() -> None
      

      Clean up processor resources.

      Override this method if the processor needs cleanup.

      Source code in src/llmling/processors/base.py
      async def shutdown(self) -> None:
          """Clean up processor resources.
      
          Override this method if the processor needs cleanup.
          """
          self._initialized = False
      

      startup async

      startup() -> None
      

      Initialize processor resources.

      Override this method if the processor needs async initialization.

      Source code in src/llmling/processors/base.py
      async def startup(self) -> None:
          """Initialize processor resources.
      
          Override this method if the processor needs async initialization.
          """
          self._initialized = True
      

      :fa-brands-github: Show source on GitHub