Parse Answers

class rupsycho.parser.BasicParser(*args, name=None)[source]

Bases: BaseOutputParser[str]

A custom parser that processes and cleans text by removing line breaks and non-ASCII Unicode characters.

This parser is designed to work with LangChain and can be integrated into various chains or agents that require cleaned text output.

Parameters:
  • args (Any)

  • name (str | None)

parse(text)[source]

Parses the input text to remove line breaks and non-ASCII Unicode characters.

Parameters:

text (str) – The input string to be cleaned.

Returns:

The cleaned string with line breaks and non-ASCII Unicode characters removed.

Return type:

str

Raises:

OutputParserException – If an error occurs during parsing, an OutputParserException is raised with a descriptive error message.