Wiki · concept

Structured input and output

Treat LLM calls as “structure in, structure out,” not “text in, text out,” especially where precision and robustness matter.

  • Structure the input. Parse free-text artifacts into clean schemas (JSON) before reasoning over them; this gives the model a clear view and lets you retrieve over structured data instead of raw documents.
  • Require structured output. Have the model fill a schema (Pydantic / structured outputs) rather than answering in prose, so the result plugs into a larger workflow.
  • Make it cite evidence. With structured inputs, ask the model to reference specific evidence ids, which makes outputs verifiable and far easier to debug.
  • Hybrid with analytical AI. Use classic ML for the heavy, deterministic pattern matching (fast, no hallucination) and the LLM for reasoning, explanation, and recommendations.

Structured I/O is the foundation of trustworthy [[evaluation and observability]]: you can only grade what is well-defined, and it is what lets a deterministic workflow (preferred over loose agents) stay consistent.


Sources: 0015-shuaiguo-ten-lessons.md

Edit wiki/structured-input-and-output.md; see how we maintain the wiki.