Here's the rewritten README file for the project:
# ChatGPT Chatbot for PDF Files
Create a ChatGPT chatbot using GPT-4 API to answer questions from multiple large PDF files. This project uses LangChain, Pinecone, TypeScript, OpenAI, and Next.js to build a scalable AI chatbot.
## Table of Contents
- [Development](#development)
- [Clone the Repository](#clone-the-repository)
- [Install Dependencies](#install-dependencies)
- [Set up Environment Variables](#set-up-environment-variables)
- [Configure Pinecone Namespace](#configure-pinecone-namespace)
- [Update Chat Model](#update-chat-model)
- [Ingest PDF Files](#ingest-pdf-files)
- [Run the App](#run-the-app)
- [Troubleshooting](#troubleshooting)
- [Credits](#credits)
## Development
### Clone the Repository
```bash
git clone [github https url]
pnpm install
-
Copy
.env.example
to create a new.env
file. -
Fill in the required API keys, environment, and index name from OpenAI and Pinecone.
Example .env
file:
OPENAI_API_KEY=
PINECONE_API_KEY=
PINECONE_ENVIRONMENT=
PINECONE_INDEX_NAME=
In the config
folder, replace the PINECONE_NAME_SPACE
with the desired namespace
for storing your embeddings on Pinecone when you run pnpm run ingest
. This namespace will be used for queries and retrieval later.
In utils/makechain.ts
, change the QA_PROMPT
for your own use case. Change modelName
in new OpenAIChat
to gpt-3.5-turbo
if you don't have access to gpt-4
. Please verify outside this repo that you have access to gpt-4
, otherwise, the application will not work with it.
-
Add your PDF files or folders containing PDF files inside the
docs
folder. -
Run the following script to ingest and embed your docs:
npm run ingest
- Check the Pinecone dashboard to verify your namespace and vectors have been added.
After successfully adding the embeddings and content to Pinecone, run the app:
pnpm run dev
Launch the local development environment and type a question in the chat interface.
Refer to the issues
and discussions
sections of this repo for solutions. If you encounter errors, follow the general troubleshooting steps provided in this README.
The frontend of this repo is inspired by langchain-chat-nextjs.