Level Up Coding

Coding tutorials and news. The developer homepage gitconnected.com && skilled.dev && levelup.dev

Follow publication

Member-only story

AI

How I Built A GPT-3 Powered Productivity App

Jacob Ferus
Level Up Coding
Published in
6 min readJan 5, 2023

--

Image generated by Jacob Ferus

In this article, I will explain how I used GPT-3 to integrate AI into a simple productivity application. Before I go into the code and methods used, let’s have a look at the final result:

In the rest of the article, I will explain how this app/MVP was made, but also the pros and cons of adding GPT to applications and discuss in what situations it is appropriate. Let’s get into it!

The application consists of a server in Python with FastAPI and a client in Javascript with ReactJS. This is combined with the OpenAI API with the text-davinci-003 model and some prompt engineering. While I would prefer the more powerful ChatGPT, I decided to use the official API for the sake of simplicity.

The Input

Let’s look at the first part of the application, the input:

Here ordinary notes are written and then converted using GPT-3 into parsed items that can easily be displayed in a client. Behind the scenes the following prompt is used:

Let’s unwrap this prompt:

  1. Firstly, I specify that only a single JSON array should be outputted. This is important since after calling the API and receiving the result I can immediately call json.loads(...) to get the result into a dictionary to do whatever I want with it.
  2. Thereafter, I specify the exact properties that should be returned after the prompt. This is also essential since everything else downstream in the application (database & client) will assume a structure and the output needs to follow this. Here you are free to write anything. For instance, I write that there are three types: post, todo and reminder.

--

--

Written by Jacob Ferus

Looking outside the box and making sense of the world using data. Follow me on X: https://x.com/jacobferus

Responses (5)

Write a response