A FastAPI-based Retrieval-Augmented Generation (RAG) API that ingests documents, builds embeddings with SentenceTransformers, stores them in FAISS, and answers questions via a /query endpoint. [file:147]
This repository is designed to match the Generative AI & Chatbot Development: Python Assignment requirements (document ingestion, vector search, and API design). [file:147]
- Upload documents via
/upload:- Currently supports:
.txtand.pdf(easy to extend to.docx,.csv, images, and databases). [file:147]
- Currently supports:
- Extracts and preprocesses text (chunking with overlap). [file:147]
- Generates embeddings using
sentence-transformers/all-MiniLM-L6-v2. [web:56] - Stores embeddings in a FAISS vector index for fast similarity search. [web:68]
- Exposes
/queryendpoint:- Accepts a question and a
file_id. - Performs vector search and returns a context-based answer plus snippets. [file:147]
- Accepts a question and a
- Clean FastAPI structure ready for extension with OCR and LLM calls.
universal-rag-api/
│
├── main.py # FastAPI app (upload + query + RAG)
├── requirements.txt # Python dependencies
└── README.md # Documentation