Skip to content

rushikeshxdev/rayeva-ai-modules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌱 Rayeva AI Dashboard

Intelligent Automation for Sustainable E-Commerce

FastAPI Python React Vite Google Gemini

AI-powered automation platform built for Rayeva World Pvt Ltd 🌍

Features β€’ Quick Start β€’ API Docs β€’ Tech Stack β€’ Demo


πŸ“‹ Table of Contents


🎯 About

Rayeva is revolutionizing sustainable e-commerce with eco-friendly products. This dashboard automates their most time-intensive operations using Google Gemini AI, reducing manual work by 80% while improving accuracy and customer experience.

πŸ’‘ Built as an internship project to demonstrate real-world AI integration in sustainable business operations.


✨ Features

🏷️ Smart Product Tagger

Automatically categorize products and generate SEO-optimized tags with sustainability filters.

Key Benefits:

  • ⚑ Instant categorization
  • 🎯 95%+ accuracy
  • πŸ” SEO tag generation
  • ♻️ Sustainability scoring

πŸ’Ό B2B Proposal Generator

Create customized bulk purchase proposals that maximize budget utilization.

Key Benefits:

  • πŸ’° Budget optimization (90-100%)
  • πŸ“Š Impact calculations
  • 🎨 Professional formatting
  • 🌱 ESG alignment

🌍 Impact Report Generator

Calculate environmental impact with precision β€” plastic saved, carbon avoided, and local sourcing metrics.

Key Benefits:

  • πŸ“ˆ Real-time calculations
  • 🌊 Plastic waste tracking
  • 🌿 Carbon footprint analysis
  • πŸ“ Human-readable reports

πŸ’¬ WhatsApp Support Bot

Intelligent customer support via WhatsApp with automatic intent detection and routing.

Key Benefits:

  • πŸ€– 24/7 availability
  • 🎯 Intent classification
  • πŸ“¦ Order tracking
  • 🚨 Smart escalation

πŸ› οΈ Tech Stack

Backend

Python FastAPI SQLAlchemy SQLite Pydantic

Frontend

React Vite CSS Variables React Router

AI & Integration

Google Gemini Groq Twilio


πŸ—οΈ Architecture

graph TB
    A[React Frontend<br/>Vite + CSS Variables] -->|HTTP/JSON| B[FastAPI Backend<br/>Python 3.11]
    B --> C[Module 1: Product Tagger<br/>/api/categorize-product]
    B --> D[Module 2: Proposal Generator<br/>/api/generate-proposal]
    B --> E[Module 3: Impact Report<br/>/api/generate-impact-report]
    B --> F[Module 4: WhatsApp Bot<br/>/api/whatsapp/webhook]
    C --> G[Google Gemini AI]
    D --> G
    E --> G
    F --> G
    C --> H[(SQLite Database<br/>7 Tables)]
    D --> H
    E --> H
    F --> H
    
    style A fill:#00c4a7,stroke:#009688,color:#fff
    style B fill:#00c4a7,stroke:#009688,color:#fff
    style G fill:#00c4a7,stroke:#009688,color:#fff
    style H fill:#00c4a7,stroke:#009688,color:#fff
Loading

System Flow: React frontend communicates with FastAPI backend via REST API. Each module leverages Google Gemini AI for intelligent processing, with all data persisted in SQLite.


πŸš€ Quick Start

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • Google Gemini API Key (Get one free)

Backend Setup

# 1️⃣ Clone the repository
git clone https://github.com/YOUR_USERNAME/rayeva-ai-modules.git
cd rayeva-ai-modules

# 2️⃣ Create and activate virtual environment
python -m venv venv

# Windows
venv\Scripts\activate

# Mac/Linux
source venv/bin/activate

# 3️⃣ Install dependencies
pip install -r requirements.txt

# 4️⃣ Configure environment variables
cp .env.example .env
# Edit .env and add your GEMINI_API_KEY

# 5️⃣ Seed database with test data
python seed_data.py

# 6️⃣ Start the server
uvicorn main:app --reload

βœ… Backend running at: http://127.0.0.1:8000
πŸ“š API Documentation: http://127.0.0.1:8000/docs

Frontend Setup

# 1️⃣ Navigate to frontend directory
cd frontend

# 2️⃣ Install dependencies
npm install

# 3️⃣ Start development server
npm run dev

βœ… Dashboard running at: http://localhost:5173

πŸŽ‰ You're all set! Open the dashboard and start exploring the modules.


πŸ€– Module Details

🏷️ Module 1 β€” Smart Product Tagger

🎯 Purpose: Automatically categorize products and generate SEO-optimized tags with sustainability scoring.

πŸ“₯ Input: Product name + description

πŸ“€ Output: Category, sub-category, SEO tags, sustainability filters, confidence score

Example Request

{
  "product_name": "BambooFresh Toothbrush",
  "product_description": "Biodegradable bamboo, plastic-free packaging"
}

Example Response

{
  "category": "Personal Care",
  "sub_category": "Oral Hygiene",
  "seo_tags": ["bamboo toothbrush", "plastic-free", "eco toothbrush"],
  "sustainability_filters": ["plastic-free", "biodegradable"],
  "confidence_score": 0.95
}

🧠 AI Strategy

  • Role-based prompting with predefined category taxonomy
  • Strict JSON output enforcement
  • Temperature: 0.3 for consistency
  • Validation: Confidence scoring for quality assurance
πŸ’Ό Module 2 β€” B2B Proposal Generator

🎯 Purpose: Generate customized bulk purchase proposals that maximize budget utilization while meeting client preferences.

πŸ“₯ Input: Client details, budget, employee count, sustainability preferences

πŸ“€ Output: Product recommendations, pricing breakdown, impact summary, ESG positioning

Example Request

{
  "client_name": "GreenTech Pvt Ltd",
  "industry": "Technology",
  "budget": 50000,
  "num_employees": 50,
  "preferences": ["plastic-free", "recycled"]
}

Example Response

{
  "recommended_products": [
    {
      "product_name": "Bamboo Desk Organizer",
      "category": "Office & Stationery",
      "quantity": 50,
      "unit_price": 299,
      "total_price": 14950,
      "sustainability_features": ["plastic-free", "biodegradable"]
    }
  ],
  "total_cost": 49850,
  "budget_utilization_percent": 99.7,
  "impact_summary": "Eliminates approximately 600 single-use plastic items",
  "impact_positioning": "Perfect for ESG goals and CSR reporting"
}

🧠 AI Strategy

  • Role: B2B sales consultant persona
  • Budget constraint: Strict adherence with 90-100% utilization target
  • Temperature: 0.5 for balanced creativity
  • Output: Professional proposal format with impact metrics
🌍 Module 3 β€” Impact Report Generator

🎯 Purpose: Calculate precise environmental impact metrics and generate human-readable sustainability reports.

πŸ“₯ Input: Order ID + product list with sustainability attributes

πŸ“€ Output: Plastic saved, carbon avoided, local sourcing %, impact statement

Two-Step Processing

Step 1: Python Calculations (No AI guessing)

plastic_saved_grams = weight Γ— quantity Γ— 0.8   # plastic-free items
carbon_avoided_kg   = weight Γ— quantity Γ— 0.002 # local/organic items
local_sourcing_%    = local_items / total Γ— 100

Step 2: AI Communication (Gemini writes engaging statement)

"Your order saved 144g of plastic β€” like removing
 96 straws from the ocean! 🌊"

Example Response

{
  "plastic_saved_grams": 144.0,
  "carbon_avoided_kg": 0.36,
  "local_sourcing_percent": 50.0,
  "impact_statement": "Amazing! Your order saved 144g of plastic β€” equivalent to removing 96 plastic straws from the ocean! 🌊 You also avoided 0.36kg of carbon emissions. Keep making a difference! 🌱"
}

🧠 AI Strategy

  • Hybrid approach: Python for math, AI for communication
  • Temperature: 0.7 for warm, engaging tone
  • Max tokens: 500 for concise statements
  • Validation: Math verified before AI processing
