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

Contract Clause Finder

Paste a short contract or upload a PDF - structured risk clauses, obligations, and dates table via generateObject.

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/contract-clause-finder
pnpm install
pnpm dev

Then open http://localhost:3010.

This is an experimental demo. Use it as a starting point for your own projects. Outputs are not legal advice.

Contract Clause Finder accepts pasted contract text or a .pdf / .txt upload (unpdf for PDFs), then uses generateObject to return up to 24 rows classified as risk, obligation, date, or other. The UI renders a table and can export JSON. No AI keys - 503.

Features

  • Paste or PDF – multipart upload or JSON { text }.
  • Structured table – kind, title, summary, party, deadline.
  • Export JSON – download { clauses: [...] }.
  • Sample MSA – payment, liability, termination, confidentiality.
  • Honest unavailable state.

Server Reference

POST /api/clauses

Multipart: text, optional file. Or JSON { "text": "..." }.

Success (200)

{
  "clauses": [
    {
      "kind": "obligation",
      "title": "Payment terms",
      "summary": "Customer pays within 30 days.",
      "excerpt": "Customer shall pay invoices within thirty (30) days",
      "party": "Customer",
      "dateOrDeadline": "30 days of receipt"
    }
  ],
  "charsUsed": 1200,
  "provider": "ai-gateway"
}
StatusCause
503No AI provider
400Empty source / bad PDF

Implementation Details

Extract text

unpdf for PDFs; truncateText caps at ~20k chars.

generateObject + clamp

Zod schema + clampClauses trims excerpts and caps rows at 24.

Use Cases

  • Quick triage of short vendor MSAs.
  • Teach document - table composition with generateObject.
  • Export clause JSON into review checklists.

Limitations

  • Not legal advice; image-only PDFs fail extraction.
  • Long agreements are truncated.
  • No auth / rate limits.

Use in your project

Copy the multipart extract + generateObject pattern from app/api/clauses/route.ts. Persist rows to Neon or Blob as needed.

Deployment

Deploy on Vercel

Local Development

cd apps/experiments/contract-clause-finder
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
  • Vercel AI Gateway
  • Route Handlers
  • unpdf
  • Zod

Next Steps

On this page