UNPKG

@langchain/core

Version:
32 lines (31 loc) 1.89 kB
import { InteropZodType } from "./types/zod.js"; import { JsonSchema7ArrayType } from "./zod-to-json-schema/parsers/array.js"; import { JsonSchema7NumberType } from "./zod-to-json-schema/parsers/number.js"; import { JsonSchema7StringType } from "./zod-to-json-schema/parsers/string.js"; import { JsonSchema7NullableType } from "./zod-to-json-schema/parsers/nullable.js"; import { JsonSchema7ObjectType } from "./zod-to-json-schema/parsers/object.js"; import { JsonSchema7Type } from "./zod-to-json-schema/parseTypes.js"; import { Validator, deepCompareStrict } from "@cfworker/json-schema"; //#region src/utils/json_schema.d.ts /** * Converts a Zod schema or JSON schema to a JSON schema. * @param schema - The schema to convert. * @returns The converted schema. */ declare function toJsonSchema(schema: InteropZodType | JsonSchema7Type): JsonSchema7Type; /** * Validates if a JSON schema validates only strings. May return false negatives in some edge cases * (like recursive or unresolvable refs). * * @param schema - The schema to validate. * @returns `true` if the schema validates only strings, `false` otherwise. */ declare function validatesOnlyStrings(schema: unknown): boolean; // Re-export of the types used throughout langchain for json schema serialization. // The plan is to eventually nix zod-to-json-schema altogether in place for // zod v4 / a more standardized way of serializing validated inputs, so its re-exported // here to remove the dependency on zod-to-json-schema in downstream packages until // a determination is made. //#endregion export { type JsonSchema7Type as JSONSchema, type JsonSchema7ArrayType, type JsonSchema7NullableType, type JsonSchema7NumberType, type JsonSchema7ObjectType, type JsonSchema7StringType, type JsonSchema7Type, Validator, deepCompareStrict, toJsonSchema, validatesOnlyStrings }; //# sourceMappingURL=json_schema.d.ts.map