SaiAkhil066/CORTEX-AI-SUPER-RAG
CORTEX RAG is an enterprise retrieval and knowledge assistant that helps teams find accurate answers from company data with citations, permission-aware retrieval, and fast deployment
Cortex AI SUPER RAG – What it is
Cortex RAG is a local, open‑source Retrieval‑Augmented Generation (RAG) system that lets you upload PDFs, Word files or plain‑text documents and ask natural‑language questions about them. All processing happens on your own machine via Ollama (no cloud API keys). The app shows you exactly which document and page each answer comes from.
Core ideas & how it works
- Document ingestion – Files are split into chunks that retain the original file name and page number. Optionally a short “situating” sentence is added to each chunk (Contextual Retrieval).
- Hybrid search – For every query the system runs a BM25 keyword search and a FAISS vector search (using
nomic‑embed‑text). The top‑20 results from each are merged with Reciprocal Rank Fusion. - Optional enrichments –
- Follow‑up rewriting turns chat‑history fragments into a full question.
- Source routing limits the search to a file whose name appears in the query.
- GraphRAG builds a lightweight entity‑co‑occurrence graph and pulls in related passages.
- Neural reranker (cross‑encoder
ms‑marco‑MiniLM‑L‑6‑v2) re‑orders the ~40 candidates. - Corrective RAG (CRAG) lets an LLM drop passages that seem irrelevant.
- HyDE / RAG‑Fusion generate hypothetical answers or multiple re‑phrasings to broaden retrieval.
- Answer generation – The chosen LLM (default
llama3.1:8bfrom Ollama) receives the final set of passages, builds a prompt, streams the answer, and appends citations likefile.pdf · p.12. - Evaluation harness – A built‑in tool can run a set of questions against different pipeline configurations, reporting hit‑rate, MRR, correctness and faithfulness (e.g., the FinanceBench benchmark included in the repo).
What you get out of the box
- Cited, source‑grounded answers with page numbers.
- Persisted knowledge bases stored under
indexes/<name>/that survive restarts. - Sidebar UI to toggle every technique on/off and to switch between installed Ollama models.
- Timing panel showing how long each stage took for a given query.
- Built‑in evaluation for measuring the impact of each component on your own documents.
Who would find this useful?
- Analysts, lawyers, researchers who need to query large collections of PDFs/Word docs without sending data to a third‑party service.
- Developers who want a ready‑made RAG pipeline they can extend (the code lives in
utils/andeval/). - Teams looking for a reference implementation to benchmark hybrid search, reranking, GraphRAG, etc., on private data.
Limitations to keep in mind
- Single‑user, no authentication – not safe to expose publicly.
- No OCR – scanned PDFs are ignored.
- Tables are flattened to plain text, which can hurt financial‑statement queries.
- Arithmetic is weak with an 8B LLM; the model may refuse rather than hallucinate.
- Speed varies: basic hybrid search is sub‑second, but enabling HyDE, RAG‑Fusion or CRAG can push response times to tens of seconds.
Getting started (quick recap)
# clone & install
git clone https://github.com/SaiAkhil066/CORTEX-AI-SUPER-RAG.git
cd CORTEX-AI-SUPER-RAG
pip install -r requirements.txt
# pull models via Ollama
ollama pull llama3.1:8b
ollama pull nomic-embed-text
# run the Streamlit UI
python -m streamlit run app.py # → http://localhost:8501
You can also use the provided Docker compose setup, which runs Ollama on the host and the app in a container.
Where to look next
utils/– core pipeline code (retriever_pipeline.py,advanced_rag.py,build_graph.py).eval/– scripts for running FinanceBench or your own golden‑set evaluations.app.py– Streamlit front‑end, model selector, and the sidebar that toggles components.- Contributing – run
pytestbefore PRs; include before/after evaluation numbers for any retrieval changes.
All details above are taken directly from the repository’s README.
Related
- Project
- Project
- Dispatch
- Project
- Project