Data and AI
PDF Q&A Bot (RAG System)
Upload a PDF to a Streamlit app, ask questions in plain English, and get answers with the pages they came from, retrieved from a FAISS index of sentence-transformers embeddings. It tries OpenAI, then a local Ollama server, and with no LLM configured it still answers with the retrieved passages verbatim.
Overview
Install
- Install the dependencies.
pip install -r requirements.txt
- Write the sample PDF to
sample_docs/handbook.pdf.
python generate_sample_pdf.py
- Run the smoke test to ingest the PDF and retrieve the right page.
python test_ingest.py
- Start the Streamlit app.
streamlit run app.py
To get LLM-composed (rather than extractive) answers, set OPENAI_API_KEY
or run Ollama locally (ollama serve + ollama pull llama3) before asking
questions.
Docs
The full documentation covers how it works, configuration and results.