A Retrieval-Augmented Generation (RAG) chatbot that can discuss Paul Graham's essays with context awareness.
- Python 3.11 (required)
- Pinecone account
- OpenAI API key
-
Create a Python 3.11 virtual environment:
python3.11 -m venv venv311 source venv311/bin/activate # On macOS/Linux # or .\venv311\Scripts\activate # On Windows
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables in
.env:OPENAI_API_KEY=your_openai_key PINECONE_API_KEY=your_pinecone_key PINECONE_ENV=your_environment PINECONE_INDEX=your_index_name
-
First, process the PDFs (place your PDFs in the
pdfs/directory):# To start fresh (recommended first time) python process_pdfs.py --reset # To add to existing index python process_pdfs.py
-
Run the chatbot:
python pdf_agent_context.py
pdf_agent_context.py- Main chatbot with context handlingprocess_pdfs.py- PDF processing and vectorizationpdfs/- Directory for Paul Graham's essays (PDFs)requirements.txt- Project dependencies
- If you get import errors, make sure you're using Python 3.11
- If the chatbot can't find documents, run
process_pdfs.pyfirst - If you get API errors, check your environment variables