In today’s fast-paced world, having quick access to information is crucial. With this tutorial, you will learn how to create a simple chatbot that can answer questions from your Notion knowledge base using OpenAI, Typescript, LangChain, and Pinecone. Let’s dive into the intricacies of this setup!
Example Data
This repository utilizes a Notion template of the support documents from cron, a next-generation calendar for professionals and teams. Using this template, we’ll streamline access to your knowledge base.
Development Steps
- Clone the Repository: Start by cloning the repo to your local environment.
- Install Packages: Use the following command to install all necessary packages:
- Set Up Your .env File: Create a .env file by copying the example provided:
- Configure Pinecone: Navigate to the config folder, then open
pinecone-index.tsand replacePINECONE_INDEX_NAMEwith the index name from your Pinecone dashboard.
pnpm install
cp .env.example .env
Your .env file should contain:
OPENAI_API_KEY=
PINECONE_API_KEY=
PINECONE_ENVIRONMENT=
To retrieve your API keys, visit OpenAI and Pinecone.
Instructions for Ingesting Your Own Dataset
Ingesting your dataset from Notion is a straightforward process:
- Export your dataset by clicking on the three dots in the upper right corner of your Notion page, then select Export.
- Follow these instructions for Notion: Exporting your content.
- When exporting, select the Markdown and CSV format, check Everything, include subpages, and select Create folders for subpages. Click Export.
This action will create a .zip file in your Downloads folder. Move this .zip file into the root of your repository.
You can either unzip using tools like 7-Zip or WinZip, or use the following Unix/Linux command to extract the contents:
unzip Export-d3adfe0f-3131-4bf3-8987-a52017fc1bae.zip -d Notion_DB
A new Notion_DB folder will appear in your root, containing markdown files and folders from your knowledge base.
Ingest Data
Next, we need to ingest your documents. Think of ingesting as translating human languages into machine languages. It’s akin to converting a vast library into a numerical format that computers can easily analyze and search.
Run the ingestion process with the following command:
npm run ingest
Running the App
To run your local development environment, use:
npm run dev
Now you can utilize the search bar to pose questions regarding your documents, and your chatbot will respond accordingly. Simple and effective!
Deployment
You can deploy this application to the cloud using Vercel. For detailed guidance, consult the Documentation.
Troubleshooting Tips
If you encounter any issues during the setup or runtime, here are some solutions you can try:
- Ensure all API keys are correctly inserted into the .env file.
- Check if the Pinecone index name matches that in your Pinecone dashboard.
- If you are still facing issues, verify your internet connection and restart your development server.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

