PDF GPT allows you to chat with the contents of your PDF file by using GPT capabilities. The most effective open source solution to turn your pdf files in a chatbot!
Demo URL: https://huggingface.co/spaces/bhaskartripathi/pdfChatter
Demo Video:
Despite so many fancy RAG solutions out there in Open Source and enterprise apps, pdfGPT is still the most accurate application that gives the most precise response. The first version was developed way back in 2021 as one of the world’s earliest RAG open source solutions. To this day (Dec, 2024), it still remains one of the most accurate ones due to its very simple and unique architecture. It uses no third-party APIs such as langchain. It uses embeddings but no vectorDB, no indexing. But, it still doesn’t compromise on the accuracy of response which is more critical than a fancy UI. The library documentation that you see below is a bit outdated as I do not get enough time to maintain it. However, if there is more demand then I am ready to put an enterprise grade RAG with more sophisticated retrieval tech available these days.
If you find the response for a specific question in the PDF is not good using Turbo models, then you need to understand that Turbo models such as gpt-3.5-turbo are chat completion models and will not give a good response in some cases where the embedding similarity is low. Despite the claim by OpenAI, the turbo model is not the best model for Q&A. In those specific cases, either use the good old text-DaVinci-003 or use GPT4 and above. These models invariably give you the most relevant output.
Run docker-compose -f docker-compose.yaml up
to use it with Docker compose.
sequenceDiagram
participant User
participant System
User->>System: Enter API Key
User->>System: Upload PDF/PDF URL
User->>System: Ask Question
User->>System: Submit Call to Action
System->>System: Blank field Validations
System->>System: Convert PDF to Text
System->>System: Decompose Text to Chunks (150 word length)
System->>System: Check if embeddings file exists
System->>System: If file exists, load embeddings and set the fitted attribute to True
System->>System: If file doesn't exist, generate embeddings, fit the recommender, save embeddings to file and set fitted attribute to True
System->>System: Perform Semantic Search and return Top 5 Chunks with KNN
System->>System: Load Open AI prompt
System->>System: Embed Top 5 Chunks in Open AI Prompt
System->>System: Generate Answer with Davinci
System-->>User: Return Answer
flowchart TB
A[Input] --> B[URL]
A -- Upload File manually --> C[Parse PDF]
B --> D[Parse PDF] -- Preprocess --> E[Dynamic Text Chunks]
C -- Preprocess --> E[Dynamic Text Chunks with citation history]
E --Fit-->F[Generate text embedding with Deep Averaging Network Encoder on each chunk]
F -- Query --> G[Get Top Results]
G -- K-Nearest Neighbour --> K[Get Nearest Neighbour - matching citation references]
K -- Generate Prompt --> H[Generate Answer]
H -- Output --> I[Output]
I am looking for more contributors from the open source community who can take up backlog items voluntarily and maintain the application jointly with me.
This project, graphGita, is the first modern re-interpretation of the Bhagavad Gita that utilizes Knowledge Graphs for accurate query retrieval and qunatify philosphical aspects to serve specific problem-solution needs. The ambitious goal is to incorporate over 200 versions of Gita interpretations written from time-to-time by different past and present scholars and integrate them in form of a sophisticated Knowledge Graph aided with modern retrieval technologies such as Monte Carlo Tree Search, and KG-RAG to provide a seamless multi-modal experience (text, image and video) to users. My primary goal is to increase readers’ comprehension of philosophical ideas while offering pertinent perspectives for modern readers. Based on the literature reviews of each of the 18 chapters and how they relate to one another, the text is formatted into a graph structure. This structure may grow more sophisticated and complex with due course of time as the project progresses. 🚀 💥
https://github.com/bhaskatripathi/graphGita
This project is licensed under the MIT License. See the LICENSE.txt file for details.
If you use PDF-GPT in your research or wish to refer to the examples in this repo, please cite with:
@misc{pdfgpt2023,
author = {Bhaskar Tripathi},
title = {PDF-GPT},
year = {2023},
publisher = {GitHub},
journal = {GitHub Repository},
howpublished = {\url{https://github.com/bhaskatripathi/pdfGPT}}
}