The Multi-PDF Chatbot is a Python application that allows user to chat with multiple PDF documents using LangChain and ChatGPT API. Users can ask questions about the PDFs in natural language and the application will provide relevant responses based on the content of the documents. This app utilizes a language model to generate accurate answers to your queries. Please note that the app will only respond to questions related to the loaded PDFs.
![image](https://private-user-images.githubusercontent.com/100280753/310466544-68ee9249-b48a-42f2-a593-fdc3c3948867.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ5MDg1NTAsIm5iZiI6MTcyNDkwODI1MCwicGF0aCI6Ii8xMDAyODA3NTMvMzEwNDY2NTQ0LTY4ZWU5MjQ5LWI0OGEtNDJmMi1hNTkzLWZkYzNjMzk0ODg2Ny5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyOVQwNTEwNTBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lYjM5OGU4NjdjNThiZmE3ZWIwM2VhYWIxZGYyMzEwMjRmN2U1OWZlZDNiMzk5NDRhZDY1MmZjZmQyYWQ0MTJjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.pSn1n28EwGrGkjfp0S8Nm4avSIB-22aMnrI5dPw5RRE)
- PDF Text Extraction: Efficiently extracts text from multiple PDF documents, providing a comprehensive source for information retrieval.
- Text Chunking: Divides the extracted text into manageable chunks, optimizing processing and ensuring efficient handling of large datasets.
- Embeddings Generation: Utilizes OpenAIEmbeddings to generate vector representations of text chunks, enhancing the semantic understanding of content. You can also use HuggingFaceInstructEmbeddings and search for your own embedding models in HuggingFace.
- Vector Store Creation: Creates a vector store using FAISS, enabling efficient storage and retrieval of text representations for improved performance.
- Conversational Chain: Establishes a Conversational Retrieval Chain using ChatOpenAI, facilitating dynamic interactions with the loaded PDF content.
- Memory Management: Implements a ConversationBufferMemory to store and retrieve chat history, enhancing context awareness for more coherent responses.
- User-Defined Models: Allows flexibility in choosing different text-to-text generation models in Huggingface (Need to configure your HUGGINGFACEHUB_API_TOKEN), enabling adaptation to specific project requirements.
- Python 3.9
-
Clone the repository:
git clone https://github.com/YouXuan2010/Multi-PDF-Chat-App.git
-
Install the required dependencies:
pip install -r requirements.txt
-
Obtain an API key from OpenAI and HuggingFace (If you want to use HuggingFace Models) and add it to the .env file under the project directory:
OPENAI_API_KEY=sk-XXXXXXXXX HUGGINGFACEHUB_API_TOKEN=XXXXXXXXXXX
Run the main.py file using the Streamlit CLI:
streamlit run app.py