"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parser = void 0;
const output_parsers_1 = require("langchain/output_parsers");
const zod_1 = require("zod");
/**
 * Structured Output Parser
 * Ensures LLM response follows the format:
 * {
 *   extracted_data: Record<string, any>  // Data matching the provided schema
 *   confidence_level: number              // 0-100 indicating extraction reliability
 *   extraction_explanation: string        // Brief explanation of the extraction
 * }
 */
const parseStructuredDataSchema = zod_1.z.object({
    extracted_data: zod_1.z
        .record(zod_1.z.any())
        .describe('Extracted data matching the schema'),
    confidence_level: zod_1.z
        .number()
        .min(0)
        .max(100)
        .describe('Confidence level of the extraction (0-100)'),
    extraction_explanation: zod_1.z
        .string()
        .describe('Brief explanation of the extraction process'),
});
exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(parseStructuredDataSchema);
//# sourceMappingURL=parser.js.map