@langchain/core
Version:
Core LangChain.js abstractions and schemas
1 lines • 6.25 kB
Source Map (JSON)
{"version":3,"file":"structured.d.cts","names":["z","BaseOutputParser","FormatInstructionsOptions","InteropZodType","InferInteropZodOutput","JsonMarkdownStructuredOutputParserInput","JsonMarkdownFormatInstructionsOptions","StructuredOutputParser","T","___load_serializable_js0","SerializedNotImplemented","S","ZodString","ZodTypeAny","ZodObject","Promise","JsonMarkdownStructuredOutputParser","AsymmetricStructuredOutputParserFields","AsymmetricStructuredOutputParser","Y","inputSchema"],"sources":["../../src/output_parsers/structured.d.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { BaseOutputParser, FormatInstructionsOptions } from \"./base.js\";\nimport { type InteropZodType, type InferInteropZodOutput } from \"../utils/types/zod.js\";\nexport type JsonMarkdownStructuredOutputParserInput = {\n interpolationDepth?: number;\n};\nexport interface JsonMarkdownFormatInstructionsOptions extends FormatInstructionsOptions {\n interpolationDepth?: number;\n}\nexport declare class StructuredOutputParser<T extends InteropZodType> extends BaseOutputParser<InferInteropZodOutput<T>> {\n schema: T;\n static lc_name(): string;\n lc_namespace: string[];\n toJSON(): import(\"../load/serializable.js\").SerializedNotImplemented;\n constructor(schema: T);\n /**\n * Creates a new StructuredOutputParser from a Zod schema.\n * @param schema The Zod schema which the output should match\n * @returns A new instance of StructuredOutputParser.\n */\n static fromZodSchema<T extends InteropZodType>(schema: T): StructuredOutputParser<T>;\n /**\n * Creates a new StructuredOutputParser from a set of names and\n * descriptions.\n * @param schemas An object where each key is a name and each value is a description\n * @returns A new instance of StructuredOutputParser.\n */\n static fromNamesAndDescriptions<S extends {\n [key: string]: string;\n }>(schemas: S): StructuredOutputParser<z.ZodObject<{\n [k: string]: z.ZodString;\n }, \"strip\", z.ZodTypeAny, {\n [x: string]: string;\n }, {\n [x: string]: string;\n }>>;\n /**\n * Returns a markdown code snippet with a JSON object formatted according\n * to the schema.\n * @param options Optional. The options for formatting the instructions\n * @returns A markdown code snippet with a JSON object formatted according to the schema.\n */\n getFormatInstructions(): string;\n /**\n * Parses the given text according to the schema.\n * @param text The text to parse\n * @returns The parsed output.\n */\n parse(text: string): Promise<InferInteropZodOutput<T>>;\n}\n/**\n * A specific type of `StructuredOutputParser` that parses JSON data\n * formatted as a markdown code snippet.\n */\nexport declare class JsonMarkdownStructuredOutputParser<T extends InteropZodType> extends StructuredOutputParser<T> {\n static lc_name(): string;\n getFormatInstructions(options?: JsonMarkdownFormatInstructionsOptions): string;\n private _schemaToInstruction;\n static fromZodSchema<T extends InteropZodType>(schema: T): JsonMarkdownStructuredOutputParser<T>;\n static fromNamesAndDescriptions<S extends {\n [key: string]: string;\n }>(schemas: S): JsonMarkdownStructuredOutputParser<z.ZodObject<{\n [k: string]: z.ZodString;\n }, \"strip\", z.ZodTypeAny, {\n [x: string]: string;\n }, {\n [x: string]: string;\n }>>;\n}\nexport interface AsymmetricStructuredOutputParserFields<T extends InteropZodType> {\n inputSchema: T;\n}\n/**\n * A type of `StructuredOutputParser` that handles asymmetric input and\n * output schemas.\n */\nexport declare abstract class AsymmetricStructuredOutputParser<T extends InteropZodType, Y = unknown> extends BaseOutputParser<Y> {\n private structuredInputParser;\n constructor({ inputSchema }: AsymmetricStructuredOutputParserFields<T>);\n /**\n * Processes the parsed input into the desired output format. Must be\n * implemented by subclasses.\n * @param input The parsed input\n * @returns The processed output.\n */\n abstract outputProcessor(input: InferInteropZodOutput<T>): Promise<Y>;\n parse(text: string): Promise<Y>;\n getFormatInstructions(): string;\n}\n"],"mappings":";;;;;;KAGYK,uCAAAA;;;AAAAA,UAGKC,qCAAAA,SAA8CJ,yBAHZ,CAAA;EAGlCI,kBAAAA,CAAAA,EAAAA,MAAAA;AAGjB;AAA2C,cAAtBC,sBAAsB,CAAA,UAAWJ,cAAX,CAAA,SAAmCF,gBAAnC,CAAoDG,qBAApD,CAA0EI,CAA1E,CAAA,CAAA,CAAA;EAAA,MAAWL,EAC1CK,CAD0CL;EAAc,OAAiDK,OAAAA,CAAAA,CAAAA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