Skip to content

An AI-powered application that lets you upload a PDF and pose queries about its content, utilizing OpenAI's LLMs for generating answers.

Notifications You must be signed in to change notification settings

sinclairfr/PDF_QA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🦜️🔗 PDF Questions and Answers on your PDF with LangChain

This repo is an implementation of a locally hosted chatbot specifically focused on question answering on your onw PDF. Small app built following the LangChain documentation.

Deployed version: chat.langchain.com

✅ Running locally

  1. Install backend dependencies: pip install -r requirements.txt.
  2. Rename the .env.example to .env
  3. Enter your OpenAI API key in the environment variables in the .env file:
OPENAI_API_KEY="sk-***"
  1. Run streamlit main.py
  2. Open localhost:3000 in your browser.

📚 Technical description

The application reads the PDF and splits the text into smaller chunks that can be then fed into a LLM. It uses OpenAI embeddings to create vector representations of the chunks. The application then finds the chunks that are semantically similar to the question that the user asked and feeds those chunks to the LLM to generate a response.

The application uses Streamlit to create the GUI and Langchain to deal with the LLM.

There are two components:

  • embeddings
  • question-answering.

process

Source : Benny Cheung

Question-Answering has the following steps, all handled by OpenAIFunctionsAgent:

  1. Given the user input question, determine what a standalone question would be (using GPT-3.5).
  2. Given that standalone question, look up relevant documents chunks.
  3. Pass the standalone question and relevant document chunks to GPT to generate and stream the final answer.

🚀 Deployment

TODO : docker deployment

Contributing

This repository is for educational purposes only and is not intended to receive further contributions. It is supposed to be used as support material for the YouTube tutorial that shows how to build the project.

Blog Posts:

About

An AI-powered application that lets you upload a PDF and pose queries about its content, utilizing OpenAI's LLMs for generating answers.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages