Skip to content

Repository files navigation

BIS Intel-Bot: Enterprise RAG Intelligence System for Bureau of Indian Standards

Next.js TypeScript Google Gemini Pinecone License: MIT

BIS Intel-Bot is an enterprise-grade Retrieval-Augmented Generation (RAG) system engineered to solve the complex accessibility challenge surrounding Indian Standards (IS), Bureau of Indian Standards (BIS) certifications, compulsory registration schemes (CRS), and quality compliance frameworks.

Designed with zero-hallucination constraints, dynamic multi-query decomposition, key-rotation fault tolerance, and streaming citation metadata, BIS Intel-Bot provides instantaneous, verified regulatory intelligence to citizens, manufacturers, and compliance auditors.


Key Real-World Problem Addressed

Navigating public regulatory documents like BIS specifications involves parsing thousands of pages across heterogeneous formats (.pdf, .md, .docx, web tables). Traditional search engines fail on normative queries requiring exact cross-references (e.g., comparing Scheme-I ISI marking with Scheme-II CRS for IT products, or identifying exact voltage parameters under IS 694).

BIS Intel-Bot resolves this by:

  1. Performing high-density vector search over verified BIS document corpora.
  2. Decomposing compound user queries into parallel sub-vector searches.
  3. Enforcing deterministic grounding and anti-hallucination system constraints.
  4. Supplying verifiable direct source URLs for every regulatory assertion.

Architectural Overview

                          ┌───────────────────────────┐
                          │   Client Application      │
                          │ Next.js 16 + React 19 UI  │
                          └─────────────┬─────────────┘
                                        │
                                HTTP POST /api/chat
                                (JSON Message Stream)
                                        │
                                        ▼
                          ┌───────────────────────────┐
                          │    Next.js Route Engine   │
                          │   Query Decomposition     │
                          └─────────────┬─────────────┘
                                        │
                 ┌──────────────────────┴──────────────────────┐
                 │                                             │
                 ▼                                             ▼
  ┌─────────────────────────────┐               ┌─────────────────────────────┐
  │   Gemini Embedding Engine   │               │   Pinecone Vector Index     │
  │     (gemini-embedding-001)  │               │    Cosine Similarity Search │
  └──────────────┬──────────────┘               └──────────────┬──────────────┘
                 │                                             │
                 └──────────────────────┬──────────────────────┘
                                        │
                                Context Documents
                                        │
                                        ▼
                          ┌───────────────────────────┐
                          │    System Prompt Engine   │
                          │  Grounding & Citation Rules│
                          └─────────────┬─────────────┘
                                        │
                                        ▼
                          ┌───────────────────────────┐
                          │ Resilient Gemini Pool     │
                          │ (Key Rotation & Backoff)  │
                          └─────────────┬─────────────┘
                                        │
                           Streamed Server Response
                                (X-Sources Header)

Engineering Innovations & Enterprise Features

1. High-Throughput API Key Rotation Pool (src/lib/gemini.ts)

  • Implements thread-safe, state-aware API key rotation across multi-key pools.
  • Automatically handles HTTP 429 (Too Many Requests) and 500 (Internal Server Error) by marking rate-limited credentials as exhausted and falling back gracefully without dropping active user web streams.

2. Contextual Multi-Query Search Decomposition

  • Parses user prompts into discrete logical query vectors.
  • Correlates multi-turn conversation memory with vector retrieval to preserve context across complex multi-step user dialogues.

3. Strict Anti-Hallucination Grounding Prompt

  • System instructions strictly isolate the LLM's operational context to retrieved Pinecone vectors.
  • If parameters (fees, timelines, or standard numbers) are absent from current vector indices, the system explicitly reports data unavailability rather than interpolating values.

Getting Started

Prerequisites

  • Node.js ^20.0.0 or later
  • npm ^10.0.0 or later
  • Pinecone Index with 768-dim embeddings (gemini-embedding-001)

Installation & Environment Setup

  1. Clone the repository:

    git clone https://github.com/your-username/bis-intel-bot.git
    cd bis-intel-bot
  2. Install dependencies:

    npm install
  3. Configure Environment Variables: Create .env.local in the project root:

    PINECONE_API_KEY=your_pinecone_api_key
    PINECONE_INDEX=bis-standards
    FIRECRAWL_API_KEY=your_firecrawl_api_key
    GOOGLE_GENERATIVE_AI_API_KEYS=key1,key2,key3
  4. Execute TypeScript Verification:

    npx tsc --noEmit
  5. Start Development Server:

    npm run dev

    Open http://localhost:3000 to access the production interface.


Production Deployment

This application is ready for zero-downtime deployment on Vercel, AWS Amplify, or Docker container environments:

npm run build
npm run start

License

Distributed under the MIT License. See LICENSE for full licensing terms.

About

Enterprise RAG Intelligence System for Bureau of Indian Standards - Gemini Vision, Pinecone vector search, multi-query decomposition

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages