diff --git a/simplemind/chains/reverse_text.py b/simplemind/chains/reverse_text.py index 7f102a2..cccdcbc 100644 --- a/simplemind/chains/reverse_text.py +++ b/simplemind/chains/reverse_text.py @@ -2,5 +2,24 @@ from .base import BaseChain class ReverseTextChain(BaseChain): - def run(self, input_data): + """Chain that reverses input text. + + This chain takes a text input and returns it reversed. For example, + "hello" becomes "olleh". + """ + + def run(self, input_data: str) -> str: + """Reverse the input text. + + Args: + input_data: The text to reverse. + + Returns: + The reversed text. + + Raises: + TypeError: If input_data is not a string. + """ + if not isinstance(input_data, str): + raise TypeError("Input must be a string") return input_data[::-1]