This site is not affiliated with or endorsed by Vercel, Inc. Read the docs, then deploy or run each experiment yourself.
AI

CSV Insight Lab

Paste or upload CSV (max 50 rows) - parse locally, then generateObject insights and chartReady aggregates without inventing rows.

Run this experiment yourself

Demos are not embedded on this site. Deploy a standalone copy on Vercel or run the experiment app locally.

Local development

cd apps/experiments/csv-insight-lab
pnpm install
pnpm dev

Then open http://localhost:3010.

This is an experimental demo. Use it as a starting point for your own projects.

CSV Insight Lab parses CSV in logic.ts (max 50 data rows), builds chartReady aggregates from numeric columns, then calls generateObject for insights grounded only in those rows. The model is instructed never to invent rows. Missing AI keys return 503.

Features

  • Local CSV parse – quoted fields, row cap.
  • chartReady aggregates – from parsed numeric columns only.
  • Insights + caveats – generateObject schema.
  • Sample sales CSV – product / units / revenue.
  • Honest 503 when AI is unavailable.

Server Reference

POST /api/insights

JSON { "csv": "..." } or multipart with csv + optional file.

Success (200)

{
  "insights": ["Units peak on Blob Drop"],
  "caveats": ["Only 5 rows"],
  "chartReady": [{ "label": "Blob Drop", "value": 200 }],
  "rowCount": 5,
  "provider": "ai-gateway"
}
StatusCause
503No AI provider
400Missing header/data rows

Implementation Details

parseCsv + numericColumnAggregates

Pure helpers; aggregates never invent values.

generateObject

Prompt includes the parsed preview only.

Use Cases

  • Learn composition patterns for this lab’s stack.
  • Prototype before wiring production auth and quotas.
  • Deploy the standalone app as a reference implementation.

Limitations

  • Demo-scale caps on input size and output counts.
  • No auth / rate limits on public deploys.
  • Model quality depends on input clarity.

Use in your project

Copy the Route Handler and logic.ts helpers from apps/experiments/csv-insight-lab/. Wire your own persistence and auth as needed.

Deployment

Deploy on Vercel

Local Development

cd apps/experiments/csv-insight-lab
pnpm install
pnpm dev

Configuration

VariableRequiredPurpose
AI_GATEWAY_API_KEYYes (or OPENAI_API_KEY)Preferred provider
OPENAI_API_KEYNoFallback
AI_MODELNoModel override

Vercel / Next.js Features Used

  • AI SDK generateObject
  • Route Handlers
  • Zod

Next Steps

On this page