Browse by type
A high-performance Retrieval-Augmented Generation (RAG) system that enables users to ask natural language questions over their own documents. The application retrieves the most relevant information using semantic vector search and generates accurate, context-aware responses using Groq-hosted Llama 3.1 models.
Designed with a modular architecture, this project serves as a foundation for building AI-powered document assistants, enterprise knowledge bases, research assistants, and intelligent search systems.
.envflowchart TD
A([User Query])
B[Generate Query Embedding]
C[FAISS Vector Search]
D[Retrieve Top-K Relevant Chunks]
E[Construct Prompt with Retrieved Context]
F[Groq API
Llama 3.1]
G([Context-Aware Response])
A --> B
B --> C
C --> D
D --> E
E --> F
F --> G
flowchart TD
A[Load Documents]
B[Split into Chunks]
C[Generate Embeddings]
D[Build FAISS Index]
E[Store Vector Database]
F[User Query]
G[Generate Query Embedding]
H[Semantic Search]
I[Retrieve Top-K Chunks]
J[Prompt Construction]
K[Groq Llama 3.1]
L[Final Answer]
A --> B
B --> C
C --> D
D --> E
E --> F
F --> G
G --> H
H --> I
I --> J
J --> K
K --> L
| Component | Technology | Purpose |
|---|---|---|
| Language | Python | Core development |
| Embeddings | Sentence Transformers | Semantic vector embeddings |
| Vector Database | FAISS | Fast similarity search |
| Large Language Model | Llama 3.1 | Context-aware response generation |
| LLM Inference | Groq API | Low-latency inference |
| Environment Variables | python-dotenv | Secure API key handling |
doc_RAG/
│
├── core/
│ ├── embedder.py # Embedding model
│ ├── vector_db.py # FAISS index operations
│ ├── retriever.py # Semantic retrieval
│ └── groq_llm.py # Groq API integration
│
├── loaders/
│ ├── __init__.py
│ ├── json_loader.py
│ ├── pdf_loader.py
│ └── text_loader.py
│
├── data/
│ ├── colleges.json
│ ├── college_from_js.json
│ ├── sample.txt
│ └── document.pdf
│
├── build_index.py # Builds the vector database
├── rag_chat.py # Interactive chatbot
├── requirements.txt
├── .env
└── README.md
git clone https://github.com/your-username/universal-document-rag.git
cd universal-document-rag
pip install -r requirements.txt
Create a .env file in the project root.
GROQ_API_KEY=your_groq_api_key_here
⚠️ Never commit your
.envfile to GitHub.
python build_index.py
Expected Output:
Loading documents...
Generating embeddings...
Creating FAISS index...
Vector database built successfully.
python rag_chat.py
Where is Ariyalur Engineering College located?
Ariyalur Engineering College is located at:
NH-227, Trichy–Chidambaram Highway,
Karuppur-Senapathy Post,
Ariyalur District,
Tamil Nadu.
Contributions, issues, and feature requests are welcome!
This project is licensed under the MIT License.
If you found this project useful, please consider giving it a ⭐ Star on GitHub.
Your support helps improve the project and encourages future development.
$ claude mcp add AGH-Intern-Project \
-- python -m otcore.mcp_server <graph>