A Retrieval-Augmented Generation (RAG) assistant for interactive document-based Question Answering.
Upload PDFs, DOCX, TXT, Markdown, or JSON files, and interact with them via Streamlit UI, CLI, or FastAPI API.
- π Multi-format ingestion: PDF, DOCX, TXT, MD, JSON
- βοΈ Smart text splitting with overlapping chunks
- π§ Vector embeddings using SentenceTransformers
- π ChromaDB persistence for long-term storage
- π€ LLM providers: Groq & OpenAI
- π₯ Multiple interfaces: Streamlit UI, CLI, FastAPI
- π Config-driven via
config.yaml - π Source citation for transparency
- Clone and Install
git clone https://github.com/ak-rahul/RAG-Assistant.git
cd RAG-Assistant
pip install -r requirements.txt
- Set API Key
echo "GROQ_API_KEY=your_key_here" > .env
π‘ Get free key at: https://console.groq.com/
- Run the App
python cli.py web
- Try the Sample
- We included
data/sample.txtto get started - Ask: "What is RAG?" or "List the benefits"
- Upload your own documents and explore!
π More examples in examples/
Get answers with cited sources
rag-assistant/
β
βββ app.py # Streamlit UI
βββ cli.py # CLI entrypoint
βββ config.yaml # Config file
βββ requirements.txt # Dependencies
βββ scripts/ # Helper scripts
β βββ rag.sh
β βββ rag.bat
βββ src/
β βββ config.py
β βββ logger.py
β βββ server.py # FastAPI app
β βββ pipeline/
β β βββ rag_pipeline.py
β βββ db/
β β βββ chroma_handler.py
β βββ ingestion/
β β βββ ingest.py
β βββ utils/
β βββ file_loader.py
β βββ text_splitter.py
β
βββ data/ # Uploaded docs
βββ logs/ # Logs
βββ README.mdconfig.yaml controls everything:
data:
source_dir: "./data"
allowed_ext: [".pdf", ".docx", ".txt", ".md", ".json"]
vector_store:
persist_directory: "./.chroma"
embedding_model: "sentence-transformers/all-MiniLM-L6-v2"
top_k: 4
ingestion:
chunk_size: 1200
chunk_overlap: 150
llm:
provider: groq
model: llama-3.1-8b-instant
temperature: 0.2
max_tokens: 512π Environment overrides via .env:
GROQ_API_KEY=...
OPENAI_API_KEY=...- Python 3.9 or higher [attached_file:1][attached_file:2]
- Groq API key (free tier available at console.groq.com)
- 2GB disk space for vector embeddings
- (Optional) OpenAI API key for alternative LLM
git clone https://github.com/ak-rahul/rag-assistant.git
cd rag-assistantpython -m venv .venv
source .venv/bin/activate # (Linux/Mac)
.venv\Scripts\activate # (Windows)pip install -r requirements.txtCreate a .env file in the project root:
GROQ_API_KEY=your_groq_api_key
OPENAI_API_KEY=your_openai_api_key # optionalLaunch the Streamlit UI:
python cli.py web-
Upload documents in the sidebar
-
Ask questions in the chat interface
-
Inspect DB stats or clear DB
Ingest Documents
python cli.py ingestQuery
python cli.py query "What is Kali Linux?"Run API Server
python cli.py serveShow DB Stats
python cli.py statsClear DB
python cli.py clearflowchart TD
A[User Uploads Files] --> B[File Loader]
B --> C[Text Splitter]
C --> D[ChromaDB Vector Store]
D --> E[Retriever]
E --> F[LLM via Groq/OpenAI]
F --> G[Answer + Sources]
- Upload a PDF in the Streamlit sidebar
- The file is chunked and ingested into ChromaDB
- Ask a question like:
- "What is covered in Chapter 2 of the Kali Linux PDF?"
- The system retrieves relevant chunks β sends them to the LLM β returns an answer with sources
- All documents are persisted in ChromaDB inside ./.chroma
- You can check stats (total docs, embeddings, metadata)
- Use Clear DB to reset your database
GROQ_API_KEY not set : Create .env file with your API key
echo "GROQ_API_KEY=gsk_your_key" > .env
ChromaDB errors
python cli.py clear # Clear database
python cli.py ingest # Re-ingest documents
No documents found
- Ensure files are in
./datafolder - Run
python cli.py ingest
Slow responses
- Reduce
top_kinconfig.yaml(4 β 2)
Need help? Open an issue
- Python 3.9+
- Streamlit β Web UI
- LangChain β RAG pipeline
- ChromaDB β Vector store
- Groq LLM β LLM provider
- OpenAI (optional) β Alternative LLM provider
This project is licensed under the MIT License.

