Production-Ready AI Chatbot Platform - Deploy intelligent, multilingual chatbots with advanced RAG capabilities, incremental knowledge management, and real-time analytics.
BotBlocks is a comprehensive chatbot-as-a-service platform that enables businesses to create, deploy, and manage AI-powered chatbots with zero coding. Built for scale, accuracy, and developer experience.
- BGE-Small Embeddings: 4x better accuracy than previous models
- Adaptive Retrieval: Dynamic document fetching (3-7 docs based on query complexity)
- Hallucination Guard: Multi-layer validation prevents incorrect responses
- Knowledge Gap Tracking: Automatically identifies missing information
- Token Optimization: 75% reduction in token costs through semantic routing
- 6 Indian Languages: Hindi, Bengali, Tamil, Telugu, Malayalam, Kannada
- Romanized Text: Supports "Hinglish" (e.g., "bolchi", "kya hai")
- Zero-Cost Detection: Language identification via regex (no LLM calls)
- Smart Translation Cache: 50% cache hit rate reduces translation costs
- 7% Overhead: Minimal token increase compared to English-only
- Multi-Source Upload: PDFs, TXT, DOCX, MD files
- Recursive Web Scraping: Extract entire website content automatically
- Document Versioning: Track and manage knowledge base updates
- Selective Removal: Delete specific documents without retraining
- Real-Time Updates: Knowledge base changes reflect immediately
- Health Score: Automated bot performance monitoring (0-100 scale)
- Knowledge Gap Insights: AI-powered analysis of unanswered queries
- Query Tracking: Audit logs for every conversation
- Success Rate Metrics: Real-time accuracy monitoring
- Confidence Scoring: Track answer quality over time
- One-Line Integration:
<script>tag deployment - Customizable Widget: Match your brand colors and style
- CORS Protection: Restrict bot access to authorized domains
- Mobile Responsive: Works seamlessly on all devices
File:
screenshots/landing-page1.pngFile:screenshots/landing-page2.png
[SCREENSHOT PLACEHOLDER]
File:
screenshots/dashboard.png
File:
screenshots/knowledge-base.png
File:
screenshots/analytics.png
File:
screenshots/widget-config.png
File:
screenshots/chat-example.png
File:
screenshots/knowledge-gap.pngFile:screenshots/knowledge-gap1.pngFile:screenshots/knowledge-gap2.png
Intelligent query classification routes simple queries directly to LLM:
- Greetings ("hi", "hello") β Direct response (~50 tokens)
- Identity questions ("who are you?") β Cached response
- Complex queries β Full RAG pipeline (~1,450 tokens)
Dynamic document fetching based on query complexity:
Query: "hi" β k=0 (no retrieval)
Query: "what dataset?" β k=3 (simple query)
Query: "explain X in Y" β k=7 (complex query)Multi-layer validation system:
- Confidence Scoring: LLM rates its own certainty (0.0-1.0)
- Quote Verification: Ensures sources exist in context
- Gap Detection: Flags unanswerable queries
- Audit Logging: Tracks all low-confidence responses
AI-powered insight generation:
- Clusters failed queries into topics
- Suggests specific documents to upload
- Prioritizes by frequency and impact
- Filters out spam/irrelevant queries
Example Insight:
{
"topic": "Pricing Information",
"count": 12,
"advice": "Add a document explaining pricing tiers and payment options",
"priority": "high"
}| Language | Native Script | Romanized | Cache Optimization |
|---|---|---|---|
| English | β | N/A | Baseline |
| Hindi | β | β | Zero-cost detection |
| Bengali | β | β | Zero-cost detection |
| Tamil | β | β | Zero-cost detection |
| Telugu | β | β | Zero-cost detection |
| Malayalam | β | Limited | |
| Kannada | β | Limited |
User: "dataset ta ki?" (Bengali romanized)
β
[Zero-Token Detection] β Bengali identified via regex
β
[Translate to English] β "What is the dataset?"
β
[RAG Search] β Searches English knowledge base
β
[Translate Back] β "ABIDE I dataset ta use kora hoyeche."
β
User receives response in Bengali
- Language Detection: 0 tokens (regex-based)
- Translation: ~40 tokens (minimal prompts)
- Caching: 50% hit rate after warmup
- Total Overhead: 7% vs English-only queries
Supported Formats:
βββ Documents
β βββ PDF (multi-page)
β βββ DOCX (Microsoft Word)
β βββ TXT (plain text)
β βββ MD (Markdown)
βββ Web Content
β βββ Single page scraping
β βββ Recursive site scraping
βββ Future Support
βββ Excel/CSV
βββ Google DocsAutomatically extracts content from entire websites:
Example:
Input URL: https://example.com/docs
BotBlocks scrapes:
βββ /docs/getting-started
βββ /docs/api-reference
βββ /docs/tutorials
β βββ /tutorials/beginner
β βββ /tutorials/advanced
βββ /docs/faq
Result: 50+ pages indexed in 2 minutes
Features:
- Respects
robots.txt - Configurable depth limit
- Automatic duplicate detection
- Rate limiting to avoid blocking
- Add: Upload new documents without disrupting existing knowledge
- Remove: Delete specific files and their vectors
- Update: Replace outdated documents seamlessly
- List: View all sources in knowledge base
Automated performance metric (0-100 scale):
Formula: (1 - FailureRate) * 100
100: Perfect - no knowledge gaps
90-99: Excellent - minor gaps
70-89: Good - needs improvement
50-69: Fair - training required
<50: Poor - significant gaps
Calculation:
Week's Queries: 1,000
Failed Queries: 50
Failure Rate: 5%
Health Score: 95.0Real-time insights into unanswered queries:
Metrics Tracked:
- Total queries this week
- Failed queries (couldn't answer)
- Low confidence responses (<0.6)
- Average confidence score
- Success rate percentage
AI-Generated Insights:
Top Missing Topics:
1. Pricing Information (12 queries)
β Add: Pricing tiers and payment methods
2. API Authentication (8 queries)
β Add: API key setup guide
3. Mobile App Features (5 queries)
β Add: Mobile app documentation
Every conversation is tracked:
BotAuditLog {
user_query: "What's the accuracy?",
bot_response: "The accuracy is 67.7%",
confidence_score: 0.95,
flagged_as_gap: false,
timestamp: "2025-01-15T10:30:00Z"
}Use Cases:
- Debug bot responses
- Identify training needs
- Compliance and auditing
- Quality assurance
<!-- Add this to your website -->
<script
src="https://botblocks.app/widget.js"
data-bot-id="your-bot-id"
data-theme="modern"
data-position="bottom-right">
</script><script
src="https://botblocks.app/widget.js"
data-bot-id="abc-123"
data-theme="modern" // modern, classic, minimal
data-primary-color="#3b82f6" // Brand color
data-position="bottom-right" // bottom-left, top-right, etc.
data-button-style="circle" // circle, rounded, square
data-welcome-message="Hello!" // Custom greeting
data-avatar-url="/logo.png"> // Custom avatar
</script>Restrict bot access to authorized domains:
Bot Configuration:
βββ allowed_origin: "https://yoursite.com"
βββ CORS Validation: Enabled
βββ Unauthorized access: Blocked with 403- Mobile responsive design
- Dark/light mode support
- Typing indicators
- Message timestamps
- File sharing (future)
- Voice input (future)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLIENT LAYER β
βββββββββββββββ¬ββββββββββββββββββ¬ββββββββββββββββββββββββββββββ€
β React SPA β Widget (JS) β Mobile App (Future) β
ββββββββ¬βββββββ΄ββββββββββ¬ββββββββ΄ββββββββββββββ¬ββββββββββββββββ
β β β
ββββββββββββββββββ΄ββββββββββββββββββββββ
β
βββββββββββΌβββββββββββ
β FastAPI Gateway β
β (Load Balanced) β
βββββββββββ¬βββββββββββ
β
ββββββββββββββββββΌβββββββββββββββββ
β β β
ββββββββΌβββββββ ββββββββΌβββββββ βββββββΌββββββ
β RAG Service β β Translation β β Analytics β
β Pipeline β β Service β β Engine β
ββββββββ¬βββββββ ββββββββ¬βββββββ βββββββ¬ββββββ
β β β
ββββββββββββββββββΌβββββββββββββββββ
β
ββββββββββββββββββΌβββββββββββββββββ
β β β
ββββββββΌβββββββ ββββββββΌβββββββ βββββββΌββββββ
β ChromaDB β β PostgreSQL β β Gemini β
β (Vectors) β β (Metadata) β β API β
βββββββββββββββ βββββββββββββββ βββββββββββββ
User uploads PDF
β
[Backend] Extracts text (PyMuPDF)
β
[Backend] Splits into chunks (800 chars, 150 overlap)
β
[Backend] Generates embeddings (BGE-small)
β
[ChromaDB] Stores vectors with metadata
β
[PostgreSQL] Updates bot knowledge base record
β
User sees "Upload Complete"
User sends message: "What's the accuracy?"
β
[Semantic Router] Classifies query type β RAG needed
β
[Multilingual] Detects language β English (no translation)
β
[RAG Pipeline] Retrieves top 5 documents (score β₯ 0.35)
β
[LLM] Generates response with confidence score
β
[Hallucination Guard] Validates response β Approved
β
[Audit Log] Records query and response
β
User receives: "The accuracy is 67.7%"
| Component | Technology | Purpose |
|---|---|---|
| API Framework | FastAPI 0.104+ | High-performance async API |
| Database | PostgreSQL (NeonDB) | Bot metadata, users, audit logs |
| Vector Store | ChromaDB | Document embeddings storage |
| LLM Provider | Google Gemini 2.5 Flash | Response generation |
| Embeddings | BGE-small-en-v1.5 | Semantic search (33M params) |
| PDF Processing | PyMuPDF | Document extraction |
| Web Scraping | BeautifulSoup4 | Website content extraction |
| Authentication | Clerk | User management |
| Component | Technology | Purpose |
|---|---|---|
| Framework | React 18 + TypeScript | UI development |
| State Management | Zustand | Global state |
| Styling | Tailwind CSS | Utility-first CSS |
| API Client | Axios | HTTP requests |
| Routing | React Router v6 | Navigation |
| Charts | Recharts | Analytics visualization |
| Component | Technology | Purpose |
|---|---|---|
| Hosting | Vultr/AWS | Production deployment |
| CDN | Cloudflare | Static asset delivery |
| File Storage | Cloudinary | Document uploads |
| Monitoring | Sentry | Error tracking |
| Analytics | PostHog | User behavior |
# Required
- Python 3.8+
- Node.js 16+
- PostgreSQL 14+
- 2GB RAM minimum
# API Keys Needed
- Google Gemini API key
- Cloudinary account
- Clerk account (for auth)# 1. Clone the repository
git clone https://github.com/gauravnetes/BotBlocks.git
cd BotBlocks/backend
# 2. Create virtual environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Set up environment variables
cp .env.example .env
# Edit .env with your credentials:
# GOOGLE_API_KEY=your_gemini_key
# DATABASE_URL=your_neondb_url
# CLOUDINARY_URL=your_cloudinary_url
# CLERK_SECRET_KEY=your_clerk_key
# 5. Run database migrations
alembic upgrade head
# 6. Start the server
uvicorn main:app --reload --port 8000# 1. Navigate to frontend
cd ../frontend
# 2. Install dependencies
npm install
# 3. Set up environment variables
cp .env.example .env
# Edit .env:
# REACT_APP_API_URL=http://localhost:8000
# REACT_APP_CLERK_PUBLISHABLE_KEY=your_clerk_key
# 4. Start development server
npm start# Backend health check
curl http://localhost:8000/health
# Expected response:
{
"status": "healthy",
"version": "2.0.0",
"services": {
"database": "connected",
"vector_store": "ready",
"llm": "available"
}
}
# Frontend
# Open http://localhost:3000 in browser1. Visit http://localhost:3000
2. Click "Get Started"
3. Sign up with email or OAuth
1. Click "Create New Bot"
2. Enter bot name: "My Support Bot"
3. Select persona: "Professional"
4. Click "Create"
1. Go to "Knowledge Base" tab
2. Upload a PDF (e.g., your FAQ document)
3. Wait for processing (usually 10-30 seconds)
4. See "Upload Complete" notification
1. Go to "Test Chat" tab
2. Ask: "What services do you offer?"
3. Bot responds based on your PDF
4. Try in different languages: "aap kya services dete ho?"
1. Go to "Embed" tab
2. Copy the embed code:
<script src="..." data-bot-id="abc-123"></script>
3. Paste into your website's HTML
4. Your bot is now live!
Knowledge Base: Product catalog, FAQs, return policy
Persona: Friendly & Helpful
Languages: English, Hindi, Bengali
Result: 24/7 automated support, 80% query resolution
Knowledge Base: Course catalog, admission guide, campus info
Persona: Professional & Informative
Languages: English, Tamil, Telugu
Result: Reduced admission desk workload by 60%
Knowledge Base: Services, doctor profiles, appointment process
Persona: Empathetic & Professional
Languages: All 6 Indian languages
Result: Appointment bookings increased 40%
Knowledge Base: Entire documentation site (recursive scrape)
Persona: Technical & Precise
Languages: English
Result: 70% reduction in support tickets
| Metric | Value | Context |
|---|---|---|
| Average Response Time | 1.2s | Including RAG search |
| P95 Response Time | 2.5s | 95th percentile |
| Cache Hit Rate | 45% | After 100 queries |
| Concurrent Users | 1,000+ | Per instance |
| Metric | Value | Benchmark |
|---|---|---|
| Answer Accuracy | 87% | Human evaluation |
| Hallucination Rate | 3% | Blocked by guard |
| Knowledge Gap Detection | 95% | False positive: 5% |
| Relevance Score | 0.68 avg | Cosine similarity |
| Scenario | Tokens/Query | Cost/Query (Gemini Flash) |
|---|---|---|
| English (simple) | 50 | βΉ0.00015 |
| English (RAG) | 1,350 | βΉ0.00405 |
| Multilingual (cached) | 1,350 | βΉ0.00405 |
| Multilingual (first time) | 1,450 | βΉ0.00435 |
Monthly Cost Example:
- 10,000 queries/month
- 60% English, 30% Hindi, 10% Bengali
- 50% cache hit rate
- Total: βΉ42/month (~$0.50)
BotBlocks/
βββ backend/
β βββ main.py # FastAPI app entry
β βββ routes/
β β βββ chat_routes.py # Chat endpoints
β β βββ bot_routes.py # Bot management
β β βββ analytics_routes.py # Analytics API
β βββ services/
β β βββ rag_pipeline.py # Core RAG logic
β β βββ multilingual_service.py # Translation
β β βββ data_ingestion.py # Document processing
β β βββ analytics_service.py # Knowledge gap AI
β βββ db/
β β βββ models.py # SQLAlchemy models
β β βββ schemas.py # Pydantic schemas
β β βββ crud.py






