A modern Retrieval-Augmented Generation (RAG) app built from your notebook workflow.
main.py: reusable backend engine for ingestion, chunking, indexing, retrieval, and answer generationapp.py: modern Streamlit UI with polished styling, chat layout, and live system status cardsrequirements.txt: project dependencies
- Ingest files:
.txt,.md,.pdf,.wav,.mp3,.mp4,.m4a,.flac,.ogg,.png,.jpg,.jpeg,.webp - Audio transcription via Whisper
- Text chunking by words
- Multimodal RAG with image captions (Groq vision model)
- Embeddings via Jina Embeddings v4 API
- Vector search with FAISS
- Cross-encoder reranking for improved relevance
- Guardrails for context-only answers
- Session memory and latency tracking in the UI
- Optional vision-at-answer for image Q&A plus image previews in context
- Metadata filtering (text-only / image-only / both)
- Dashboard-style UI with status cards and tabbed workflows
- Quick prompts, adjustable answer temperature, and downloadable chat history (JSON)
- Source Library tab to inspect indexed chunks by source/modality
- Retrieval Inspector tab to test candidate retrieval and reranked results
- Source-level analytics (chunks/text/image counts per file)
- Remove selected sources and auto-rebuild index
- Manual index rebuild action from the sidebar
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txtSet your API keys:
set GROQ_API_KEY=your_groq_api_key_here
set JINA_API_KEY=your_jina_api_key_hereOr provide them in the Streamlit sidebar at runtime.
streamlit run app.pyAdvance_RAG/
app.py
main.py
requirements.txt
README.md
Advance_RAG(11_02_2026).ipynb
from main import AdvanceRAG
rag = AdvanceRAG(groq_api_key="your_key")
rag.ingest_txt_bytes(open("notes.txt", "rb").read(), source="notes.txt")
rag.build_index()
print(rag.answer("Summarize the key topics"))- Do not hardcode API keys in source files.
- First run of Whisper may download model weights, so audio transcription can take longer.
- For large files, prefer smaller
top_kand tunechunk_sizefrom the UI sidebar. - Cross-encoder reranking uses
sentence-transformersand can add startup latency on first load.
- Push this repo to GitHub.
- In Streamlit Cloud, set
app.pyas the entrypoint. - Add secret in app settings:
GROQ_API_KEY = "your_groq_api_key_here"
JINA_API_KEY = "your_jina_api_key_here"- Deploy.
Notes:
runtime.txtpins Python for better binary wheel compatibility on Streamlit Cloud.- Audio transcription needs both
openai-whisperandffmpeg; if unavailable, the app still runs and skips audio files.