import { z } from 'zod'; // Define the schema for a single product const productSchema = z.object({ name: z.string().describe('The name of the product.'), price: z.number().positive().describe('The price of the product, as a positive number.'), currency: z.string().length(3).describe('The 3-letter currency code (e.g., USD, EUR).'), description: "z.string().optional().describe('A brief description of the product.')," features: z.array(z.string()).min(1).optional().describe('A list of key features.'), imageUrl: z.string().url().optional().describe('The absolute URL to the product image.'), }); // Define the schema for the entire extraction, which might be an array of products const extractionSchema = z.object({ products: z.array(productSchema).min(1).describe('An array of extracted product details.'), }); type ExtractedProducts = z.infer; // This schema is then passed to the extractor, along with the Markdown content.