This project demonstrates a PDF chatbot utilizing Upstash's RAGChat and OpenAI's GPT-4 model. The chatbot extracts text from a PDF file and uses it to answer user queries.
- Uploading PDF files and extracting text.
- Chat interface for interacting with the extracted content.
- api/chat/route.ts: Handles chat requests.
- components/chat.tsx: Main chat interface component.
- pages/api/pdf-extractor.ts: Extracts text from uploaded PDF files.
- utils/rag-chat.ts: Configures RAGChat with OpenAI's GPT-4 model.
- npm or yarn to install dependencies
- Upstash and OpenAI API keys
- Clone the repository
git clone https://github.com/ErayEroglu/rag-chatbot
cd rag-chatbot
- Install dependencies
npm install
- Create a .env file in the root directory and add your Upstash and OpenAI API keys:
OPENAI_API_KEY=your_openai_api_key
UPSTASH_VECTOR_REST_URL=your_upstash_vector_rest_url
UPSTASH_VECTOR_REST_TOKEN=your_upstash_vector_rest_token
- Run the development server
npm run dev
- Open your browser and go to http://localhost:3000.
- Upload a PDF file.
- Start chatting with the bot using the extracted content from the PDF.