Ask questions about a PDF and get answers grounded in its content.
A Streamlit app that lets you upload one or more PDFs and query them in natural language. Text is extracted, chunked, embedded, and indexed with FAISS; a retrieval-augmented chain answers questions using only the retrieved passages, with conversation memory across turns.
- Extract — text is pulled from every page of the uploaded PDFs (
PyPDF2). - Chunk — text is split into overlapping chunks for retrieval
(
RecursiveCharacterTextSplitter). - Embed & index — chunks are embedded (
HuggingFaceInstructEmbeddings) and stored in a FAISS vector store. - Answer — a conversational retrieval chain (LangChain + Google PaLM) answers questions using the most relevant chunks, remembering prior turns in the session.
pip install -r requirements.txtCreate a .env file with your Google API key:
GOOGLE_API_KEY=your-api-key-here
streamlit run multipdf.py- Streamlit
- LangChain + Google PaLM (
langchain_community.llms.GooglePalm) - FAISS (
faiss-cpu) - PyPDF2
- HuggingFace Instructor embeddings
MIT