Class to parse the output of an LLM call into a dictionary.

Hierarchy

  • Toolkit<Record<string, string>>
    • RegexParser

Constructors

Properties

outputKeys: string[]
regex: string | RegExp
defaultOutputKey?: string

Methods

  • Returns a string with instructions on how the LLM output should be formatted to match the regex pattern.

    Returns string

    A string with formatting instructions.

  • Parses the given text using the regex pattern and returns a dictionary with the parsed output. If the regex pattern does not match the text and no defaultOutputKey is provided, throws an OutputParserException.

    Parameters

    • text: string

      The text to be parsed.

    Returns Promise<Record<string, string>>

    A dictionary with the parsed output.

Generated using TypeDoc