Skip to content

API Reference

Complete API reference for all Prompt Refiner classes and operations.

This section contains auto-generated documentation from the codebase docstrings. All operations inherit from the base Operation class and implement a process(text: str) -> str method.

Quick Navigation

Operation Base Class

All operations in Prompt Refiner inherit from the Operation base class:

from abc import ABC, abstractmethod

class Operation(ABC):
    @abstractmethod
    def process(self, text: str) -> str:
        """Process the input text and return the result."""
        pass

Usage Pattern

Operations are used within a Refiner pipeline:

from prompt_refiner import Refiner, StripHTML, NormalizeWhitespace

refiner = (
    Refiner()
    .pipe(StripHTML())
    .pipe(NormalizeWhitespace())
)

result = refiner.run("Your text here...")

Module Organization