πŸ’¬ Module 4 β€” WhatsApp Support Bot

🎯 Purpose: Provide 24/7 intelligent customer support via WhatsApp with automatic intent detection and routing.

πŸ“₯ Input: Twilio webhook POST (customer WhatsApp message)

πŸ“€ Output: TwiML XML response sent back to customer

System Flow

graph LR
    A[Customer WhatsApp] --> B[Twilio]
    B --> C[POST /api/whatsapp/webhook]
    C --> D{AI Intent Detection}
    D -->|order_status| E[Query Database]
    D -->|return_policy| F[Return Policy Text]
    D -->|refund_escalation| G[Create Escalation]
    D -->|general| H[AI Response]
    E --> I[Format TwiML]
    F --> I
    G --> I
    H --> I
    I --> B
    B --> A
    
    style D fill:#00c4a7,stroke:#009688,color:#fff
    style I fill:#00c4a7,stroke:#009688,color:#fff
Loading

Intent Categories

  • order_status β†’ Query database for order tracking
  • return_policy β†’ Return hardcoded policy text
  • refund_escalation β†’ Log to database, alert team
  • general β†’ AI-generated response

Test Commands (with seed data)

"Where is my order ORD-001?" β†’ Order found, status returned
"What is your return policy?" β†’ Policy text returned
"I want a refund now!"        β†’ Escalation created, team alerted

🧠 AI Strategy

  • Strict classification: Single-word intent output
  • Temperature: 0.3 for consistent routing
  • Fallback: Always defaults to "general" on failure
  • Logging: All conversations stored for analysis

πŸ“‘ API Reference

Module 1: Product Tagger

Method Endpoint Description
POST /api/categorize-product Tag a product with AI
GET /api/products List all tagged products

Module 2: Proposal Generator

Method Endpoint Description
POST /api/generate-proposal Generate B2B proposal
GET /api/proposals List all proposals

Module 3: Impact Report

Method Endpoint Description
POST /api/generate-impact-report Calculate order impact
GET /api/impact-reports List all impact reports

Module 4: WhatsApp Bot

Method Endpoint Description
POST /api/whatsapp/webhook Twilio webhook handler
GET /api/whatsapp/logs View conversations
GET /api/escalations View escalations

πŸ“š Interactive API Docs: Visit http://127.0.0.1:8000/docs for full Swagger documentation with live testing.


πŸ—„οΈ Database Schema

7 SQLAlchemy Tables:

Table Purpose Key Fields
product_tags Module 1 outputs category, sub_category, seo_tags, sustainability_filters
b2b_proposals Module 2 outputs client_name, recommended_products, total_cost, budget_utilization
impact_reports Module 3 outputs plastic_saved_grams, carbon_avoided_kg, impact_statement
orders Seed data for testing order_id, customer_name, products, status
whatsapp_logs Module 4 conversations message, intent, response, timestamp
escalation_logs Flagged customer issues customer_message, status (pending/resolved)
ai_logs AI call tracking module, prompt, response, success, timestamp

πŸ’Ύ Database: SQLite for simplicity. Production-ready with easy migration to PostgreSQL/MySQL.


βš™οΈ Environment Setup

Required Variables

# .env file

# πŸ”‘ Google Gemini API Key (Required)
# Get your free key: https://aistudio.google.com/app/apikey
GEMINI_API_KEY=your_api_key_here

# πŸ“± Twilio Configuration (Optional - only for live WhatsApp testing)
TWILIO_ACCOUNT_SID=your_account_sid
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_WHATSAPP_NUMBER=whatsapp:+14155238886

# 🌐 Frontend Configuration
VITE_API_BASE_URL=http://127.0.0.1:8000

⚠️ Important: Never commit your .env file. Use .env.example as a template.


πŸ“ Project Structure

