CHAPTER 03 · Tool Design · 7 / 11
Structured input for deterministic output
When a tool produces formatted output (a document, a spreadsheet), prefer structured input over free text. Instead of "generate a contract" taking a blob of prose, have it take an array of sections with headings, levels, and tables. Then your code applies the formatting deterministically. This:
- moves formatting from the unreliable model to reliable code,
- lets you enforce house style/numbering/branding,
- and makes the model responsible only for content.
Tell the model what not to do (don't type the numbers, don't repeat the title) because your generator handles those. This division, model decides content, code decides format, is one of the most reliable patterns for producing polished artifacts.