Skip to main content
All research

Interfaces the model fills in

Summa’s model never writes chart or UI code. It fills in typed blocks that the server checks and the interface renders, computes and cites.

Some answers are easier to use as something other than prose. A price history reads better as a chart, a shopping list works better with checkboxes, and a cost estimate is more useful if you can change the number of seats and see the total move.

There are two common ways to get there. The model writes the interface itself, as HTML, chart code or a Markdown table. Or it hands over data and the application decides how to show it. Summa does the second, strictly. The model calls one tool, create_visualization, with a block type and typed rows. The server validates them, and the interface renders a block it already knows how to draw. This essay is about why we drew the line there, and what we took away from the model along with the drawing.

What goes wrong with the obvious approach

Letting the model write the chart looks flexible. In practice it puts three jobs in the one place least suited to them.

The first is drawing. Generated chart code can be broken or unsafe to run, and every answer looks slightly different. The second is arithmetic. If a cost table shows ten seats at €20 plus a €50 setup fee, the model has to get every row right, every time. A language model does that most of the time, and “most of the time” is not good enough for a total someone acts on. The third is quoting. A table cell that says “30-day notice period” next to a document name looks sourced. Nothing proves it is.

A typed contract takes all three away. The model chooses what kind of block fits and supplies the facts. The interface draws, the interface computes, and the server checks every quote and source against what the run actually read.

One tool, a block type and typed rows

Every block has the same shape: a title, an optional description, a dataset of declared columns and rows, and a view that names the block type. The types are line, bar, area, scatter, pie, table, metrics, timeline, scenario, comparison, checklist, form, evidence and stock_price.

The backend schema is strict. Unknown fields are rejected, infinities and NaN are rejected, and every row must contain exactly the declared columns, with values that match each column’s type. Sizes are bounded: at most 20 columns, 1,000 rows and 8 chart series. Each block type then adds its own rules. A chart series must point at a numeric column. A metrics block needs one row with a value for every card. A timeline needs 1 to 30 entries in date order.

When a call breaks a rule, the model is not just told “invalid arguments”. It gets the failing field paths and the instruction to fix them and call the tool again. A rejected chart turns into a retry rather than an apology in prose.

The frontend checks the same contract a second time, with a Zod schema that mirrors the Pydantic one, both on the live stream and when a saved conversation is opened. Saved blocks are also re-validated on the server when they are loaded. A block that no longer fits the contract is skipped rather than drawn half right.

The interface does the arithmetic

The scenario block is the clearest case. The model supplies line items with three columns: item, unit_rate and fixed_cost. The view adds a label for the quantity, a label for the total, a minimum, a maximum and a starting value. That is all. The model never writes a single computed amount.

The interface renders a slider over that range, and computes each line as you move it:

amount: quantity * Number(row.unit_rate) + Number(row.fixed_cost)

The total is the sum of the lines, formatted in the block’s currency or number format for your locale. The model’s prompt says it in one line: the block “computes quantity × rate + fixed cost; use consistent units.” The model’s part is to get the rates right and keep the units consistent. The multiplication belongs to code that does it the same way every time, for any position of the slider, including positions the model never thought about.

Unknown is a value, not a gap to fill

A comparison block compares 2 to 6 options across at most 12 criteria, one row per option and criterion. Each row has a claim and a source_ref. The rule that matters is that both are null together or both are filled. A claim without a source is rejected. So is a source without a claim.

Null means unknown, and the interface shows it as “Unknown”. This gives the model an honest move when it could not find a fact. Without it, a model asked to fill a grid tends to fill it, and a plausible guess in a neat table looks exactly like a researched fact.

A filled cell needs a source the run was actually given: a web result it fetched, a passage it read, or a document. The tool checks each source_ref against the run’s own tables, and returns invalid_source if one was never issued. How those run-scoped refs work is covered in The model never sees an ID. Here it is enough that the citation chip under each cell is built from stored rows, not from anything the model wrote. If the source cannot be shown, the interface shows the cell as unknown rather than as an unsourced claim.

A quote has to be found, not written

The evidence block pairs a finding with a verbatim excerpt from a document passage, up to eight findings per block. Before the block is accepted, the tool looks up the passage behind source_ref and checks that the excerpt actually occurs in it. Whitespace is normalised on both sides, so a line break in the source does not count as a difference. Everything else must match. An excerpt that does not appear in an issued passage fails with invalid_source and the message “Use a verbatim excerpt from an issued passage ref.”

One of the tests shows the point. The passage says the term is 30 days. A block quoting “The term is 90 days” is rejected, and the real sentence is accepted. A quote with one wrong number is exactly the error a reader would never catch.

