AI-powered product description generator for B2B marketplace listings. Uses OpenAI GPT-4o with guardrailed prompting to produce accurate, SEO-friendly descriptions without hallucination.
- SEO-Optimized Output: 150-250 character descriptions optimized for Google/Gemini
- Brand Detection: Automatically identifies and highlights 50+ known restaurant equipment brands
- Guardrailed Generation: Prevents hallucination—never assumes eco-friendly, sizes, or materials
- Caching: 30-day TTL cache with MongoDB for fast repeat lookups
- Rating System: Track and improve description quality with user feedback
- Confidence Scoring: 0.0-1.0 score based on title clarity
- Framework: Next.js 15 (App Router)
- AI: OpenAI GPT-4o
- Database: MongoDB
- Validation: Zod
- Language: TypeScript
npm installCreate .env.local:
OPENAI_API_KEY=sk-your-key-here
MONGODB_URI=mongodb+srv://...
MONGODB_DATABASE=your_databasenpm run setup:indexesnpm run devOpen: http://localhost:3000/test/ai-description
POST /api/listings/generate-description
Content-Type: application/jsonRequest:
{
"title": "Cambro 6-quart food storage containers",
"category": "Food Storage",
"mode": "on_demand",
"unitOfMeasurement": "case",
"userDescription": "Clear polycarbonate, stackable"
}Response:
{
"short_description": "Cambro 6-quart food storage containers—restaurant-grade, stackable, built for heavy kitchen use.",
"category": "Food Storage",
"confidence": 0.90,
"cached": false,
"model": "gpt-4o-2024-08-06",
"cacheKey": "Food Storage::cambro 6-quart food storage containers"
}POST /api/listings/generate-description/rate{
"cacheKey": "Food Storage::cambro 6-quart",
"rating": 4,
"feedback": "Good but could mention color",
"title": "cambro 6-quart",
"category": "Food Storage",
"short_description": "..."
}src/
├── app/
│ ├── api/listings/generate-description/
│ │ ├── route.ts # Main API endpoint
│ │ └── rate/route.ts # Rating endpoint
│ └── test/ai-description/
│ └── page.tsx # Interactive test harness
├── lib/
│ ├── ai/
│ │ ├── prompts.ts # System prompts & templates
│ │ ├── description-generator.ts # Core service
│ │ └── openai.ts # OpenAI client
│ ├── db/
│ │ └── mongo.ts # MongoDB connection
│ └── validators/
│ └── description.ts # Zod validation schemas
├── types/
│ └── ai-description.ts # TypeScript types
scripts/
└── setup-ai-indexes.ts # MongoDB index setup
docs/
└── AI_DESCRIPTION_GENERATOR.md # Full documentation
The AI is instructed to:
✅ DO:
- Use only facts from title, category, and seller description
- Include brand names when present
- Focus on product identity and practical value
- Keep descriptions 150-200 characters
- Use restaurant-to-restaurant tone
❌ DON'T:
- Assume eco-friendly, sustainable, compostable
- Guess sizes, materials, or certifications
- Add "confirm with seller" filler
- Hallucinate brand reputations
| Score | Level | Description |
|---|---|---|
| 0.85-1.0 | High | Clear item with brand, size, specifics |
| 0.55-0.84 | Medium | Understandable but missing qualifiers |
| 0.25-0.54 | Low | Ambiguous or generic title |
| 0.0-0.24 | Very Low | Unusable input |
© 2025 86Deadstock LLC. All rights reserved.