AI Question Answering for PDFs
Upload a PDF and ask questions: the system finds the relevant passages and the AI writes an answer from that document.
- Status
- Prototype
- Layers
- AIBackendData
- Used by
- Staff or customers who often hunt for answers in manuals, SOPs, or policies; currently a prototype.

The problem
Digging through thick manuals, SOPs, or policies takes staff time and often leads to inconsistent answers.
The solution
The document is split into chunks, embedded, and stored in PostgreSQL with pgvector. For each question, the most relevant chunks are retrieved and Llama 3.3 via Groq writes the answer.
How it works
What happens, step by step, from the user's point of view.
- 01
Upload a PDF
The user uploads a PDF on a web page. Only PDF files are accepted.
- 02
The document is split up
The text is read page by page, then split into short, slightly overlapping chunks so the context isn't cut off.
- 03
Chunks become vectors
Each chunk is turned into a string of numbers that captures its meaning, then stored in PostgreSQL with pgvector.
- 04
The user asks a question
The user types a question in plain words, for example about a procedure in the manual.
- 05
The most relevant passages are found
The system picks a few chunks closest in meaning to the question while avoiding near-duplicates (MMR).
- 06
The AI writes the answer
Llama 3.3 via Groq answers using only those chunks. If the answer isn't in the document, it is told to say "I don't know".
System design
Who uses it, what they see, what works behind the scenes, and where the data lives. Read it from left to right.
1People
- Staff or customerUploads a PDF and asks questions
2What they see
- Streamlit pageWhere you upload the PDF, type a question, and read the answer
3Behind the scenes
- API serverFastAPI runs the RAG flow: find passages, then ask the AI to answer
- Embedding modelSentence Transformers turns text into meaning vectors
- RAGAS evaluationMeasures whether answers stay true to the document and on topic
4Data and outside services
- PostgreSQL + pgvectorStores document chunks and their vectors so they can be searched
- Groq (Llama 3.3)The AI model that writes answers from the document passages
Key features
- Upload PDFs on the web
- Relevant-passage retrieval (MMR)
- Answers from Llama 3.3
- Quality evaluation with RAGAS
- FastAPI backend, Streamlit UI
Built with
- Python
- FastAPI
- Streamlit
- LangChain
- PostgreSQL
- pgvector
- Groq API
- Sentence Transformers
- RAGAS
- MLflow
- PyMuPDF
- Docker
What the business gets
- Answers come from the official document, not from each staff member's memory.
- Staff don't have to reread a thick document for a single question.
- The AI is instructed to admit when the answer isn't in the document.
- Answer quality can be measured against a test question set before wider use.
Terms on this page
- RAG
- Retrieval-Augmented Generation: the AI first finds the relevant parts of a document, then writes its answer from them.
- Embedding
- A list of numbers that captures what a text means, so similar sentences can be found even with different wording.
- pgvector
- An add-on that lets a PostgreSQL database store and search meaning vectors.
- MMR
- A way to pick search results that are relevant yet varied, so the AI isn't handed the same passage twice.
Can it work for your business?
Can become an internal assistant for your SOPs, product manuals, or company policies, so staff and customers get consistent answers from official documents.
Ask about this project