
1. Fork the repo to your Github account, so that you can change the code and add/finetune the features.
https://github.com/Sangwan70/cohere-chatbot-pdf-langchain.git
2. Clone the forked repo or download the ZIP to machine
git clone https://github.com/Sangwan70/cohere-chatbot-pdf-langchain.git
3. Change to cloned repository and Install packages
cd cohere-chatbot-pdf-langchain
npm install yarn -g
to install yarn globally (if you haven't already).
Then run:
yarn install
After installation, you should see a node_modules folder.
4. Set up your .env file. Copy .env.example into .env Your .env file should look like this:
COHERE_API_KEY=
# Update these with your pinecone details from your dashboard.
# PINECONE_INDEX_NAME is in the indexes tab under "index name" in blue
# PINECONE_ENVIRONMENT is in indexes tab under "Environment".
# Example: "us-east1-gcp"
PINECONE_API_KEY=
PINECONE_ENVIRONMENT=
PINECONE_INDEX_NAME=
5. For your own pinecone Vector Database. In the config folder, replace the PINECONE_NAME_SPACE with a namespace where you'd like to store your embeddings on Pinecone when you run npm run ingest. This namespace will later be used for queries and retrieval.
6. In utils/makechain.ts chain change the QA_PROMPT for your own use case. Please verify outside this repo that you have access to cohere api, otherwise the application will not work.
Convert your PDF files to embeddings
Inside docs folder (Create the Folder if needed), add your pdf files or folders that contain pdf files.
Run the script
yarn run ingest
To 'ingest' and embed your docs. If you run into errors troubleshoot below.
Run the app
Once you've verified that the embeddings and content have been successfully added to your Pinecone, you can run the app with
npm run dev
To launch the local dev environment, and then type a question in the chat interface.
Launch the browser and open http://localhost:3000

Troubleshooting
In general, keep an eye out in the issues and discussions section of this repo for solutions.
General errors
Pinecone errors
$ claude mcp add cohere-chatbot-pdf-langchain \
-- python -m otcore.mcp_server <graph>