This project implements a FastAPI-based web service that allows users to upload PDF documents, ask questions about the content, and receive answers posted to Slack.
- PDF upload and processing
- Question answering based on PDF content
- Posting results to Slack
- FastAPI web service with Swagger UI
- Python 3.8+
- FastAPI
- OpenAI API
- PyPDF2
- Slack SDK
-
Clone the repository:
git clone https://github.com/whiletruelearn/pdf-chat.git cd pdf-chat -
Install the required packages:
pip install -r requirements.txt -
Set up environment variables:
export OPENAI_API_KEY=your_openai_api_key export SLACK_HOOK=your_slack_webhook_key
-
Start the FastAPI server:
python src/main.py -
Open your browser and navigate to
http://localhost:8000/docsto access the Swagger UI. -
Use the
/upload-pdfendpoint to upload a PDF file. -
Use the
/answer-questionsendpoint to submit questions and get answers based on the uploaded PDF content.
POST /upload-pdf: Upload a PDF file for processing. Gives a document idPOST /answer-questions: Submit questions and get answers based on the PDF content.