The Smartest Ways to Utilize ChatGPT: Building a ChatGPT Plugin

Harrison Cho
5 min readOct 24, 2023

--

Utilizing the paid plan of ChatGPT unlocks the ability to use plugins, which introduce a plethora of amazing features. There’s quite a bit of information available that suggests creating your own plugin is achievable and not as challenging as one might think. However, to cut to the chase, I wasn’t able to see it through to the end. To be precise, I paused my efforts midway. With the sample code, creating simple plugins like a to-do list could be done effortlessly. However, as I aimed for more productive plugins, the complexity increased, prompting me to pause for the time being.

Plugins are software components that add specific capabilities to a base program. While the base program performs certain functions, plugins allow for selective extension of additional features as per user needs. The concept of plugins in the OpenAI platform is similar. OpenAI provides various AI models and services, and through plugins, these functionalities can be extended or custom user-defined features can be added.

Development Process

Here are the key concepts of the OpenAI platform:

  1. Model: Various AI models provided by the OpenAI platform, each optimized for certain tasks, allowing users to choose the suitable model based on their needs.
  2. Plugin: A means to add user-defined features to the OpenAI platform, expanding its functionalities or implementing custom features.
  3. API: Interface provided to integrate the functionalities of the OpenAI platform into external applications, enabling developers to incorporate various features into their applications.

The steps in the plugin development process are outlined as follows:

  1. Setting up the Plugin Development Environment: Initially, necessary libraries and tools are installed. Web servers are set up using Flask and Flask-CORS libraries, and the requests library is used for communication with the OpenAI platform.
  2. Writing API and OpenAPI Specification: The API defining the plugin’s functionalities is crafted. Through OpenAPI specifications, the endpoints, request, and response formats of the API are defined.
  3. Implementing Plugin Logic: The core functionalities of the plugin are implemented. In my case, I used the BeautifulSoup library for web scraping to create a plugin that provided search functionality through the Swift language guide.
  4. Testing the Plugin: The developed plugin is tested in a local environment. Tools like Postman can be used to send API requests and verify responses, or test it directly within ChatGPT while keeping the local server running.
  5. Deploying the Plugin: The plugin is deployed on the OpenAI platform. A plugin manifest file is created to define the metadata of the plugin, which is then registered on the OpenAI plugin store. This step involves enlisting on a waitlist and undergoing various guidelines and format evaluations.

Through the process of developing and deploying plugins, the functionalities of the OpenAI platform can be extended or custom user-defined features can be added. The plugin system of the OpenAI platform offers beneficial features to both users and developers, providing an environment to effectively utilize various AI models and services.

In summary, creating an API and connecting it to ChatGPT forms the structure, allowing the implementation and connection of logic using various languages and tech stacks. Moreover, not just plugins, there are libraries available that are applicable across a diverse range of technology stacks.(library) The predominant use of Python is likely due to the focus on automation in AI usage, making Python a convenient choice for implementing such logic, coupled with the fact that most sample resources are written in Python due to a lack of extensive documentation.

Troubleshooting in Development

So, why did I halt my plugin creation?

Being only knowledgeable in app development, I found myself alien to web scraping, parsing, and automation-centric logic. With no time to acquire new knowledge at the moment, I decided to postpone the task. My envisioned plugin was to provide search data based on The Swift Programming Language documentation. I had two methods in mind:

The first method involved pre-parsing the data, storing it in a database, and connecting it. This would ensure faster speed and allow for customization and modification of the data structure. However, the downside was the necessity to update the database with every document update, alongside the costs of maintaining the database.

The second method entailed performing crawling every time a request was made, extracting the matching endpoint results from the document. Despite the drawback of constant crawling, this method seemed viable due to the manageable data size and the elimination of database configuration, hence I chose this method.

However, due to the numerous links and subdivided pages, parsing commands needed to consider the structure, which I wasn’t willing to spend more than a day on, hence I stopped and decided to document the experience.

Considerations for Plugin Development

For those looking to create plugins after reading this, consider the following before starting:

Copyright of the data or page you intend to use.

Common data is readily accessible via ChatGPT’s default functions, hence there’s no need for a plugin. Plugins are often created to access internal documents or specific data, and in such cases, adherence to copyright terms and the Robots Exclusion Standard is crucial. In my case, swift.org had the following robots.txt file, which allowed web crawling except for the /builds/ directory.

User-agent: *
Disallow: /builds/

Various costs should be fully considered when creating.

Costs such as model usage, server hosting, data transmission, external API usage, data storage, etc., need to be accounted for in the creation process. Of course, depending on the purpose, environment, and functionality of the plugin, costs may or may not be incurred. However, it’s important to be aware that costs could be incurred depending on whether the ChatGPT model is used externally or utilized directly internally, how the database is structured, what hosting means are used, or whether it’s used locally by oneself.

Conclusion

At first, learning about ChatGPT as a simple search function replacement was intriguing enough. But experiencing the astonishing extendability through plugins made me realize, beyond being impressed, a bit of a chill about the potential and hidden power of ChatGPT. Contrary to initial thought, this extendability shows that ChatGPT goes beyond a simple search tool to showing utility in various fields. The speculative thought cautiously arises that despite incurring billions in losses, the development and maintenance of this service might be aimed at creating a new ecosystem based on AI. High-level technology like this in AI cannot be maintained by just anyone; similar to how mobile OS has bifurcated into Android and iOS, only a few AI services will survive. Following this, not just a platform like this plugin market, but an evolution into an OS with a newly born app ecosystem based on it might occur. This experience made me ponder on the thought. Through this, we are once again made aware of the future of AI and its endless possibilities.

--

--