A production-grade GenAI chatbot built for the FPL Technologies (OneCard) Product Builder Intern Assignment. This assistant understands voice + text queries, performs credit-card actions, explains EMI options, retrieves info using RAG, and offers a premium glass-morphism UI.
- Uses Google Web Speech API for free, low-latency speech-to-text.
- Seamless push-to-talk / stop-talk control.
- Bot responds in text and optional text-to-speech.
Understands:
- Billing queries
- Card block / unblock
- EMI conversion
- Repayments
- Delivery
- Transaction disputes
- General onboarding queries
Powered by Groq LLaMA-3.1-8B (instant) using:
- Intent classifier
- Parameter extractor
- Tool execution layer
- Rewritten queries for better understanding
- Embedding model: Snowflake Arctic embed
- Vector DB: In-memory cosine search
- Handles all informational queries:
- Bill generation rules
- Limits
- Fees
- Markup
- Eligibility
- Refund timelines
- Delivery stages
- OTP, KYC, activation
- Clean inline citations using:
[ { "chunk": "...", "score": 0.87 }, ... ]
- Computes EMI for 3, 6, 9, 12 months
- Includes:
- Interest
- GST on interest
- Total payable
- Recommended plan (lowest total cost)
- Formats clean readable tables
Implements real actions (mocked):
| Action | Tool |
|---|---|
| Block card | tool_block_card |
| Unblock card | tool_unblock_card |
| Get bill summary | tool_get_bill_summary |
| Convert to EMI | tool_convert_to_emi |
| Get current balance | tool_get_current_balance |
Built using Next.js + Tailwind + Glassmorphism
- Components:
- Chat bubbles
- Suggested prompts
- Voice mic button
- EMI info cards
- Intent + metadata debugging (optional)
- Fully responsive
ββββββββββββββββββββββββββββ
β Frontend (Next.js) β
User β Browser β Voice/Input β β - Voice input β β REST / WebSocket
β - Chat UI β
β - EMI Cards β
βββββββββββββ¬βββββββββββββββ
β
βΌ
ββββββββββββββββββββββββ
β FastAPI Backend β
β /chat β
β /ws (optional) β
βββββββββββββ¬βββββββββββ
β
βββββββββββββββββββββββ΄βββββββββββββββββββ
βΌ βΌ
ββββββββββββββββββββββββ ββββββββββββββββββββββββββββββ
β Agent Brain β β RAG Engine β
β - Intent classify β β - Vector DB search β
β - Query rewrite β β - Snowflake embeddings β
β - Parameter extract β β - Top-k retrieval β
β - Action routing β ββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββ
βΌ
ββββββββββββββββββββββββββββ
β Tools Layer β
β - Block card β
β - Bill summary β
β - EMI computation β
β - Balance lookup β
ββββββββββββββββββββββββββββ
master branch. ```
...
genai-credit-card-assistant/
β
βββ backend/
β βββ main.py # FastAPI server
β βββ agents/
β β βββ agent.py # Main agent logic
β β βββ tools.py # Action tools
β β βββ emi_engine.py # EMI calculator
β β βββ query_rewriter.py
β βββ rag.py # Vector search + embeddings
β βββ data/
β β βββ knowledge_base.json
β βββ .env.example
β
βββ voice-frontend/
β βββ app/
β β βββ page.tsx # UI + Voice handling
β βββ components/
β βββ ChatBubble.tsx
β
βββ README.md
cd backend python -m venv venv
venv\Scripts\activate
source venv/bin/activate
pip install -r requirements.txt
GROQ_API_KEY=your_key
MODEL_NAME=llama-3.1-8b-instant
Bash: uvicorn backend.main:app --reload
Bash: cd voice-frontend npm install npm run dev Visit: π http://localhost:3000
βWhat is foreign currency markup?β
βRefund kab aata hai?β
βDelivery delay kya hota hai?β
βMinimum due kya hai?β
βBlock my cardβ
βConvert 8000 to EMIβ
βWhat is my bill summary?β
βWhatβs my current balance?β
β8000 ko EMI me daal doβ
βkitna outstanding haiβ
βdue kitna hogaβ