π Live Demo
A voice-enabled AI customer support agent for Aven, built with Next.js, Vapi for voice interactions, OpenAI for natural language processing, and Pinecone for intelligent search and context retrieval.
- Voice AI Assistant: Real-time voice conversations using Vapi's voice AI platform
- Intelligent Search: Context-aware responses using Pinecone vector database
- Custom Knowledge Base: Searches through Aven's documentation and policies
- Dual Interface: Both text chat and voice call capabilities
- Modern UI: Clean, responsive interface built with Shadcn UI and Tailwind CSS
- Type Safety: Full TypeScript support throughout the application
- Real-time Streaming: Live voice responses with streaming support
- Semantic Search: Advanced vector-based knowledge retrieval
- Next.js 15 - React framework with API routes and App Router
- TypeScript - Type safety throughout the application
- Tailwind CSS - Utility-first CSS framework
- Shadcn UI - Modern component library
- OpenAI GPT-4 - Natural language processing and embeddings
- Vapi - Voice AI platform for real-time conversations
- Pinecone - Vector database for semantic search
- Exa AI - Web scraping and content extraction
- OpenAI Embeddings API - Text-to-vector conversion
- Pinecone Vector Database - Semantic search storage
- Vapi Voice Platform - Real-time voice interactions
- Exa Content Extraction - Web scraping capabilities
- Clone the repository
- Install dependencies:
npm install- Set up your environment variables in the
.envfile:
# OpenAI
OPENAI_API_KEY=your_openai_api_key
# Pinecone
PINECONE_API_KEY=your_pinecone_api_key
PINECONE_INDEX_NAME=your_index_name
PINECONE_ENVIRONMENT=your_environment
# Vapi
NEXT_PUBLIC_VAPI_API_KEY=your_vapi_api_key
NEXT_PUBLIC_VAPI_ASSISTANT_ID=your_assistant_id
# Exa AI (for web scraping)
EXA_API_KEY=your_exa_api_key
# App Configuration
NEXT_PUBLIC_APP_URL=http://localhost:3000- Start the development server:
npm run devOpen http://localhost:3000 with your browser to see the application.
- Main Page (
src/app/page.tsx): Landing page with Aven branding and chat interface - Chat Interface (
src/components/ChatInterface.tsx): Text-based chat component with message history - Vapi Widget (
src/components/VapiWidget.tsx): Voice call interface using Vapi's web SDK
- Text Chat API (
/api/chat): Handles text-based conversations - Voice Chat API (
/api/vapi/chat/completions): Custom LLM endpoint for Vapi voice interactions
- Chat Engine (
src/lib/chat.ts): Orchestrates conversations with context-aware responses - Search Engine (
src/lib/search.ts): Semantic search using Pinecone vector database - Embeddings (
src/lib/embeddings.ts): Converts text to vector embeddings using OpenAI
- Pinecone Integration (
src/lib/pinecone.ts): Vector database for storing and retrieving knowledge - Data Processing (
src/lib/processData.ts): Processes scraped content for storage - Web Scraping (
src/lib/scrapeData.ts): Scrapes Aven's website and HELOC resources
- User Input β User types question in chat interface
- API Call β Frontend sends POST to
/api/chat - Search Context β System searches Pinecone for relevant Aven documentation
- AI Response β OpenAI GPT-4 generates context-aware answer
- Display β Response shown in chat interface with markdown formatting
- Voice Call β User clicks "Talk to Assistant" button
- Vapi Integration β Vapi SDK initiates voice conversation
- Custom LLM β Vapi calls your custom endpoint
/api/vapi/chat/completions - Streaming Response β Real-time voice responses with streaming support
- Voice Output β Assistant speaks back to user
- Web Scraping β Exa AI scrapes Aven's website and HELOC resources
- Content Processing β Raw content is cleaned and structured
- Vector Embeddings β OpenAI converts text to numerical vectors
- Pinecone Storage β Vectors stored in Pinecone for semantic search
src/components/ChatInterface.tsx- Main chat UI with message historysrc/components/VapiWidget.tsx- Voice call button and status displaysrc/components/ui/*- Reusable Shadcn UI components
src/app/api/chat/route.ts- Text chat endpointsrc/app/api/vapi/chat/completions/route.ts- Voice chat endpoint
src/lib/chat.ts- Main chat orchestrationsrc/lib/search.ts- Pinecone search functionalitysrc/lib/embeddings.ts- OpenAI embeddingssrc/lib/pinecone.ts- Database connection
src/lib/scrapeData.ts- Web scraping orchestrationsrc/lib/processData.ts- Content processingsrc/lib/urls.ts- URLs to scrape (Aven + HELOC resources)src/lib/types.ts- TypeScript type definitions
src/config/env.ts- Environment variable validationsrc/utils/logger.ts- Logging utilities
- Create a Vapi account and assistant
- Configure the assistant to use your custom LLM URL:
https://your-ngrok-url.ngrok-free.app/api/vapi/chat/completions - Set the assistant ID in your environment variables
- Create a Pinecone index for your knowledge base
- Upload Aven's documentation and policies
- Configure the index name and environment in your environment variables
The system automatically scrapes and processes content from:
- Aven's Website: Main pages, FAQ, support, education content
- HELOC Resources: External documentation about Home Equity Lines of Credit
- Financial Education: Comprehensive guides and explanations
Run the scraping script to populate your knowledge base:
npm run scrapeThe application can be deployed on Vercel or any other Next.js-compatible platform. Make sure to:
- Set up all environment variables in your deployment platform
- Configure your Vapi assistant to use the production URL
- Ensure your Pinecone index is accessible from the deployment environment
- Update the Vapi custom LLM URL to point to your production domain
- β All environment variables configured
- β Vapi assistant updated with production URL
- β Pinecone index accessible from production
- β Knowledge base populated with Aven content
- β SSL certificates configured for secure voice calls
- Vapi Documentation - Learn about Vapi's voice AI platform
- OpenAI API Documentation - OpenAI API reference
- Pinecone Documentation - Vector database guide
- Next.js Documentation - Next.js features and API
- Exa AI Documentation - Web scraping and content extraction
- Shadcn UI Documentation - Component library reference
This is a sophisticated AI customer support system that combines modern web technologies with advanced AI capabilities to provide intelligent, context-aware support for Aven's customers. The system features:
- Dual Interface - Both text and voice support
- Context-Aware - Searches Aven's knowledge base for relevant answers
- Real-time Voice - Streaming voice conversations
- Modern UI - Clean, responsive design with dark theme
- Type Safety - Full TypeScript coverage
- Scalable - Vector database for efficient knowledge retrieval