Write a system prompt and code in [language] that makes an LLM extract [fields] from [input type] as valid JSON matching this schema: [schema]. Include validation, a retry if parsing fails, and handling for missing data.
Prompt for structured JSON output from an LLM
Reliably gets valid JSON from an AI model in your app.