8000 GitHub - testpress/langchain-pdf-qa
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

testpress/langchain-pdf-qa

Repository files navigation

📄 LangChain PDF Q&A

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:


🔧 Setup

1. Clone the repo

git clone https://github.com/yourname/langchain-pdf-qa.git
cd langchain-pdf-qa

2. Install dependencies

poetry install

3. Add your OpenAI API key

Create a .env file based on the example:

cp .env.example .env

Then edit .env and replace with your API key.


▶️ Run the Q&A CLI

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.


🧪 Example

Ask a question (or type 'exit'): What is the main purpose of this document?

Answer: This document provides an overview of ...

📁 Project Structure

.
├── ask_pdf.py
├── example.pdf        # Your PDF file (not committed)
├── .env               # Your API key (not committed)
├── .env.example
├── pyproject.toml
├── README.md
├── .gitignore

🛡️ Note

Do not commit your .env file or PDF files to GitHub. Use .gitignore to keep them private.


💡 Ideas for Extension

  • Add a Streamlit or Flask UI
  • Use FAISS or Pinecone as vector store
  • Deploy to Hugging Face Spaces or Render

🧑‍💻 License

MIT — free to use and modify.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0