A simple Retrieval-Augmented Generation (RAG) system that loads local text files, embeds them using SentenceTransformer, stores them in ChromaDB, and generates answers using Groqβs LLaMA 3 model.
- Local embeddings (no OpenAI required)
- Persistent vector DB via ChromaDB
- Query documents with semantic search
- LLaMA 3 (Groq) for answers
- Minimal, single-file implementation (
main.py)
main.py
news_articles/ # .txt documents
chroma_persistent_storage/ # auto-generated (ignored)
.env # contains GROQ_API_KEY
requirements.txt
.gitignore
venv/
Create a .env file:
GROQ_API_KEY=your_groq_api_key_here
Install dependencies:
pip install -r requirements.txt
python main.py
Edit the question in main.py:
question = "tell me about databricks"- Load
.txtfiles - Chunk them
- Generate embeddings with
all-MiniLM-L6-v2 - Store in ChromaDB
- Retrieve relevant chunks
- Send context β Groq LLaMA 3 β get answer