Prices come from a source, not a story

The stock_price block is narrow on purpose. It takes a symbol, an exchange, an ISO currency code, a price kind (close, adjusted_close, last_trade or quote) and a web source ref. The rows are observed_at and price, and the rules depend on the kind. A quote or last trade is exactly one observation. A last trade needs a timestamp with an explicit time zone. Closing prices need unique dates in ascending order. Every price must be positive.

The source ref must be a web source this run fetched, or the call fails. When it succeeds, the tool tells the model to cite that source in the prose next to the chart.

The prompt adds rules the schema cannot check: keep currency and price basis consistent, label delays, and never infer prices from milestones. A timeline of company events can sit next to the price, as its own block. It never becomes price data.

The interface labels what kind of price it is showing, such as “Reported quote” or “Closing price”, with the date or time of the observation. Period buttons for 7, 30, 90 and 365 days appear only when there is enough history for them to change what you see.

Asking now and asking later are different tools

Two tools collect input from the user, and the prompt keeps them apart.

ask_user_question stops the run. It offers three options and an optional free-text answer, and the run waits until the person answers. It is for questions where the answer would change the response and cannot be assumed.

A form block is for after a useful answer. It holds up to six fields, each with either free text or 2 to 6 choices. Submitting it sends your answers as a new message in the conversation, prefixed with the block’s title. Nothing waits on it. The form only accepts a submission when a new reply could be started anyway, so it cannot slip a message into a running turn or past a pending question.

Lists get a default too. The prompt makes checklist the default for grocery, packing and to-do lists, “even when the user only says ‘list’”, unless plain text is requested. Ticking items off is the only state, and it stays in your browser, for saved conversations only, as row positions and never as the item text.

The model places the block, the interface draws it

A block is useful next to the sentence that talks about it, not after the whole answer. So when a call succeeds, the tool returns a placement marker such as [[chart:1]] and tells the model to put it on its own line where the block should appear.

The marker is a counter within the run, not the block’s UUID, because the model has to reproduce the token exactly and it will not reliably copy a UUID.

The rest assumes the model will sometimes get it wrong. While the answer streams, a half-written marker is held back so the reader never sees stray brackets. The frontend splits the answer on markers, and also removes invented ones and bare view names such as [[timeline]], so tool syntax never reaches the screen. A block the model forgot to place is held back while the answer is still being written, then added after the text when the run ends.

Copying keeps the meaning

Because blocks are typed data, they can also be turned back into text. Each block has its own copy button, and copying the whole answer replaces every marker with a readable version of its block.

Charts and tables become Markdown tables, with values formatted as they are on screen. A comparison becomes a table with its citations written out. Evidence becomes the finding, the quote and its source. A checklist copies with your ticks as [x], and a scenario copies with the quantity you last set on the slider, not the one the model chose. A pasted answer says what the person saw.

The data behind charts and tables can also be downloaded as CSV. Text cells that start with =, +, - or @ get a leading apostrophe, so a spreadsheet does not read them as formulas.

What it costs

  • A fixed vocabulary. The model can only produce block types we built. A new kind of visual needs a schema on both sides, a renderer and prompt guidance. That is slower than letting the model draw anything.
  • Two schemas to keep in step. The Pydantic and Zod contracts describe the same rules in two languages. If they drift, a block the server accepts can be skipped in the browser.
  • Failures cost a turn. A rejected block, a quote with one wrong word, or an unissued source sends the model back for another tool call. That is the intended outcome, and still time and tokens.
  • Blocks can disappear. If a source behind a comparison or evidence block is no longer citable when the answer is finalised, for example after access changed during a paused run, the saved answer drops the run’s blocks rather than showing them without their sources.
  • The model still chooses the inputs. The interface computes a scenario total correctly from the rates it is given. If the model reads a price list wrong, the arithmetic will be right and the answer wrong.

What we would generalise

  • Let the model choose, not draw. Give it a small set of typed blocks and let it pick one and fill it in. Drawing is the application’s job.
  • Move arithmetic into the interface. Anything that can be computed from the data should be computed by code, in front of the user, where they can change the inputs.
  • Make “unknown” a valid value. If a structure has to be complete, the model will complete it. Give it a way to say it does not know, and show that clearly.
  • Check quotes against the source, not against plausibility. A verbatim excerpt is cheap to verify, and a near-miss is the error people never spot.
  • Validate at both ends. The server checks what the model sent. The interface checks what it is about to draw, including blocks saved long ago.
  • Keep the data behind the picture. Typed blocks can be copied, downloaded and re-read. A drawn image or generated code cannot.