class Postprocessor: """Postprocessor.""" def run(self, text: str) -> str: """Postprocess.""" raise NotImplementedError("Postprocess method is not implemented") class ClaudePostprocessor(Postprocessor): """Claude Postprocessor.""" def run(self, text: str) -> str: """Clean the response from the Claude model. Args: text (str): The response from the Claude model. Returns: str: The cleaned response. """ # remove the ```markdown and ``` at the beginning and end of the text text = text.replace("```markdown", "").replace("```", "") # Remove any leading or trailing whitespace text = text.strip() return text class GPTPostprocessor(Postprocessor): """GPT Postprocessor.""" def run(self, text: str) -> str: """Clean the response from the GPT model. Args: text (str): The response from the GPT model. Returns: str: The cleaned response. """ # remove the ```markdown and ``` at the beginning and end of the text text = text.replace("```markdown", "").replace("```", "") # Remove any leading or trailing whitespace text = text.strip() return text