Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 

Repository files navigation

πŸ“Œ GenAI Credit Card Assistant β€” Voice + RAG + EMI Planner + Actions

⚠️ Important Notice: The folder structure, setup instructions, and code paths detailed in this README correspond to the master branch of this repository.

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.


πŸš€ Key Features

πŸ”Š 1. Real-time Voice Assistant (Browser Native)

  • 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.

πŸ€– 2. Smart Agent with Intent Classification

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

πŸ“š 3. RAG (Retrieval Augmented Generation)

  • 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 },
      ...
    ]

πŸ’³ 4. EMI Planner Engine (Custom-built)

  • Computes EMI for 3, 6, 9, 12 months
  • Includes:
    • Interest
    • GST on interest
    • Total payable
    • Recommended plan (lowest total cost)
  • Formats clean readable tables

βš™ 5. Tool Execution Layer

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

🎨 6. Premium OneCard-Style UI

Built using Next.js + Tailwind + Glassmorphism

  • Components:
    • Chat bubbles
    • Suggested prompts
    • Voice mic button
    • EMI info cards
  • Intent + metadata debugging (optional)
  • Fully responsive

πŸ— Architecture Overview (Refined)

                               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                               β”‚    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         β”‚
                                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Folder Structure

⚠️ Note: This folder structure is based on the 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


πŸ›  Setup Instructions

1️⃣ Backend Setup

cd backend python -m venv venv

On Windows

venv\Scripts\activate

On macOS/Linux

source venv/bin/activate

Requirements

pip install -r requirements.txt

Create .env:

GROQ_API_KEY=your_key
MODEL_NAME=llama-3.1-8b-instant

Run server:

Bash: uvicorn backend.main:app --reload

2️⃣ Frontend Setup

Bash: cd voice-frontend npm install npm run dev Visit: πŸ‘‰ http://localhost:3000

πŸ§ͺ Example Queries

βœ” Informational

β€œWhat is foreign currency markup?”

β€œRefund kab aata hai?”

β€œDelivery delay kya hota hai?”

β€œMinimum due kya hai?”

βœ” Actions

β€œBlock my card”

β€œConvert 8000 to EMI”

β€œWhat is my bill summary?”

β€œWhat’s my current balance?”

βœ” Rewritten Queries (Agent auto-corrects)

β€œ8000 ko EMI me daal do”

β€œkitna outstanding hai”

β€œdue kitna hoga”

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors