- This is a Python based application that allows you to chat with a bot/model based on the input of multiple PDF documents. You can ask questions about the PDFs using natural language, and the application will provide relevant responses based on the content of the documents. Utilizing GPT-4 as large language model to generate accurate answers to your queries.
The application follows these steps to provide responses to your questions:
-
PDF Loading: The app reads multiple PDF documents and extracts their text content.
-
Text Chunking: The extracted text is divided into smaller chunks that can be processed effectively.
-
Language Model: The application utilizes a language model to generate vector representations (embeddings) of the text chunks.
-
Similarity Matching: When you ask a question, the app compares it with the text chunks and identifies the most semantically similar ones.
-
Response Generation: The selected chunks are passed to the language model, which generates a response based on the relevant content of the PDFs.
- Python 3.9 (https://www.python.org/downloads/)
- pip (usually installed with Python)
-
Clone the repository:
git clone [https://github.com/Vamp-ECU/nlp-research-summarizer] cd project-name
-
Create a virtual environment (recommended):
python3 -m venv env source env/bin/activate
-
If you're using Windows, the activation command is:
.\venv\Scripts\Activate.ps1
-
Install dependencies:
pip install -r requirements.txt
-
Set up the environment variables:
Create a
.env
file in the root directory of the project and add the following variables:OPENAI_API_KEY=your_openai_api_key
Replace
your_openai_api_key
with your OpenAI API key.
-
Make sure your virtual environment is activated (if you created one).
-
Start the Flask development server:
flask run
- This typically starts the app at: http://127.0.0.1:5000/
To use the MultiPDF Chat App, follow these steps:
- Open the provided URL (e.g., http://127.0.0.1:5000/) in your web browser.
-
Ensure that you have installed the required dependencies and added the OpenAI API key to the
.env
file. -
Navigate to the Assistant page.
-
Load multiple PDF documents into the app by following the provided instructions.
-
Ask questions in natural language about the loaded PDFs using the chat interface.
- Security: When using pickle, be aware that unpickling data can execute arbitrary code if the data is crafted by a malicious user. Only unpickle data you trust.
- Redis Configuration: The above example assumes Redis is running on localhost with the default port 6379. Adjust these settings as necessary.
- Session Management: We’re using Flask’s session.sid as the Redis key for storing each user’s vectorstore. Ensure your Flask session is securely configured.
This repository is intended for educational purposes and does not accept further contributions.