rayeva-ai-dashboard/
β”‚
β”œβ”€β”€ πŸ“‚ modules/                      # AI Module Implementations
β”‚   β”œβ”€β”€ module1_tagger.py           # 🏷️ Product categorization & tagging
β”‚   β”œβ”€β”€ module2_proposal.py         # πŸ’Ό B2B proposal generation
β”‚   β”œβ”€β”€ module3_impact.py           # 🌍 Environmental impact calculations
β”‚   └── module4_whatsapp.py         # πŸ’¬ WhatsApp bot with intent routing
β”‚
β”œβ”€β”€ πŸ“‚ frontend/                     # React Dashboard
β”‚   β”œβ”€β”€ πŸ“‚ src/
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ Home.jsx            # Landing page
β”‚   β”‚   β”‚   β”œβ”€β”€ ProductTagger.jsx   # Module 1 interface
β”‚   β”‚   β”‚   β”œβ”€β”€ ProposalGenerator.jsx # Module 2 interface
β”‚   β”‚   β”‚   β”œβ”€β”€ ImpactReport.jsx    # Module 3 interface
β”‚   β”‚   β”‚   └── WhatsAppBot.jsx     # Module 4 interface
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.jsx          # Navigation with teal theme
β”‚   β”‚   β”‚   └── JsonDisplay.jsx     # Formatted JSON viewer
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ api/
β”‚   β”‚   β”‚   └── client.js           # Axios API client
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ App.jsx                 # Main app component
β”‚   β”‚   └── index.css               # Global styles (CSS Variables)
β”‚   β”‚
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
β”‚
β”œβ”€β”€ πŸ“„ main.py                       # FastAPI app with all routes + CORS
β”œβ”€β”€ πŸ“„ models.py                     # SQLAlchemy table definitions (7 tables)
β”œβ”€β”€ πŸ“„ database.py                   # SQLite engine + session management
β”œβ”€β”€ πŸ“„ ai_client.py                  # Google Gemini API client wrapper
β”œβ”€β”€ πŸ“„ seed_data.py                  # Test data generator (5 sample orders)
β”‚
β”œβ”€β”€ πŸ“„ requirements.txt              # Python dependencies
β”œβ”€β”€ πŸ“„ .env.example                  # Environment template
β”œβ”€β”€ πŸ“„ .gitignore
└── πŸ“„ README.md                     # You are here! πŸ‘‹

🎬 Demo

Test Data Available

The system comes pre-seeded with 5 sample orders for testing the WhatsApp bot:

Order ID Customer Product Status Test Query
ORD-001 Priya Sharma Bamboo Toothbrush Γ— 2 βœ… Delivered "Where is my order ORD-001?"
ORD-002 Rahul Mehta Reusable Water Bottle Γ— 1 πŸ“¦ Shipped "Track order ORD-002"
ORD-003 Ananya Singh Organic Cotton Tote Γ— 3 ⏳ Processing "Status of ORD-003?"
ORD-004 Vikram Patel Compostable Plates Γ— 10 βœ… Delivered "Where is ORD-004?"
ORD-005 Sneha Joshi Beeswax Food Wraps Γ— 5 πŸ“¦ Shipped "Check ORD-005 status"

Live Demo

πŸš€ https://rayeva-ai-modules.vercel.app/

Backend runs locally β€” clone the repo and run uvicorn main:app --reload to connect the AI modules.


🀝 Contributing

This project was built as an internship assignment, but contributions are welcome!

Areas for improvement:

  • 🎨 Enhanced UI/UX designs
  • πŸ§ͺ Unit and integration tests
  • πŸ“Š Analytics dashboard
  • πŸ” Authentication system
  • 🌐 Multi-language support
  • πŸ“± Mobile app integration

πŸ“ License

This project is part of an internship assignment for Rayeva World Pvt Ltd.


πŸ‘¨β€πŸ’» Author

Rushikesh Randive
Full Stack / AI Intern
Rayeva World Pvt Ltd β€’ 2026


🌱 Built with passion for sustainable commerce


Automating sustainability, one AI module at a time πŸš€

Built by Rushikesh Randive Β· Rayeva World Pvt Ltd Internship Β· 2026

About

AI-powered modules for sustainable e-commerce | Product Tagger, B2B Proposal Generator, Impact Reporter & WhatsApp Bot | Built with FastAPI, Google Gemini API , Groq API & React

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors