CoolFace
Apppublic

BonusLockSMith/rag-citations

sourceHugging Faceupdated 15d agoView on Hugging Face
0likes
App README

RAG Q&A with Citations ๐Ÿ“š

Ask a question and get an answer grounded only in a curated knowledge base, with inline `[n]` citations to the exact sources โ€” and an honest "I don't know" when the answer isn't in the KB. No hallucinating past the sources. Demo knowledge base: construction & home remodeling.

Project #10 of my "30 AI Projects in 15 Days" build-in-public challenge.

โ–ถ Live demo: https://ask.gritai.solutions

[image]

Why it's different

Most chatbots will confidently make things up. This one is retrieval-grounded and attributed: it answers only from the sources it retrieved, cites each claim, and refuses to guess when the KB doesn't cover the question. That's the pattern real production RAG needs โ€” trust and traceability.

How it works

  • โ€”Chunk โ†’ embed โ†’ retrieve โ†’ answer. The KB is embedded with fastembed (BAAI/bge-small-en-v1.5, ONNX/CPU โ€” no GPU, no torch). A question is embedded and matched by cosine similarity to the top sources.
  • โ€”Grounded answer with forced tool-use: Claude answers using only the retrieved sources, returns inline [n] citations, and a found flag โ€” if the sources don't answer the question, it says so.
  • โ€”The UI shows the answer with clickable citations and the exact source passages below.

Run locally

bash
pip install -r requirements.txt
export ANTHROPIC_API_KEY=sk-ant-...
python app.py                            # http://127.0.0.1:7860

Deploy (always-on)

Ships with a Dockerfile โ€” works on Hugging Face Spaces, Render, Railway, or Fly.io. Set ANTHROPIC_API_KEY as a secret. Embeddings are local (no other keys).

Pro tier (roadmap): point it at your own private document set โ€” hosted, grounded, cited.


Built by Robert Lucyk ยท GritAI Solutions ยท part of the 30-in-15 challenge.