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

  • 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: any

    Returns Promise<any>

    A Promise that resolves to an AgentAction or AgentFinish object.

Generated using TypeDoc