Generative UI with Lyra Gen

Model answers that render as real, validated Lyra controls.

Lyra Gen turns a model’s structured answer into accessible Lyra components through a reviewed catalog. Generated content can only name catalog roles, never arbitrary tags, scripts or actions; your application keeps the model request, data, actions and storage.

Try a request

  • Show my monthly spending
    • Why is dining so high?
      • Set a dining limit
      • Warn me before I overspend
    • Compare with last year
      • What grew the most?
      • Project the rest of the year
    • Where can I save?
      • Cancel the ones I barely use
      • Set a savings goal
  • How is my shop doing?
    • Where do people drop off?
      • Win back abandoned carts
      • Mobile vs desktop
    • Which countries are growing?
      • Zoom into the fastest grower
      • Plan a launch in a new country
    • What sells best?
      • Restock the top sellers
      • Bundle the top two
  • When is my café busiest?
    • Just Saturdays
      • Add a second barista at the peak
      • Compare with Sunday
    • Compare with last month
      • Why did Tuesday drop?
      • Show the last 6 months
    • When am I short-staffed?
      • Plan next week’s staff
      • Should I open earlier?

Example

Select a reviewed catalog subset, then validate a generated view before rendering it.

import '@aceshooting/lyra-ui/theme.css';
import { initialCatalog, subsetCatalog } from '@aceshooting/lyra-gen/catalog.js';
import { validateView } from '@aceshooting/lyra-gen/runtime.js';
import { LyraGenViewElement } from '@aceshooting/lyra-gen/gen-view.js';

const selected = subsetCatalog(initialCatalog, ['stack', 'heading', 'text']);
if (!selected.ok) throw new Error('The requested catalog is unavailable.');
const catalog = selected.value;
const result = validateView({
  version: '1', catalog: { id: catalog.id, version: catalog.version },
  surfaceId: 'answer-1', revision: 0,
  root: { id: 'summary', type: 'stack', children: [
    { id: 'title', type: 'heading', text: 'Quarterly summary' },
    { id: 'detail', type: 'text', text: 'Revenue increased this quarter.' },
  ] },
}, catalog);
if (!result.ok) throw new Error('The generated view was rejected.');

const view = new LyraGenViewElement();
view.catalog = catalog;
view.document = result.value;
document.body.append(view);

Browse components · Read guide (English)