PatternsTools & Utilities

AI Profile Enrichment Form

Loading pattern preview

Loading preview…

Problems solved

Technical challenges this implementation handles out of the box.
  • Enrich sparse profile forms into fuller structured profiles
  • Generate missing profile fields with generateObject
  • Let users review AI enrichments before accepting them

Use cases

Products and workflows this pattern is designed to support.
  • CRM lead enrichment forms
  • User onboarding profile completion
  • Directory listing intake forms
  • Marketplace seller profile builders

Setup

Requirements, wiring steps, and what this pattern adds to your project.

Getting started

Pick how you want to pull this pattern in — then wire env vars and routes the same way.

  1. 1

    Install from the preview toolbar

    Shadcn Icon

    Copy the install command above and run it in your project — Pro patterns include a short-lived token.

  2. 2

    Add environment variables to .env.local

    OPENAI_API_KEY

  3. 3

    Customize the agent and tool files

    Adapt prompts, tools, and stop conditions for your product — Copy for AI in the toolbar helps seed that work.

  4. 4

    Run your dev server and open the pattern route

    Install dependencies if needed, then start the app and verify responses.

Environment variables

Capabilities

AI SDK APIs

streamObjectcreateStreamableValue

Providers

OpenAI

External services

streamobjectopenai-chat

Files added

5 files
  • app/page.tsx
  • app/layout.tsx
  • app/actions.tsx
  • lib/schema.ts
  • lib/rate-limit.ts

Dependencies

18 total

npm packages

11
AISDK@hookform/resolvers@base-ui/reactUpstashclass-variance-authoritylucide-reactmotionNext.jsReactreact-hook-formZod

Shadcn IconRegistry components

7
badgebuttoncardforminputtextareatooltip

Critical files

  • app/actions.tsx

    Core AI pipeline: uses streamObject with OpenAI and createStreamableValue to stream structured profile enrichment (tags, category, skill level, career suggestions) back to the client in real-time.

  • lib/schema.ts

    Defines the enrichedProfileSchema (suggestedTags, categoryMatch, skillLevel, careerSuggestions) and the profileFormSchema for input validation. Essential for the streamObject pipeline.

Requirements

Complexity
Intermediate
Setup time
~10 minutes
Node
24+
Memory
256MB