A smart, voice-enabled customer support assistant built with Spring Boot (Java) and powered by Retrieval-Augmented Generation (RAG). It answers user queries from an FAQ knowledge base using AI, with voice interaction, semantic search, and real-time order tracking.
Try it now: https://voiceragcare-production.up.railway.app/
- Voice & Text Input: Speak naturally or type your questions
- Smart RAG System: Retrieves relevant information from FAQs with semantic search
- Order Status Check: Real-time order tracking (with mock data)
- Text-to-Speech: Hear spoken responses with interrupt capability
- Beautiful Web UI: Modern, responsive interface
- Fast Responses: Optimized for low latency
- Source Citations: Always shows where information comes from
- Java 21 or later
- Maven (included with wrapper)
- Gemini API Key from Google AI Studio
- Clone the repository
git clone https://github.com/Somtrip/VoiceRAGcare.git
cd VoiceRAGcare- Set up environment
# Copy the example environment file
cp env.example .env
# Add your Gemini API key
echo "GEMINI_API_KEY=your_actual_api_key_here" >> .env- Run the application
# Using Maven wrapper (recommended)
./mvnw spring-boot:run
# Or with installed Maven
mvn spring-boot:run- Open your browser
http://localhost:8080
That's it! The application will automatically:
- Load sample FAQs into the database
- Generate embeddings for semantic search
- Start the web server
- "What's your return policy?"
- "How do I track my order?"
- "What payment methods do you accept?"
- "What's the status of order 12345?"
- FAQ Mode: Answers questions using your knowledge base with source citations
- Order Status Mode: Checks order tracking and delivery estimates
- Intent Classification: Automatically detects if you're asking about orders or general questions
- Semantic Search: Finds the most relevant FAQs using AI embeddings
- Keyword Fallback: Works even when embeddings aren't available
- Context-Aware Responses: Generates natural, helpful answers
# Health check
curl http://localhost:8080/api/assistant/health
# Chat endpoint
curl -X POST http://localhost:8080/api/assistant/chat \
-H "Content-Type: application/json" \
-d '{"message":"What is your return policy?"}'
# Test order status
curl -X POST http://localhost:8080/api/assistant/test-order \
-H "Content-Type: application/json" \
-d '{"orderId":"12345"}'# Check loaded FAQs
curl http://localhost:8080/api/assistant/debug/faqs
# Test search
curl "http://localhost:8080/api/assistant/debug/search?query=returns"Create a .env file in the root directory:
GEMINI_API_KEY=your_gemini_api_key_here
SERVER_PORT=8080 # Optional, defaults to 8080Key settings in src/main/resources/application.properties:
# Server
server.port=8080
# Database (H2 in-memory)
spring.datasource.url=jdbc:h2:mem:testdb
# Gemini AI
gemini.api.key=${GEMINI_API_KEY}
# CORS (enabled for all origins in development)
spring.web.cors.allowed-origins=*src/
βββ main/
β βββ java/com/customercare/
β β βββ controller/ # REST API endpoints
β β βββ service/ # Business logic
β β βββ model/ # Data models
β β βββ repository/ # Database operations
β βββ resources/
β βββ static/ # Web UI (HTML, CSS, JS)
β βββ data/ # Sample FAQs
β βββ application.properties
VoiceAssistantController: Handles HTTP requests and responsesRAGService: Implements retrieval-augmented generationGeminiService: Communicates with Google's Gemini AIOrderStatusService: Mock order tracking systemDataIngestionService: Loads FAQs and generates embeddings
This project is live at: https://voiceragcare-production.up.railway.app/
The app is ready for deployment on any Java-compatible platform:
Railway (Used for current deployment)
# Connect your GitHub repo and set GEMINI_API_KEY in environment variablesEdit src/main/resources/data/sample-faqs.json:
{
"question": "Your question here?",
"answer": "Your detailed answer here.",
"category": "category-name",
"sourceDocument": "Source Document Name"
}The application includes built-in health checks and debugging endpoints:
GET /api/assistant/health- Service statusGET /api/assistant/debug/faqs- FAQ statisticsGET /api/assistant/debug/search?query=...- Search debugging
Need help?
- Try the live demo: https://voiceragcare-production.up.railway.app/
- Open an issue on GitHub
- Check the debug endpoints to see what's happening under the hood! π―
β Star this repo if you find it helpful!