Building Your Own GPT with GPTs: A Comprehensive Guide
OpenAI has recently made important announcements during the OpenAI DevDay, the company's first developer conference. Among these announcements, there was the GPTs and the GPT Store (which is targeted to be released in late November 2023).
The GPTs allow users to create custom versions of the ChatGPT quickly and in just a few steps. Anyone can build and share their own tailormade GPT without any coding effort. The GPTs integrate with other ChatGPT features such as DALL·E 3 and CodeInterpreter, enabling the creator to power its GPT with media or advanced math functionalities. On top of that, the GPTs also implement Actions, which allows the chatbot to reach out to external APIs or other sources depending on the prompt.
This article provides a comprehensive guide on how to create your own GPT using GPTs.
With no further ado, let's get to it!
Getting Started
Before we start, just a quick note, to use the GPTs, you must have an active ChatGPT Plus subscription, which is totally worth it, since you can use GPT-4, and also, stay ahead with the most recent releases from OpenAI.
In your home screen, you can navigate to the top-left corner and find the Explore button, which will take you to the GPTs section. Hit Create a GPT to start the flow.
Creating Your GPT
The GPT creation can be done fully through a chat conversation. In this example, we will create a restaurant assistant bot, that will serve as the main companion of a customer during their visit to the restaurant. The fictitious restaurant will be called “The Hungry Eagle”.
After sending my first instruction and uploading the The Hungry Eagle’s menu, the GPT automatically creates a profile picture using DALL·E 3 and fine-tunes itself, adapting its behavior to the instructions provided.
The creator can update the profile picture in the Configure tab with external images, but I preferred to ask the GPT to update the image with another AI-created image (which was awesome, btw). I also gave a name to my custom GPT: “Eagly, the Hungry Assistant”.
The conversation goes on, and the goal of the GPT is to continue fine-tuning the bot to better adjust to the creator's needs.
If we navigate to the Configure tab, the configuration fields have been automatically filled by the GPT during the conversation. This is a more programmatic step, where the creator can manually adjust the bot properties, such as name, description, instructions, conversation starters, and knowledge sources. All these could also be updated using the chat mode. In this tab, the creator can also configure Actions.
Previewing the GPT
I have made a few questions to my newly created GPT, and it followed the instructions just as intended. I loved that it even got the address from the menu and answered it when I asked for more information.
Enhancing the GPT with Actions
Now is the moment that things can get even more interesting. We can use the Actions feature to enable the GPT to reach out for information from external sources, especially APIs. This allows the integration with third-party tools, or even proprietary solutions since it allows the creator to provide authentication tokens/keys for API connection. Note: To use the Actions feature, a little code knowledge may be required.
In this example, Eagly, The Hungry Assistant gets integrated with an open-source weather API provided by the WheaterAPI. With that, customers can ask about the weather for the day that they would like to go to the restaurant.
The Action setup requires the definition of a Schema, which is a JSON configuration that defines the API address, endpoints, and parameters used for the call. The Schema used for this Action describes the connection to a GET request that returns weather data for US zip codes.
See the full Schema below.
{
"openapi":"3.1.0",
"info":{
"title":"Weather API Integration",
"description":"Integration with Weather API to retrieve weather data for a specific ZIP code.",
"version":"1.0.0"
},
"servers":[
{
"url":"https://api.weatherapi.com/v1"
}
],
"paths":{
"/forecast.json":{
"get":{
"description":"Retrieve weather information for a specific ZIP code",
"operationId":"GetWeatherByZipCode",
"parameters":[
{
"name":"key",
"in":"query",
"description":"API key for authentication, the value is 0a392****1211",
"required":true,
"schema":{
"type":"string"
}
},
{
"name":"q",
"in":"query",
"description":"The ZIP code to retrieve the weather for",
"required":true,
"schema":{
"type":"string"
}
},
{
"name":"days",
"in":"query",
"description":"Number of days ahead to forecast, today is 1, tomorrow is 2, and so on",
"required":true,
"schema":{
"type":"integer"
}
}
],
"responses":{
"200":{
"description":"Success",
"content":{
"application/json":{
"schema":{
"type":"object",
"properties":{
"forecast":{
"type":"object",
"description":"Root object for forecast",
"properties":{
"forecastday":{
"description":"Array of each day forecasted, ordered from present to future",
"type":"array",
"items":{
"type":"object",
"properties":{
"date":{
"type":"string",
"description":"Date of this objects forecast",
"properties":{
"day":{
"type":"object",
"properties":{
"condition":{
"type":"object",
"properties":{
"text":{
"type":"string",
"description":"Actual forecast for that day"
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
Now, it is time to test our integration. Eagly identifies that the prompt requires the request to the weather API. It automatically triggers the action to retrieve the weather data. It seems that I will not need an umbrella tomorrow!
In the given example, Eagly is integrated with a weather API, but there are many other integration possibilities that could make the assistant an even more relevant tool for customers during their interactions with the restaurant, for example:
- A real-time traffic API to get information about routes and ETA.
- A parking API to have information about available parking around the restaurant.
- A tab management API to track orders and allow the payment of the bill.
- A feedback survey API to collect feedback from customers after their visit to the restaurant.
These examples show how effective it could be, to turn a single chatbot tool into an accessible and reliable interface between users and brands.
Publishing the GPT
Publishing your recently created GPT is quick and easy as well. In the upper-right corner, there is a green button that when clicked displays three options "Only me", "Only people with a link", and "Public". For the last two, it is required to provide, in the Configure tab, a valid privacy policy URL for all third-party integrations. Therefore, I have provided WeatherAPI's privacy policy as a reference.
Conclusion
OpenAI has addressed one of the most challenging problems of LLMs (Large-Language Models) so far, the ability to effectively create custom-made applications for specific usage.
Creating GPTs is quick and easy, does not require advanced knowledge in programming, and neither in data management techniques, vectorization, databases, and many other approaches used to support feeding data into AI models. Users can create their own chatbots via a simple and straightforward conversational interface.
On top of that, with some knowledge of programming and APIs, it is possible to integrate with multiple external resources, that can equip the chatbot with powerful abilities.
I am excited to see how all this will evolve over time, and what awesome GPTs will be invented and shared by the community.
Eagly, The Hungry Assistant is available here.