langchain.js
    Preparing search index...

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

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • fields: RegexParserFields

      Returns RegexParser

    • Parameters

      • regex: string | RegExp
      • outputKeys: string[]
      • OptionaldefaultOutputKey: string

      Returns RegexParser

    Properties

    defaultOutputKey?: string
    lc_namespace: string[] = ...
    lc_serializable: boolean = true
    outputKeys: string[]
    regex: string | RegExp

    Accessors

    • get lc_attributes(): undefined | SerializedFields

      Returns undefined | SerializedFields

    Methods

    • Returns string

    • 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.

    • Returns string