Building a simple OpenAI GPT

Exploring the world of GPTs by firstly diving into what exactly a GPT is and how to create one.
January 1, 2024

What is a GPT?

OpenAI recently introduced GPTs, which are custom variants of ChatGPT designed to serve specific functions. This means you can create specialized versions of ChatGPT that are instructed to achieve a specific goal without having to prompt ChatGPT with the same instruction set you gave it once before in order to achieve the intended goal.

For example: If you use ChatGPT to help with the writing process for a particular subject, with GPTs you can now create a refined version of ChatGPT that is tailored to your writing style and subject. You can also upload documents to your GPT so it has knowledge about the subject you writing about. I like to think of GPTs as subsets of ChatGPT or 'mini ChatGPTs' where each GPT is configured to achieve a specific goal.

The process of creating a simple GPT involves no coding and purely chatting to the 'GPT Builder'; which is a feature that guides you through the creation of your GPT by simply having a conversation. GPTs can perform actions too which depending on your intended goal may require coding (actions invoke API's), however, in this article the focus on creating a basic GPT.

Creating GPTs is only avialable to ChatGPT Plus subscribers which costs $20 per month. (at the time of this writing).

Building a GPT

If there's one thing I always search the web for it's regular expressions. So let's create a GPT that will generate regular expressions for me using the following instructions:

  • Build a regex pattern based on a brief description.
  • Ensure safe regular expressions are produced.
  • Explain a regex pattern back to me so I can understand what it's doing.
  • Generate a URL to for me to test any regular expressions that are created.

First, we start by creating a GPT from the ChatGPT discovery page accessible by clicking on 'Explore' in the left navigation bar.

The GPT Builder will now guide you through the process of creating a GPT. Let's tell it what we want to make.

The GPT Builder proceeds to capture requirements through conversation. In this case, it wants to know what to name the GPT and offers a suggestion.

We also need a logo! The GPT Builder can help with that...

Lets ask it to come up with another logo that's simpler / cleaner.

Next, lets instruct it to avoid bad expressions (e.g. ReDoS expressions). We're going to do this by uploading documents that describe what ReDoS expressions are into the GPTs knowledge base so it can use these documents as a reference when generating expressions.

Uploading documents into your GPT is a way of providing your GPT with 'extra knowledge', very useful if you have a specific dataset you would like your GPT to reference to base responses from.

In the 'Configure' tab of the GPT Builder you have access to a few settings - one of which is a 'Knowledge' area allowing you to upload files. This facility allows for uploading specific documents you would like your GPT to reference when generating responses. In this case, I'm going to upload some papers detailing out how to identify ReDoS expressions. You can either upload your documents in the Configure tab, or through the GPT builder conversation screen. Let's do the latter.

Lets upload documents into the knowledge store for my GPT.

Finally, lets instruct the Regex Helper to build a URL to passing along the generated regex with some dummy text so I can test and play around the regex it generates for me.

We're ready to test it out

Let's ask the Regex Helper to detect a UK phone number. I won't ask it to generate a test link to see if it'll know to do this from the instructions I provided during the configuration step.

It works! It generated a test link too...

Lets click on it to see if its encoded the URL params correctly with the new regex and some test text...


This is the link it generated if you would like to check it out yourself: Regexr Test for UK Phone Number

Sharing your GPT with others

A present, the only way to share your GPT with others is to click on the save button in the top right corner and select 'Only people with a link'.

You can now copy the link and share it with others. The 'Public' option is currently disabled until OpenAI launch their GPT 'app store'.

Feel free to try out our new Regex Helper GPT!

A few gotchas to note

  • There is currently a usage cap that limits you to 40 messages every 3 hours. This limit will more than likely be lifted at some point.

  • At first, the test links the Regex Helper was generating had some issues with the dummy text it included in the query string parameter. It didn't encode the text to have it be URI friendly. I resolved this by instructing the GPT to ensure all test URLs are encoded correctly to be URI friendly ensuring that characters are replaced with escape sequences.

Wrap up

OpenAI have really lowered the barrier to entry with creating GPTs by simply being able to have a conversation with the GPT Builder. There is no need to be proficient in coding to leverage the power of GPTs opening the doors to a world of possibilities.

I will say that having some technical knowledge about how the web works will help in cases where you're instructing your GPT to do something technical. For example: generating a valid link with query string parameters like we did in this article. However, you could probably work around this by conversing with the GPT builder requesting it for help. In my case, I could have asked the GPT Builder to help me diagnose why my test link wouldn't work properly due to the lack of URI encoding.

An area I haven't yet covered is GPT actions which allows you to configure your GPT to make API calls to interact with the outside world. This will be covered in a future post.

If you enjoyed this post feel free to connect with me on X to be notified of the next one!

© 2024 The Dev Artisan. All Rights Reserved.