A chat response is often the wrong output shape for a real product task.
If a user asks for a portfolio breakdown, a timeline, or a comparison table, the most useful answer is often a component, not a paragraph. That is the idea behind generative UI: let the model participate in selecting or configuring interface elements, not just generating text.
The important part is control. The model should not invent arbitrary UI. It should choose from a trusted set of components your system already knows how to render safely.
A Better Pattern
Instead of asking an LLM to produce freeform frontend markup, give it a constrained vocabulary: