Class StructuredOutputParser<T>

Type Parameters

  • T extends z.ZodTypeAny

Hierarchy

Constructors

  • Type Parameters

    • T extends ZodType<any, any, any, T>

    Parameters

    • schema: T

    Returns StructuredOutputParser<T>

Properties

schema: T

Methods

  • Returns a markdown code snippet with a JSON object formatted according to the schema.

    Returns string

    A markdown code snippet with a JSON object formatted according to the schema.

  • Parses the given text according to the schema.

    Parameters

    • text: string

      The text to parse

    Returns Promise<TypeOf<T>>

    The parsed output.

  • Returns SerializedNotImplemented

  • Creates a new StructuredOutputParser from a set of names and descriptions.

    Type Parameters

    • S extends {
          [key: string]: string;
      }

    Parameters

    • schemas: S

      An object where each key is a name and each value is a description

    Returns StructuredOutputParser<ZodObject<{
        [k: string]: T;
    }, "strip", ZodTypeAny, {}, {}>>

    A new instance of StructuredOutputParser.

  • Creates a new StructuredOutputParser from a Zod schema.

    Type Parameters

    • T extends ZodType<any, any, any, T>

    Parameters

    • schema: T

      The Zod schema which the output should match

    Returns StructuredOutputParser<T>

    A new instance of StructuredOutputParser.

Generated using TypeDoc