import { z, type ZodType } from 'zod'; export type JsonObject = { [Key in string]: JsonValue; } & { [Key in string]?: JsonValue | undefined; }; export type JsonValue = JsonPrimitive | JsonObject | JsonArray; export type JsonPrimitive = string | number | boolean | null; export type JsonArray = JsonValue[] | readonly JsonValue[]; export type SafeParseResult = { success: true; data: TData; } | { success: false; error: string; }; /** * Parses a string which is expected to contain a structured JSON value. * * The JSON value is fuzzily parsed in order to support common issues like * missing commas, trailing commas, and unquoted keys. * * The JSON value is then parsed against a `zod` schema to enforce the shape of * the output. * * @returns parsed output */ export declare function parseStructuredOutput(value: unknown, outputSchema: ZodType): T; export declare function safeParseStructuredOutput(value: unknown, outputSchema: ZodType): SafeParseResult; /** * Extracts JSON objects or arrays from a string. * * @param input - string to extract JSON from * @param jsonStructureType - type of JSON structure to extract * @returns array of extracted JSON objects or arrays */ export declare function extractJSONFromString(input: string, jsonStructureType: 'object' | 'array'): JsonValue[]; /** * Extracts XML content from a string. * * @param input - string to extract XML from * @returns extracted XML content */ export declare function extractXMLFromString(input: string): string; /** * Parses an array output from a string. * * @param output - string to parse * @returns parsed array */ export declare function parseArrayOutput(output: string): JsonValue[]; /** * Parses an object output from a string. * * @param output - string to parse * @returns parsed object */ export declare function parseObjectOutput(output: string): JsonObject; /** * Parses a boolean output from a string. * * @param output - string to parse * @returns parsed boolean */ export declare function parseBooleanOutput(output: string): boolean; /** * Parses a number output from a string. * * @param output - string to parse * @param outputSchema - zod number schema * @returns parsed number */ export declare function parseNumberOutput(output: string, outputSchema: z.ZodNumber): number;