Building a personal assistant for Notion with OpenAI’s GPT-4 and LangChain
I‘m a huge fan of Notion, and I use it for everything from my personal to-do lists and journal, to managing my professional projects. I thought it would be fun to create a tool that would help me streamline my Notion workflow by creating a “catch all” brain-dump layer for Notion. I figured this would be a great opportunity to use OpenAI’s LLMs and thus, this project was born!
https://www.notionpersonalassistant.com/
Watch the demo here.
View the GitHub repo here.
My goal for building this project was to gain experience building with LLMs. The app employs LangChain to create a prompt and make an API call to OpenAI’s LLM. LangChain makes developing with OpenAI’s LLMs very easy. I especially enjoyed working with some of the library’s prompting tools, although I found writing the actual prompt itself to be tricky and require lots of tweaking.
One challenge I faced was getting the model to provide a predictable output that I could consistently work with programmatically. I would have a prompt dialed in that was getting a predictable output, then the next day suddenly the LLM would return something new! Rather than trying to get the model to return JSON (it struggled with this), I decided to have it split up the data with pipes |
and then split the string to create an array. You can see my solution around this line of code. I also had to check and sanitize the output of the LLM with JavaScript.
This app is a simple React + ExpressJS app and is deployed to AWS EC2, CloudFront, s3, Route53 and API Gateway.
I learned a lot while building this project and I have lots of ideas of how I can extend it. If you have any ideas or suggestions, please feel free to reach out to me on LinkedIn.
I hope you enjoy using this tool as much as I enjoyed building it!