Skip to slide
081 / 221

CH 06 · Prompt Architecture · 03/10

Read as one page

Emitted protocols: the model's structured output channel

The most powerful prompt-architecture idea is to define a structured format that the model emits and your code parses deterministically. Rather than trying to extract meaning from free-form prose ("did it cite anything?"), instruct the model to append a strict, machine-readable block, then parse it.

Examples of emitted protocols:

  • A trailing JSON block of citations, each mapping an inline marker to a source, page, and verbatim quote.
  • Inline tagged values like [[Yes]], [[USD]], or [[page:3||quote:...]] that your code reliably extracts.
  • A marker convention that triggers behaviour (a message prefix that means "apply this template").

The pattern is always: the model produces structure, your code consumes it. This turns the model from a prose generator into a structured-data source you can build features on (clickable citations, typed spreadsheet cells, triggered workflows). Define the protocol precisely, give an example, and parse it with a simple, deterministic parser (a regex or JSON parse), not another model call.

When you stream output to a user, remember to hide the protocol from the visible stream: buffer just enough to detect the block boundary so the user sees clean prose while your code still gets the structured trailer. (Chapter 8.)

Finished this idea?

Your learning progress stays in this browser.