Nexus / README.md
Sathya-BOT's picture
Upload 3 files
dbdf2ef verified
|
Raw
History Blame Contribute Delete
2.84 kB
# ⚑ Nexus AI β€” Smart Document Analyzer
A production-grade RAG (Retrieval-Augmented Generation) system for intelligent PDF Q&A with real semantic search, page-level citations, and multi-document support.
---
## πŸš€ Features
| Feature | Description |
|---|---|
| **Real Semantic Search** | Uses `sentence-transformers` + cosine similarity β€” not keyword matching |
| **Multi-PDF Support** | Upload and query across multiple documents simultaneously |
| **Page Citations** | Every answer shows exact source page + relevance score |
| **Auto Summary** | Document is summarized automatically on upload |
| **Dual API** | Switch between Groq (Llama 3.1) and Google Gemini with one click |
| **Conversation Memory** | Follow-up questions retain context from previous turns |
| **Export Chat** | Download your full Q&A session as a text file |
---
## πŸ›  Setup (Local)
### 1. Clone & install
```bash
git clone <your-repo>
cd nexus-ai
pip install -r requirements.txt
```
### 2. Get API keys (both free)
- **Groq**: https://console.groq.com β†’ Create API key
- **Gemini**: https://aistudio.google.com β†’ Get API key
### 3. Run
```bash
streamlit run app.py
```
Enter your API key(s) in the sidebar when the app opens.
---
## ☁️ Deploy to Streamlit Community Cloud (Recommended)
1. Push your code to a **public GitHub repo**
2. Go to [share.streamlit.io](https://share.streamlit.io)
3. Connect your GitHub β†’ Select `app.py`
4. Add secrets in **Settings β†’ Secrets**:
```toml
GROQ_API_KEY = "gsk_..."
GEMINI_API_KEY = "AIza..."
```
5. Click **Deploy** β€” done in ~2 minutes βœ…
---
## πŸ— Architecture
```
PDF Upload
β”‚
β–Ό
Page-by-Page Text Extraction (pypdf)
β”‚
β–Ό
Semantic Chunking (280 words, 55 overlap)
β”‚
β–Ό
Embedding Generation (all-MiniLM-L6-v2)
β”‚
β–Ό
In-memory Vector Store (numpy arrays)
β”‚
Query
β”‚
β–Ό
Semantic Search (cosine similarity, top-5)
β”‚
β–Ό
Context + Citations β†’ LLM (Groq / Gemini)
β”‚
β–Ό
Answer with Page Citations + Relevance Scores
```
---
## πŸ“ Project Structure
```
nexus-ai/
β”œβ”€β”€ app.py # Main application
β”œβ”€β”€ requirements.txt # Dependencies
└── README.md # This file
```
---
## πŸ”‘ Key Technical Concepts Demonstrated
- **RAG Pipeline** β€” Full retrieval-augmented generation from scratch
- **Semantic Embeddings** β€” Sentence transformers for meaning-based search
- **Vector Similarity** β€” Cosine similarity for chunk retrieval
- **LLM Integration** β€” Multi-provider API abstraction
- **Context Window Management** β€” Conversation history with truncation
- **PDF Processing** β€” Page-level text extraction and chunking
---
## 🏷 Tech Stack
`Python` `Streamlit` `sentence-transformers` `scikit-learn` `pypdf` `Groq API` `Google Gemini API` `NumPy`