import { z } from 'zod'; import type * as t from '@/types'; import { Providers } from '@/common'; /** * Validation result from structured output */ export interface ValidationResult> { success: boolean; data?: T; error?: string; raw?: unknown; } /** * Validates structured output against a JSON Schema. * * @param output - The output to validate * @param schema - JSON Schema to validate against * @returns Validation result with success flag and data or error */ export declare function validateStructuredOutput(output: unknown, schema: Record): ValidationResult; /** * Converts a Zod schema to JSON Schema format. * This is a simplified converter for common types. */ export declare function zodToJsonSchema(zodSchema: z.ZodType): Record; /** * Creates a structured output error message for retry. */ export declare function createValidationErrorMessage(result: ValidationResult, customMessage?: string): string; /** * Checks if a value is a valid JSON Schema object. */ export declare function isValidJsonSchema(value: unknown): value is Record; /** * Normalizes a JSON Schema by adding defaults and cleaning up. */ export declare function normalizeJsonSchema(schema: Record, config?: t.StructuredOutputConfig): Record; /** * Result from schema preparation, includes the prepared schema and any warnings. */ export interface SchemaPreparationResult { schema: Record; warnings: string[]; } /** * Prepares a JSON Schema for a specific provider's native structured output API. * * This function normalizes the schema to comply with provider-specific requirements: * - Adds `additionalProperties: false` recursively to all objects (required by all providers in strict mode) * - Ensures all properties are listed in `required` (required by OpenAI and Anthropic) * - Strips unsupported constraint keywords (minimum, maxLength, etc.) and moves them to description * - Returns warnings for any modifications made * * @param schema - The original JSON Schema * @param provider - The LLM provider * @param strict - Whether strict mode is enabled (default: true) * @returns The prepared schema and any warnings */ export declare function prepareSchemaForProvider(schema: Record, provider: Providers | string, strict?: boolean): SchemaPreparationResult;