Structured Outputs and Prompts as Code
Free text is great for humans but terrible for code. In this post I show how I get reliable JSON from LLMs with schemas and validation, and why I treat prompts like code: versioned, reviewed and tested.
Posts in this category.
Free text is great for humans but terrible for code. In this post I show how I get reliable JSON from LLMs with schemas and validation, and why I treat prompts like code: versioned, reviewed and tested.
Calling an LLM API is easy. Running it in production is not. These are the backend patterns I use to make AI features reliable, cheap and safe: timeouts, retries, queues, caching and good boundaries.
Every post on this blog has a small chat. You ask a question and the AI answers using the article. In this post I explain how it works: chunks, embeddings, vector search and a good prompt. This technique is called RAG.
AI writes code fast, but your attention is the real limit. Here is how I designed a simple harness with files, git and exit codes, so every task arrives with proof that it works — and I can run two or three tasks at the same time without losing control.
Unit tests expect the same output every time. LLMs don't work like that. Evals are the answer: a set of examples, a way to score the results, and a number you can compare. Here is how I build them.