GPT-4 API in Jupyter and how to use it

After my first FIFO Script for Google Sheets, I would like to share my second script which I’ve created in the last few months. I use this script to get information from GPT-4 or GPT-3.5 API from Open AI using Jupyter and Google Sheets. It is really quick with some of the templates and I think you will love it.

Why is it so useful? This way is much faster than using chat.openai.com site and it is also time efficient. I can simply get “run script” and do something better / different somewhere else. When I get back to the computer I get outputs from GPT-4. In short, it’s a pretty good time-saver.

Expected input

How that “magic” works?

  1. Fill prompts to Google Sheets template
  2. Download this template as .csv
  3. Move this file to the folder with Jupyter Notebook
  4. Load this file in Jupyter Notebook App
  5. Start calling prompts to GPT with API

And after some time, you will get the promised response for every prompt which you had in .csv. All will look like this…

Expected output

… as you can see, you have more information in your “output” where are things like costs (because API is priced by tokens), model and temperature. This can be useful for comparison of outputs and for having content.

So if you use split() function in Google Sheets by |, you can have this information about specific fields and you can work with it more efficiently.

This is a super quick solution on how to download data from GPT-4 or GPT-3.5 API and if you want all codes, you can buy it on my gumroad.com for 2$. You will get all codes and a step-by-step guide on how to use these scripts.

Martin
I'm main creator of MineNiches where you should find more informations about mine small websites, small tech tools and tips for better SEO.