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

Docs to FAQ Lab

Paste markdown docs - FAQ pairs with generateObject; Redis caches by content hash when configured.

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/docs-to-faq-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.

Docs to FAQ Lab turns markdown into FAQ pairs via generateObject. When Upstash Redis env vars are present, results are cached by SHA-256 of the content with a TTL. Without Redis, every request regenerates (no fabricated cache hits). Missing AI keys return 503.

Features

  • Markdown - FAQ – up to 12 Q/A pairs from capped docs.
  • Redis content-hash cache – TTL cache when Redis is configured.
  • Cache miss transparency – UI shows hit/miss and backend.
  • Sample docs – Redis cache lab snippet.
  • Honest 503 when AI is unavailable.

Server Reference

POST /api/faq

{ "markdown": "# Title\n..." }

Success (200)

{
  "faqs": [{ "question": "...", "answer": "..." }],
  "cached": false,
  "cache": "redis",
  "provider": "ai-gateway",
  "ttlSeconds": 3600
}
StatusCause
503No AI provider
400Empty markdown

Implementation Details

Hash + optional Redis GET

hashContent - experiments:docs-to-faq:<hash>.

generateObject + SET EX

On miss, generate and store with CACHE_TTL_SECONDS.

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/docs-to-faq-lab/. Wire your own persistence and auth as needed.

Deployment

Deploy on Vercel

Local Development

cd apps/experiments/docs-to-faq-lab
pnpm install
pnpm dev

Configuration

VariableRequiredPurpose
AI_GATEWAY_API_KEYYes (or OPENAI_API_KEY)Preferred provider
OPENAI_API_KEYNoFallback
AI_MODELNoModel override
UPSTASH_REDIS_REST_URLNoCache
UPSTASH_REDIS_REST_TOKENNoCache

Vercel / Next.js Features Used

  • AI SDK generateObject
  • Upstash Redis
  • Route Handlers
  • Zod

Next Steps

On this page