Steps
ui:stepsDescale a kettle
- Fill halfwayEqual parts white vinegar and water.
- Boil, then wait · 20 minSwitch it off and leave it to soak.
- Rinse twiceBoil plain water once to clear the smell.
GenUI lets a model answer with a component where the content has a shape: steps for a procedure, a chart for a series of numbers, a checklist to tick off. The reply stays Markdown, each component draws while it streams, and any model that streams text can write one.
npm i @nakshi/genui-blocks @nakshi/genui-reactRecipe for banana pancakes, please.
Real replies from the benchmark, replayed at the speed they streamed, with the wait for the first token cut. Switch to Markdown to see what the model wrote.
What it does
Many generative UI systems ask the model for a tree of components. GenUI asks for an answer, and lets the shape of the content pick the component.
A reply is text with blocks in it, not a tree of JSON. Every block has a plain-text form, so the same reply reads well in Telegram, an SMS or a copy button.
Finished steps, rows and items appear while the model is still writing the block. A chart waits for its last point, so it never draws a wrong line.
Unclosed brackets, a missing call, Bangla digits, an amount written “2,500”: repaired before the schema check. Long text is clipped rather than rejected.
A zod schema, a streaming rule and a line on when to use it. From those the catalog writes the model's guide, the parser, the text form and the figure check.
No tool calls, no JSON mode, no special API. Blocks are text, so any model that streams can write them, and the benchmark shows how well each does.
Chart and stat figures are matched against the sources the turn read. ungroundedFigures lists every figure that no source states.
Components
Each is a block definition in @nakshi/genui-blocks and a view in its React entry. These are live: tick the checklist, change the servings, hover the chart. Restyle them with CSS variables, or write your own.
ui:stepsDescale a kettle
ui:chart| First block | |
|---|---|
| gpt-6-luna | 1.9 |
| DeepSeek V4 | 2 |
| gpt-5.6-luna | 2.5 |
| gpt-6.1-sol | 3.5 |
| GLM 5.2 | 4 |
genui-bench, 96 replies each
ui:checklistPicnic
0 of 5 done
ui:recipeOvernight oats
ui:calloutui:statsCommuter survey, 2025
ui:compare| Train | Bus | |
|---|---|---|
| Time | 2 h 10 · best | 3 h 40 |
| Fare | $48 | $19 · best |
| Wi-Fi | Yes · best | Some routes |
ui:tabsRun brew install node.
ui:cardsFree, and about 25 minutes.
Ten minutes door to door.
Fifteen minutes, every eight.
ui:accordionWithin five working days of the item arriving.
We do, when the item is faulty.
ui:codeexport function Reply({ text }: { text: string }) {
return <Answer catalog={catalog} text={text} views={defaultViews} />;
}How it works
One catalog does the work on both sides of the model: it writes what the model reads, and reads what the model writes.
Markdown, with a fenced block where the content has a shape.
Markdown and blocks, on any prefix of the stream.
Brackets mended, digits and amounts read, names restored.
Against the block's zod schema: it fits, or it reads as text.
By the block's view, item by item; or as text where there are no views.
Start from the eleven defaults and add your own. A block is a schema, a line on when to use it, and its text form; its signature for the guide is generated from the schema.
import { createCatalog, defineBlock } from '@nakshi/genui';
import { defaultBlocks } from '@nakshi/genui-blocks';
import { z } from 'zod';
const flight = defineBlock({
type: 'flight',
schema: z.object({
from: z.string(),
to: z.string(),
departs: z.string(),
}),
guide: { use: 'one flight the person asked about.' },
toText: (f) => `${f.from} → ${f.to}, ${f.departs}`,
});
export const catalog = createCatalog({
prefix: 'ui',
blocks: [...defaultBlocks, flight],
});The guide holds one line per block, worked examples, and a check to run before answering. Put it in the system prompt, and the short reminder last in the turn, where a long thread cannot bury it.
import { defaultGuide } from '@nakshi/genui-blocks';
const messages = [
{ role: 'system', content: defaultGuide(catalog) },
...conversation,
{ role: 'system', content: catalog.reminder() },
];Re-render with more text as tokens arrive. Each block is drawn by its view as soon as it has something true to show; the Markdown around it goes to your renderer.
import { Answer } from '@nakshi/genui-react';
import { defaultViews } from '@nakshi/genui-blocks/react';
export function Reply({ text }: { text: string }) {
return (
<Answer
catalog={catalog}
text={text}
views={{ ...defaultViews, flight: FlightView }}
/>
);
}Channels without components get the reply as text. Before you show figures, check them against what the turn read.
import { ungroundedFigures } from '@nakshi/genui';
// Telegram, SMS, a voice answer
const text = catalog.toText(reply);
// Chart and stat figures that no source states
const figures = catalog.figures(reply);
const unsupported = ungroundedFigures(figures, sources);Benchmark
genui-bench runs the 32 public cases in @nakshi/genui-eval three times per model: how-tos, processes, checklists, recipes, figures with their sources, comparisons, options, warnings, sections, and seven questions that should get no component at all. A reply passes when it uses the component the case calls for (or none), every block reads and closes, and it does not open with a block.
| Model | Passed | Broken block | First words | First block | Cost |
|---|---|---|---|---|---|
| gpt-6.1-sol | 98% | 0% | 1.4 s | 3.5 s | $0.34 |
| gpt-6-luna | 94% | 1% | 1.3 s | 1.9 s | $0.02 |
| GLM 5.2 | 91% | 1% | 2.8 s | 4.0 s | $0.06 |
| gpt-5.6-luna | 88% | 1% | 1.1 s | 2.5 s | $0.04 |
| DeepSeek V4 Flash | 84% | 0% | 0.6 s | 2.0 s | $0.05 |
27 November 2026. The default blocks and guide, each model at its default sampling; 96 replies per model. Times are medians from the request; cost is for all 96. Claude models are not in this run.
32% → 1%
Blocks from gpt-6-luna that needed a repair, without the guide's worked examples and with them. Models copy the shape of an example more than they follow a rule, so the default guide ships three, one of them with no block at all.
49%
Of GLM 5.2's blocks read only because a repair fixed a slip first: an unclosed bracket, a missing call, a list without its name. It still passed 91%. Without repairs, half its blocks would have shown as text.
14% → 1%
Replies from gpt-5.6-luna with a broken block, when schemas rejected text over a length and when they clipped it. The same replies, scored twice: the only difference is the schemas.
Packages
Take only what you need. The core has no framework in it; React is one binding, and the components and the benchmark sit on top.
Core
Define a block once. The catalog writes the guide, splits a streaming reply, reads each block with repairs, gives the answer as text, and lists its figures for checking. No framework, any model.
npm install @nakshi/genuiReact
Draws a reply as it streams: Markdown by your renderer, each block by its view, finished items while the block is still open.
npm install @nakshi/genui-reactComponents
Eleven blocks with plain, accessible views that take their look from your page, and the guide with worked examples.
npm install @nakshi/genui-blocksBenchmark
The public cases and the scorer: whether a model picks the right block, whether every block reads, and how soon the first one can be drawn.
npm install @nakshi/genui-evalIn production
Nakshi's own catalog holds 31 block types under the nakshi: prefix, from diagrams to maps and calculators, and the guide its models read is compiled from it. When we moved Nakshi onto the core, we checked that it read every block exactly as before, at every point of every stream.
Research
The cases and the scorer ship as @nakshi/genui-eval. Run them against your model, your guide or your own catalog, and you get the same measures as the table above.
import { cases, runEval } from '@nakshi/genui-eval';
const { summary } = await runEval({
catalog,
cases, // the 32 public cases
repeat: 3,
// Your model: any AsyncIterable<string> of the reply
generate: (prompt) => yourModel.stream(prompt),
});
console.log(summary.overall);