This project uses a vector database to index and search information in text documents, then generates intelligent responses based on the retrieved content using Large Language Models (LLMs).
Key Features
š Document Processing: Automatically loads and processes text documents
š Semantic Search: Uses embeddings for intelligent document retrieval
š¬ Conversational AI: Generates context-aware responses using Groq API
ā” Fast & Efficient: Leverages ChromaDB for quick vector similarity search
š Installation Prerequisites
Python 3.8 or higher
pip package manager
Setup Steps
Clone the repository:
bashgit clone https://github.com/mohamadlamg/Ready-tensor-RAG-assistant.git
cd Ready-tensor-RAG-assistant
Create a virtual environment (recommended):
bashpython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
Install dependencies:
bashpip install -r requirements.txt
Configure API keys:
Create a .env file at the project root:
envOPENAI_API_KEY=your_openai_key_here
GROQ_API_KEY=your_groq_key_here
š» Usage
Basic Usage
bashpython app.py
Code Example
Here's how the RAG system works:
pythonfrom vectordb import VectorDB
from langchain_groq import ChatGroq
vector_db = VectorDB()
vector_db.load_documents("data/")
query = "What is metaprogramming in Python?"
response = vector_db.query(query)
print(response)
Adding Your Own Documents
Simply place your .txt files in the data/ folder:
data/
āāā document1.txt
āāā document2.txt
āāā your_document.txt
š Project Structure
Ready-tensor-RAG-assistant/
ā
āāā app.py # Main application
āāā vectordb.py # Vector database management
āāā requirements.txt # Python dependencies
āāā .env # API keys (not tracked by git)
āāā .gitignore # Git ignore rules
ā
āāā data/ # Source documents
āāā Building_Modern_GUIs_with_Tkinter_and_Python.txt
āāā Metaprogramming-with-Python.txt
š ļø Technologies Used
TechnologyPurposeLangChainFramework for LLM applicationsChromaDBVector database for embeddingsGroqFast LLM inferenceHuggingFaceText embeddings
š§ Configuration
Model Selection
You can customize the LLM model in app.py.
š How It Works
mermaidgraph LR
A[Documents] --> B[Text Splitter]
B --> C[Embeddings]
C --> D[Vector DB]
E[User Query] --> F[Retrieval]
D --> F
F --> G[LLM]
G --> H[Response]
Document Loading: Load text files from the data/ folder
Text Splitting: Break documents into manageable chunks
Embedding: Convert text chunks into vector representations
Storage: Store vectors in ChromaDB
Query: User asks a question
Retrieval: Find relevant document chunks
Generation: LLM generates answer based on context
Thanks to the LangChain community for the amazing framework
HuggingFace for providing open-source embeddings
Groq for fast LLM inference
š§ Contact
Project Link: https://github.com/mohamadlamg/Ready-tensor-RAG-assistant