CogniSure is an intelligent query-retrieval system built for the HackRx_6.0 Bajaj Hackathon. It allows users to upload insurance policy documents and ask complex, natural language questions to get contextual, AI-driven answers based on the content of those documents.
The system uses a modern RAG (Retrieval-Augmented Generation) architecture to understand the semantic meaning of both the documents and the user's queries, providing fast and accurate clause matching.
- 📄 Document Upload & Indexing: Easily upload new PDF documents directly through the web interface. The system automatically processes and indexes them into its knowledge base.
- 🧠 Natural Language Querying: Ask questions in plain English, not just keywords. The AI understands the intent and context of your query.
- 🤖 AI-Powered Retrieval: Utilizes a Sentence Transformer model (
all-MiniLM-L6-v2) and a FAISS vector index to find the most relevant clauses with high speed and accuracy. - 📊 Analytics Dashboard: A clean dashboard provides an overview of the system's status and a history of recent queries.
- ✨ Modern Interface: A sleek, dark-themed, and responsive user interface built with React and Tailwind CSS.
- Frontend: React, Tailwind CSS, Lucide Icons
- Backend: Python, Flask
- AI / Machine Learning:
sentence-transformersfor creating text embeddings.faiss(from Facebook AI) for efficient vector similarity search.pdfplumberfor PDF text extraction.
- Deployment: The application is bundled to be served by Flask and can be exposed publicly using
ngrok.
Follow these instructions to get the project running on your local machine.
- Python 3.8+ and
pip - Node.js 16+ and
npm
-
Clone the Repository:
git clone <your-repo-url> cd <your-repo-folder>
-
Setup the Python Backend:
- Navigate to the project root directory.
- Create and activate a virtual environment:
python -m venv venv # On Windows venv\Scripts\activate # On macOS/Linux source venv/bin/activate
- Install the required Python packages:
pip install -r requirements.txt
-
Setup the React Frontend:
- In the same project root directory, install the Node.js packages:
npm install
- In the same project root directory, install the Node.js packages:
-
Create the Initial Index:
- Place any initial PDF documents you want to index into the
uploaded_docsfolder. - Run the embedding script once to create the initial knowledge base:
python embed_documents_local.py
- Place any initial PDF documents you want to index into the
-
Start the Backend Server:
- Run the Flask application. This will serve both the backend API and the frontend UI.
python app.py
- The application should now be running on
http://localhost:5000.
- Run the Flask application. This will serve both the backend API and the frontend UI.
-
Access the Application:
- Open your web browser and navigate to
http://localhost:5000. - You can now use the "Upload" page to add more documents or the "Analyze" page to ask questions.
- Open your web browser and navigate to