import { SerializedNotImplemented } from "../load/serializable.js"; import { InferInteropZodOutput, InteropZodType } from "../utils/types/zod.js"; import { BaseOutputParser, FormatInstructionsOptions } from "./base.js"; import { z } from "zod/v3"; //#region src/output_parsers/structured.d.ts type JsonMarkdownStructuredOutputParserInput = { interpolationDepth?: number; }; interface JsonMarkdownFormatInstructionsOptions extends FormatInstructionsOptions { interpolationDepth?: number; } declare class StructuredOutputParser extends BaseOutputParser> { schema: T; static lc_name(): string; lc_namespace: string[]; toJSON(): SerializedNotImplemented; constructor(schema: T); /** * Creates a new StructuredOutputParser from a Zod schema. * @param schema The Zod schema which the output should match * @returns A new instance of StructuredOutputParser. */ static fromZodSchema(schema: T): StructuredOutputParser; /** * Creates a new StructuredOutputParser from a set of names and * descriptions. * @param schemas An object where each key is a name and each value is a description * @returns A new instance of StructuredOutputParser. */ static fromNamesAndDescriptions(schemas: S): StructuredOutputParser>; /** * Returns a markdown code snippet with a JSON object formatted according * to the schema. * @param options Optional. The options for formatting the instructions * @returns A markdown code snippet with a JSON object formatted according to the schema. */ getFormatInstructions(): string; /** * Parses the given text according to the schema. * @param text The text to parse * @returns The parsed output. */ parse(text: string): Promise>; } /** * A specific type of `StructuredOutputParser` that parses JSON data * formatted as a markdown code snippet. */ declare class JsonMarkdownStructuredOutputParser extends StructuredOutputParser { static lc_name(): string; getFormatInstructions(options?: JsonMarkdownFormatInstructionsOptions): string; private _schemaToInstruction; static fromZodSchema(schema: T): JsonMarkdownStructuredOutputParser; static fromNamesAndDescriptions(schemas: S): JsonMarkdownStructuredOutputParser>; } interface AsymmetricStructuredOutputParserFields { inputSchema: T; } /** * A type of `StructuredOutputParser` that handles asymmetric input and * output schemas. */ declare abstract class AsymmetricStructuredOutputParser extends BaseOutputParser { private structuredInputParser; constructor({ inputSchema }: AsymmetricStructuredOutputParserFields); /** * Processes the parsed input into the desired output format. Must be * implemented by subclasses. * @param input The parsed input * @returns The processed output. */ abstract outputProcessor(input: InferInteropZodOutput): Promise; parse(text: string): Promise; getFormatInstructions(): string; } //#endregion export { AsymmetricStructuredOutputParser, AsymmetricStructuredOutputParserFields, JsonMarkdownFormatInstructionsOptions, JsonMarkdownStructuredOutputParser, JsonMarkdownStructuredOutputParserInput, StructuredOutputParser }; //# sourceMappingURL=structured.d.ts.map