What is ChatGPT plugins? How can you build your own plugins .

Sagar Dangal
4 min readMar 26, 2023

--

OpenAI just announced their new feature in ChatGPT . This is by far the most exciting feature of ChatGPT. ChatGPT is trained on data upto 2021 and it is only able to provide the result based on that data. Now to interact with real-time data OpenAI introduced ChatGPT plugins.

Introduction

Plugins are tools designed specifically for language models with safety as a core principle, and help ChatGPT access up-to-date information, run computations, or use third-party services.

OpenAI plugins connect ChatGPT to third-party applications. These plugins enable ChatGPT to interact with APIs defined by developers, enhancing ChatGPT’s capabilities and allowing it to perform a wide range of actions.

  • Plugins can allow ChatGPT to do things like:
  • Retrieve real-time information; e.g., sports scores, stock prices, the latest news, etc.
  • Retrieve knowledge-base information; e.g., company docs, personal notes, etc.
  • Perform actions on behalf of the user; e.g., booking a flight, ordering food, etc.

ChatGPT by OpenAI is a powerful language model that enables you to have interactive conversations with AI. What if you could extend its capabilities even further? In this blog post, we will guide you through the process of creating your own ChatGPT plugin, with a specific example focused on lead generation. By the end, you’ll be equipped to build custom plugins tailored to your unique needs.

Getting Started

Creating a ChatGPT plugin involves three main steps:

  1. Build an API
  2. Document the API in the OpenAPI yaml or JSON format
  3. Create a JSON manifest file that defines relevant metadata for the plugin

In this blog post, we’ll walk through the process of creating a lead generation plugin, which will enable ChatGPT to interact with a lead generation service, allowing users to generate leads directly from their conversations with the AI.

Plugin Manifest

Every plugin requires an ai-plugin.json file, which must be hosted on the API’s domain. The manifest file contains essential information about the plugin, such as its name, description, authentication method, and API specification.

Here’s an example of a minimal manifest for a lead generation plugin:

{
"schema_version": "v1",
"name_for_human": "Lead Generation Plugin",
"name_for_model": "leadgen",
"description_for_human": "Plugin to generate leads from ChatGPT conversations.",
"description_for_model": "Plugin to generate leads from ChatGPT conversations.",
"auth": {
"type": "none"
},
"api": {
"type": "openapi",
"url": "https://api.yourdomain.com/openapi.yaml",
"is_user_authenticated": false
},
"logo_url": "https://yourdomain.com/logo.png",
"contact_email": "support@yourdomain.com",
"legal_info_url": "https://www.yourdomain.com/legal"
}

OpenAPI Definition

The next step is to create an OpenAPI specification for your API. This serves as the blueprint for how ChatGPT will interact with your lead generation service. The OpenAPI specification should define the available endpoints and their expected inputs and outputs.

Here’s a basic example of an OpenAPI definition for a lead generation plugin:

openapi: 3.0.1
info:
title: Lead Generation Plugin
description: A plugin that generates leads from various sources using ChatGPT.
version: 'v1'
servers:
- url: http://localhost:3333
paths:
/leads:
get:
operationId: getLeads
summary: Get a list of leads
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/getLeadsResponse'
components:
schemas:
getLeadsResponse:
type: object
properties:
leads:
type: array
items:
$ref: '#/components/schemas/Lead'
description: The list of leads.
Lead:
type: object
properties:
name:
type: string
email:
type: string
phone:
type: string

Running a Plugin

Once you have created the API, manifest file, and OpenAPI specification for your lead generation plugin, you are now ready to connect the plugin via the ChatGPT UI. Here’s how to do it:

  1. Local vs. Remote Plugin: There are two different places your plugin might be running, either locally in a development environment or on a remote server.
    a. If you have a local version of your API running, you can point the plugin interface to that local setup. To connect the plugin with ChatGPT, you can navigate to the plugin store and then select “Install an unverified plugin”.
    b. If the plugin is running on a remote server, you will need to first select “Develop your own plugin” and then “Install an unverified plugin”. You can simply add the plugin manifest file to the ./well-known path and start testing your API. However, for subsequent changes to your manifest file, you will have to deploy the new changes to your public site, which might take a long time. In that case, we suggest setting up a local server to act as a proxy for your API. This allows you to quickly prototype changes to your OpenAPI spec and manifest file.
  2. Test the Plugin with ChatGPT: With the plugin connected, you can now start testing it with ChatGPT. To do this, open the ChatGPT user interface, and you should see your plugin listed under the available plugins. Ensure that the plugin is enabled.
  3. Use the Lead Generation Plugin: Start a conversation with ChatGPT, and you can now use your lead generation plugin by mentioning it in your conversation or by providing instructions targeting the plugin’s specific functionality. For example, you could say, “Generate leads using the lead generation plugin for the keyword ‘digital marketing’.”
  4. Review the Generated Leads: ChatGPT will send a request to your plugin API, and the plugin will return the generated leads. The leads will then be displayed in the ChatGPT conversation, allowing you to review and take appropriate action.

By following these steps, you can successfully run your lead generation plugin with ChatGPT and take advantage of the AI’s capabilities to find potential leads in your target market.

Conclusion

In conclusion, creating and integrating custom plugins with ChatGPT can open up a world of possibilities, allowing you to extend the AI’s capabilities and tailor its functionality to your specific needs. In this blog, we discussed the process of developing a lead generation plugin as an example, showcasing how you can create an API, write a manifest file, and connect your plugin to ChatGPT. By following these steps and understanding the underlying concepts, you can create your own plugins to cater to various use cases, enhancing your ChatGPT experience and unlocking the full potential of this powerful language model. Happy plugin development!

--

--