# Abstract Base Class for LLM Simplification Engines from abc import ABC, abstractmethod from pathlib import Path import yaml class BaseSimplify(ABC): PROMPTS_DIR = Path("src/prompts") @abstractmethod def __init__(self, config): pass @abstractmethod def simplify_one(self, text) -> str: # Simplify a single text input and return the simplified text pass @abstractmethod def simplify_batch(self, texts) -> list[str]: # Simplify a batch of text inputs and return a list of simplified texts pass def load_prompts(self, name: str) -> dict: with open(self.PROMPTS_DIR / f"{name}.yaml") as f: return yaml.safe_load(f) # Afther Base comes the the specific implementations of the LLM