The introduction of ChatGPT marked an important event in the AI industry. And it was well received by users who mostly have nothing to do with the AI community.
While the ChatGPT service was accepted by all when it was introduced, it was purely a chat-based AI system that had no access to the Internet. Later, Internet access was added to it, but still very limiting in nature.
However, OpenAI, the parent company of ChatGPT, introduced the GPTs service, a service that allows you to build your own version of ChatGPT by providing instructions and data.
This made it possible to solve specific domain tasks with ChatGPT, such as getting your GPT to serve as a custom agent or teach your kids maths. But this is just the tip of the iceberg.
One of the features that the coming of GPTs came with is the ability to create custom actions and the opportunities that they come with. In this article, I will show you how to build custom actions for GPTs to extend the capabilities of your GPT builds.
What are Custom Actions for GPTs?
Custom actions are an addition to the GPT capabilities. GPTs, aside from their ability to return text, can also generate images and browse the Internet. But there operations on the Internet are limited. If you have a service for which you are developing the GPT for, you can provide the GPT the ability to interact with your service API so users of your GPT can access the API from the GPT interface. This is what custom actions in GPTs are all about — being able to interact with external data or web API, which is part of the real world as opposed to the constrained environment of ChatGPT.
When the developers of ChatGPT mentioned that the best GPTs will be built by the community, the ability to add custom actions and the possibilities that it creates is one of the reasons for that assertion. Let’s say I own a betting platform, I can develop a GPT app that will allow users of the GPT to place bets directly from the GPT while chatting with it. This gives ChatGPT super powers, and businesses can now create them for their customers to use.
Steps to Create Custom Actions for GPTs
In this section of the article, I will be discussing the steps required to build custom actions for your GPTs to give them access to the real world.
Step 1: Upgrade Your Account to Plus
If you have already created your GPT, then you can skip this step, as you can’t create a GPT without a Plus account. For those new to the GPT world, your free ChatGPT account won’t give you access to the GPT service. You will need to upgrade your account and become a plus user. It costs just $20 to become a Plus user, and the process of opting in is stress-free. Just under beneath your chats, you will see the Upgrade link. Upgrading your account will give you access to GPT-4, web access, and DALL-E for image generation. You also need to create a GPT. Once you upgrade your account, you can now move to the next step.
Step 2: Create GPT
When clicked, you will be taken to a ChatGPT interface where you will create your GPT. The creation of GPT has been made easy in that you don’t need to write a single line of code; you create GPTs by chatting with ChatGPT, as it is the setup wizard and does a nice job at that. The interface this time around is divided into two — the chat section and the previous section. You will use the chat section to set up and view the interface to see what you are doing.
ChatGPT will ask you to provide details of what you want to create. Give a clear name and description of what you want. Using the information provided, ChatGPT will generate a name for the GPT, a profile picture, and a description. You have the option of changing this either by chatting with it to change it or doing that later in the configure tab. For now, let's accept what ChatGPT gave us.
Step 3: Provide Instruction and Behaviour
Still on the same interface, once you accept the description and profile picture, ChatGPT will ask you to provide instructions on how you will want your GPT to behave. This section is up to you. And this is what sets your GPT apart. If your GPT is meant to help users with academic research, you can give it the instruction to help provide literature reviews, provide citations that are up to date and make sure the reviews are summarised using an academic writing style. You can also specify the referencing style —whether APA or the specific version too.
Step 4: Go to the Configuration Tab and Start Configuring
Now to the main part. If you are on the create tab, switch to the configure tab. You will see the name of the GPT you created alongside the description, profile picture, and instructions. You can tweak these if you need to.
Next is to craft a conversational starter. For an academic research assistant, you can set questions like “What topic are you writing on?”.
After the conversation starter, you can then move to uploading knowledge. This can be research papers, other literature review materials, and other documents that are related to your field that you will want ChatGPT to use in providing you help.
The next setup to take a look at is the capabilities of your GPT. Do you want it to remain closed, or do you want it to access the Internet? Should it have the ability to run and interpret codes, or should it be able to generate images? Choose the capabilities you want your GPT to have.
The next configuration option is action, and that is the main reason this article was written. Using this, you can configure your GPT to access API endpoints, send emails, or even query databases.
How to Configure Actions for GPT
When you click on the “Add Actions,” you will be taken to a new page to create the action. The first section is for defining your actions, otherwise known as functions, and the second is for authentication. Let's start with the first.
- Give the schema a name. It should be a unique name, you could name it, let's say, AirtimeAPIService.
- Give it a description. It should be short and then provide the root URL (domain).
- The next thing now is to define functions which are nothing but the endpoints your GPT will consume. Provide a name also, such as verify balance. And then a description.
- Define the URL path without the domain name (it will be added by adding the one you entered earlier). Make sure you choose the appropriate request method (GET, POST).
- If there is a parameter added to the URL, you can also add the parameter.
- If you have more functions to add, you can click on the “Add function” button and repeat steps 3- 5.
- Go to the authentication section and define the mode of authentication — it can be set to None, API Key, or OAuth.
- Once you are done, review your settings and save all the changes. You can now test the newly created action by chatting with your GPT to trigger the action.