Class that extends the BaseOutputParser to handle situations where the initial parsing attempt fails. It contains a retryChain for retrying the parsing process in case of a failure.

Type Parameters

  • T

Hierarchy

  • BaseOutputParser<T>
    • OutputFixingParser

Constructors

  • Type Parameters

    • T

    Parameters

    • __namedParameters: {
          parser: BaseOutputParser<T>;
          retryChain: LLMChain<string, LLMType> | Runnable<OutputFixingParserRetryInput, T, RunnableConfig>;
      }
      • parser: BaseOutputParser<T>
      • retryChain: LLMChain<string, LLMType> | Runnable<OutputFixingParserRetryInput, T, RunnableConfig>

    Returns OutputFixingParser<T>

Properties

parser: BaseOutputParser<T>
retryChain: LLMChain<string, LLMType> | Runnable<OutputFixingParserRetryInput, T, RunnableConfig>

Methods

  • Method to get the format instructions for the parser.

    Returns string

    The format instructions for the parser.

  • Method to parse the completion using the parser. If the initial parsing fails, it uses the retryChain to attempt to fix the output and retry the parsing process.

    Parameters

    • completion: string

      The completion to be parsed.

    • Optional callbacks: CallbackManager | (BaseCallbackHandler | BaseCallbackHandlerMethodsClass)[]

      Optional callbacks to be used during parsing.

    Returns Promise<T>

    The parsed output.

  • Static method to create a new instance of OutputFixingParser using a given language model, parser, and optional fields.

    Type Parameters

    • T

    Parameters

    • llm: BaseLanguageModelInterface<any, BaseLanguageModelCallOptions>

      The language model to be used.

    • parser: BaseOutputParser<T>

      The parser to be used.

    • Optional fields: {
          prompt?: BasePromptTemplate<any, BasePromptValueInterface, any>;
      }

      Optional fields which may contain a prompt.

      • Optional prompt?: BasePromptTemplate<any, BasePromptValueInterface, any>

    Returns OutputFixingParser<T>

    A new instance of OutputFixingParser.

Generated using TypeDoc