Ask questions from any PDF using OpenAI + LangChain + Chroma.
This project lets you upload a PDF and ask natural language questions about its content. It uses:
git clone https://github.com/yourname/langchain-pdf-qa.git
cd langchain-pdf-qa
poetry install
Create a .env
file based on the example:
cp .env.example .env
Then edit .env
and replace with your API key.
poetry run python ask_pdf.py
Place a PDF file (e.g., example.pdf
) in the root and run the script. You’ll be prompted to ask questions like:
- "What is this document about?"
- "Who is the author?"
- "Summarize the key findings."
Type exit
to quit.
Ask a question (or type 'exit'): What is the main purpose of this document?
Answer: This document provides an overview of ...
.
├── ask_pdf.py
├── example.pdf # Your PDF file (not committed)
├── .env # Your API key (not committed)
├── .env.example
├── pyproject.toml
├── README.md
├── .gitignore
Do not commit your .env
file or PDF files to GitHub. Use .gitignore
to keep them private.
- Add a Streamlit or Flask UI
- Use FAISS or Pinecone as vector store
- Deploy to Hugging Face Spaces or Render
MIT — free to use and modify.