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
-
:material-pipe:{ .lg .middle } Refiner
Pipeline builder for chaining operations
-
:material-broom:{ .lg .middle } Cleaner
Operations for cleaning dirty data
-
:material-compress:{ .lg .middle } Compressor
Operations for reducing size
-
:material-shield-lock:{ .lg .middle } Scrubber
Operations for security and privacy
-
:material-chart-line:{ .lg .middle } Analyzer
Operations for metrics and analysis
-
:material-package-variant:{ .lg .middle } Packer
Context budget management with priorities
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...")