Skip to content

Latest commit

Β 

History

57 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

# πŸ€– Neurabot - AI-Powered RAG Chatbot


> **Retrieval-Augmented Generation (RAG) Full-Stack Chatbot**
> A sophisticated AI chatbot that leverages your custom documents and institutional reports to provide intelligent, context-aware responses about technology trends and industry insights.

---

## 🌟 Live Demo

| Platform | Link |
| :--- | :--- |
| **πŸš€ Vercel** | [**View Live Demo**](https://neurabot-sepia.vercel.app) |
| **πŸš€ CodeAwake** | [**Alternative Demo**](https://tech-trends-chatbot.codeawake.com) |

---

## 🎯 Overview

Neurabot is a **full-stack application** combining **Large Language Models (LLMs)** with **custom document retrieval** (Vector Search). It is designed to ingest authoritative sources (PDFs, Reports) and answer complex queries with high factual accuracy.

### 🏒 Data Sources Integration
The current model is trained/indexed on reports from:
* **World Bank** (Economic Data)
* **World Economic Forum** (Global Trends)
* **McKinsey & Deloitte** (Business Intelligence)
* **OECD** (Social Data)

---

## ✨ Key Features

### 🧠 Advanced AI Capabilities
* **RAG Architecture:** Combines LLM reasoning with semantic document retrieval.
* **Context-Aware:** Remembers previous turns in the conversation.
* **Multi-Source:** Seamlessly integrates diverse institutional reports.

### πŸ“Š Data Management
* **Vector Search:** Powered by **Redis Stack** for millisecond-latency retrieval.
* **Document Support:** PDF, TXT, and DOCX ingestion.
* **Export:** Download chat history as JSON.

### 🎨 User Experience
* **Modern UI:** Built with React & Vite (Dark/Light mode).
* **Responsive:** Optimized for mobile and desktop.

---

## πŸ—οΈ Architecture

```text
Neurabot/
β”œβ”€β”€ πŸ“‚ backend/                 # FastAPI Application (Python)
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/            # REST Endpoints
β”‚   β”‚   β”œβ”€β”€ assistants/     # RAG & LLM Logic
β”‚   β”‚   β”œβ”€β”€ loader.py       # Document Ingestion Script
β”‚   β”‚   └── prompts/        # System Instructions
β”‚   β”œβ”€β”€ data/               # Local Document Storage
β”‚   └── pyproject.toml      # Poetry Dependencies
β”‚
β”œβ”€β”€ πŸ“‚ frontend/                # React Application (TypeScript)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/     # UI Components
β”‚   β”‚   └── services/       # API Integration
β”‚   └── vite.config.ts      # Build Config
β”‚
└── 🐳 docker-compose.yml       # Container Orchestration

πŸš€ Quick Start

Prerequisites

  • Python 3.11+ (Managed by Poetry)
  • Node.js 18+
  • Redis Stack (Must support RedisJSON & RediSearch)
  • OpenAI API Key

πŸ“¦ Installation

1. Clone Repository

git clone [https://github.com/RezaSbu/Neurabot.git](https://github.com/RezaSbu/Neurabot.git)
cd Neurabot

2. Backend Setup

cd backend

# Install dependencies with Poetry
poetry install

# Configure Environment
cp .env.example .env
# Edit .env and add your OPENAI_API_KEY

# Load/Index Documents into Redis
poetry run load

# Start Backend Server
poetry run dev

3. Frontend Setup

cd frontend

# Install dependencies
npm install

# Configure Environment
cp .env.example .env.development

# Start Frontend Server
npm run dev

4. Access Application

  • Frontend: http://localhost:3000
  • Backend Docs: http://localhost:8000/docs

βš™οΈ Configuration

Backend Variables (backend/.env)

OPENAI_API_KEY=sk-...
REDIS_URL=redis://localhost:6379
ENVIRONMENT=development
LOG_LEVEL=INFO

Frontend Variables (frontend/.env.development)

VITE_API_URL=http://localhost:8000
VITE_APP_NAME=Neurabot

πŸ”§ Advanced Usage & Customization

1. Adding Custom Data

To train the bot on your own data:

  1. Place your PDF or TXT files in backend/data/docs/.
  2. Run the ingestion script:
    poetry run load

2. Modifying AI Behavior

Edit backend/app/assistants/prompts.py to change the system persona:

SYSTEM_PROMPT = """
You are an expert Technical Consultant.
Answer strictly based on the provided context.
"""

3. Model Tuning

Adjust parameters in backend/app/config.py:

MODEL_CONFIG = {
    "model": "gpt-4",
    "temperature": 0.1,  # Lower for more factual answers
    "max_tokens": 2000
}

🐳 Deployment (Docker)

For production deployment using Docker Compose:

# Build and start services
docker-compose up -d --build

# Scale backend (optional)
docker-compose up -d --scale backend=3

Production Configuration (docker-compose.prod.yml): Ensure REDIS_URL points to the container name (redis:6379) and ENVIRONMENT is set to production.


πŸ§ͺ Testing

Component Command
Backend cd backend && poetry run pytest
Frontend cd frontend && npm test
API (Curl) curl -X POST http://localhost:8000/chat ...

🀝 Contributing

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/amazing-feature).
  3. Commit your changes.
  4. Run tests (poetry run pytest).
  5. Open a Pull Request.

πŸ“ˆ Roadmap

  • Multi-Language Support: Internationalization (i18n).
  • Voice Integration: Speech-to-text and TTS.
  • Plugins: Third-party tool integration.
  • Mobile App: Native iOS/Android wrapper.

πŸ“ž Support & Community


πŸ“„ License

This project is licensed under the MIT License.


Built with ❀️ by Reza Ahmadi

About

Full-stack RAG chatbot - answers questions from your custom documents with retrieval-augmented generation

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages