A class that provides a wrapper around the StructuredChatOutputParser and OutputFixingParser classes. It extends the AgentActionOutputParser class and allows for retrying the output parsing using the OutputFixingParser if it is provided.

Example

const outputParser = new StructuredChatOutputParserWithRetries.fromLLM(
new ChatOpenAI({ temperature: 0 }),
{
toolNames: ["calculator", "random-number-generator"],
},
);
const result = await outputParser.parse(
"What is a random number between 5 and 10 raised to the second power?"
);

Hierarchy (view full)

Constructors

Methods

  • Returns the format instructions for parsing the output of an agent action in the style of the StructuredChatAgent.

    Returns string

    A string representing the format instructions.

  • Parses the given text and returns an AgentAction or AgentFinish object. Throws an OutputParserException if the parsing fails.

    Parameters

    • text: string

      The text to parse.

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

    Returns Promise<AgentAction | AgentFinish>

    A Promise that resolves to an AgentAction or AgentFinish object.

Generated using TypeDoc