langchain.js
    Preparing search index...

    Class StructuredOutputParser<T>

    LangChain Messages

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    • Type Parameters

      • T extends InteropZodType

      Parameters

      • schema: T

      Returns StructuredOutputParser<T>

    Properties

    lc_namespace: string[] = ...
    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<InferInteropZodOutput<T>>

      The parsed output.

    • Returns any

    • 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]: ZodString },
              "strip",
              ZodTypeAny,
              { [key: string]: string },
              { [key: string]: string },
          >,
      >

      A new instance of StructuredOutputParser.

    • Creates a new StructuredOutputParser from a Zod schema.

      Type Parameters

      • T extends InteropZodType

      Parameters

      • schema: T

        The Zod schema which the output should match

      Returns StructuredOutputParser<T>

      A new instance of StructuredOutputParser.

    • Returns string