import { JsonValue } from "../types"; /** * Options for AI-powered JSON fixing */ export interface FixJsonWithAIOptions { /** * The OpenAI API key to use, or undefined to use the value of the OPENAI_API_KEY environment variable */ apiKey?: string; /** * Maximum recursion depth to prevent infinite loops. * @default 2 */ maxDepth?: number; /** * Internal: Current recursion depth. Do not set manually. * @internal */ _depth?: number; } /** * Fixes broken JSON by sending it to the OpenAI gpt-5 model as a chat completion. * The gpt-5 model is a large language model that can understand and generate code, * including JSON. The returned JSON is the fixed version of the input JSON. * If the model fails to return valid JSON, an error is thrown. * * WARNING: This function uses AI and adds cost and latency. Use sparingly. * * @param jsonStr - the broken JSON to fix * @param options - configuration options including API key and recursion limits * @returns the fixed JSON * @throws an error if the model fails to return valid JSON or max depth is exceeded */ export declare function fixJsonWithAI(jsonStr: string, options?: string | FixJsonWithAIOptions): Promise;