ChatGPT is an AI chatbot developed by OpenAI and released in November 2022. It is based on a family of large language models (LLMs) collectively known as GPT-3 and recently upgraded to GPT-4. These models can understand and generate human-like answers to text prompts because they’ve been trained on huge amounts of data.
ChatGPT can interact with users on various topics and tasks, such as debugging code, writing essays, playing games, booking flights, ordering food, or just having a casual conversation. Users can access ChatGPT through a web interface or an API, and choose from different models and settings to customize their experience.
New Feature of ChatGPT: Plugin Support
A new feature of ChatGPT is the support for plugins. ChatGPT Plugins are tools that enhance ChatGPT’s capabilities and allow it to access up-to-date information, run computations, or use third-party services. Users can add plugins to ChatGPT using the web interface or the API, and choose from a variety of plugins created by OpenAI or other developers.
How to add ChatGPT plugins:
But what if you want to create your own plugin for ChatGPT? How can you extend ChatGPT’s functionality and connect it to your own applications or data sources? In this article, we will show you how to create a ChatGPT plugin in 3 easy steps.
Step 1: Build an API
The first step to creating a ChatGPT plugin is to build an API that exposes the functionality or data that you want ChatGPT to access. An API (Application Programming Interface) is a set of rules and protocols that define how different software components can communicate and exchange information.
For example, if you want to create a plugin that allows ChatGPT to search for books on Amazon, you need to build an API that can take a query (such as a book title or author) and return a list of relevant books with their details (such as price, rating, description, etc.).
There are many ways to build an API, depending on your preferences and requirements. You can use different programming languages, frameworks, tools, and platforms to create and host your API. Some popular options are:
Python: A versatile and easy-to-learn programming language that has many libraries and frameworks for building APIs, such as Flask, Django, FastAPI, etc.
Node.js: A runtime environment that allows you to use JavaScript to build server-side applications and APIs. It has many modules and frameworks for building APIs, such as Express, Hapi, Koa, etc.
AWS Lambda: A service that allows you to run code without provisioning or managing servers. You can use any programming language supported by AWS Lambda (such as Python, Node.js, Java, etc.) to create functions that handle API requests and responses.
Azure Functions: A service that allows you to run code without provisioning or managing servers. You can use any programming language supported by Azure Functions (such as Python, Node.js, Java, etc.) to create functions that handle API requests and responses.
Regardless of how you build your API, you need to make sure that it follows some best practices and standards for designing APIs. Some of these are:
Use RESTful principles: REST (Representational State Transfer) is a set of architectural principles that define how resources are identified and manipulated over HTTP. RESTful APIs use HTTP methods (such as GET, POST, PUT, DELETE) to perform operations on resources (such as books), and use HTTP status codes (such as 200 OK, 404 Not Found) to indicate the outcome of the operations. RESTful APIs also use JSON (JavaScript Object Notation) as the standard format for exchanging data between the client and the server.
Use HTTPS: HTTPS (Hypertext Transfer Protocol Secure) is an extension of HTTP that adds encryption and authentication to ensure secure communication between the client and the server. HTTPS protects your API from unauthorized access and tampering by encrypting the data in transit and verifying the identity of the parties involved. HTTPS also improves your API’s performance and reliability by enabling features such as HTTP/2 and caching.
Use authentication and authorization: Authentication is the process of verifying the identity of the client who is accessing your API. Authorization is the process of determining what actions or resources the client is allowed to access. Authentication and authorization are essential for securing your API from unauthorized or malicious access. There are many methods and protocols for implementing authentication and authorization in your API, such as OAuth 2.0, JWT (JSON Web Token), API keys, etc.
Step 2: Document the API in the OpenAPI yaml or JSON format
The second step to create a ChatGPT plugin is to document your API in the OpenAPI yaml or JSON format. OpenAPI is a specification that defines a standard way of describing APIs in a machine-readable format. OpenAPI documents can be written in YAML (Yet Another Markup Language) or JSON (JavaScript Object Notation), which are both human-readable and easy-to-write formats.
By documenting your API in the OpenAPI format, you can enable ChatGPT to understand how to use your API without any manual intervention. ChatGPT will use the OpenAPI document as a reference guide for interacting with your API. The OpenAPI document will provide information such as:
The base URL of your API
The available endpoints (paths) of your API
The HTTP methods (verbs) supported by each endpoint
The parameters (query, path, header, body) required or optional for each endpoint
The request and response schemas (models) for each endpoint
The natural language descriptions for each endpoint
To document your API in the OpenAPI format, you can use different tools and editors that support OpenAPI specification. Some popular options are:
Swagger Editor: A web-based editor that allows you to write OpenAPI documents in YAML or JSON format. It provides syntax highlighting, auto-completion, validation, previewing, testing, and exporting features.
Postman: A platform that allows you to design, develop, test, document, and share APIs. It supports importing and exporting OpenAPI documents in YAML or JSON format.
Stoplight Studio: A desktop application that allows you to design, develop, document, and test APIs. It supports creating and editing OpenAPI documents in YAML or JSON format.
Regardless of how you document your API in the OpenAPI format, you need to make sure that it follows some best practices and standards for writing OpenAPI documents. Some of these are:
Use clear and consistent naming conventions: Use meaningful and descriptive names for your endpoints, parameters, schemas, and descriptions. Use camelCase or snake_case for naming conventions, and avoid using spaces or special characters. Use plural nouns for collections of resources, and singular nouns for individual resources. Use verbs for actions or operations on resources. For example, use /books instead of /book_list, and use /books/{id} instead of /get_book_by_id. Use GET for retrieving resources, POST for creating resources, PUT or PATCH for updating resources, and DELETE for deleting resources.
Use descriptive summaries and descriptions: Provide concise summaries and detailed descriptions for each endpoint, parameter, schema, and response. Use natural language that is easy to understand and follow. Use markdown syntax to format your text with headings, lists, links, etc. For example,
paths:
/books:
get:
summary: Get all books
description: |
This endpoint returns a list of books with their details.
You can filter the books by genre or author using query parameters.
You can also sort the books by title or rating using query parameters.
parameters:
- name: genre
in: query
description: The genre of the books
schema:
type: string
enum: [fiction , non-fiction , biography , history , science , fantasy , romance , thriller]
- name: author
in: query
description: The author of the books
schema:
type: string
- name: sort_by
in: query
description: The field to sort the books by
schema:
type: string
enum: [title , rating]
responses:
'200':
description: A list of books
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Book'
'400':
description: Invalid query parameters
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Use schemas to define request and response models: Use schemas to define the structure and format of the data that is sent or received by your API. Use common data types, such as string , number , boolean , array , object , etc., and specify their properties, such as format , pattern , enum , minLength , maxLength , minimum , maximum , required , etc. Use references ($ref) to reuse schemas across different endpoints, and avoid duplication. For example,
components:
schemas:
Book:
type: object
description: A book with its details
properties:
id:
type: string
format: uuid
description: A unique ID for the book
title:
type: string
description: The name of the book
author:
type: string
description: The person who wrote the book
genre:
type: string
description: The category of the book
enum: [fiction , non-fiction , biography , history , science , fantasy , romance , thriller]
rating:
type: number
description: The average score of the book based on user reviews
minimum: 0
maximum: 5
required:
- id
- title
- author
- genre
- rating
Step 3: Create a JSON manifest file that will define relevant metadata for the plugin
The third and final step to create a ChatGPT plugin is to create a JSON manifest file that will define relevant metadata for the plugin. A JSON (JavaScript Object Notation) manifest file is a file that contains information about your plugin, such as its name, logo, description, version, etc. The JSON manifest file also includes the URL of your API and the URL of your OpenAPI document.
By creating a JSON manifest file for your plugin, you can enable ChatGPT to discover and install your plugin without any manual intervention. ChatGPT will use the JSON manifest file as a source of truth for your plugin. The JSON manifest file will provide information such as:
The name of your plugin
The logo of your plugin
The description of your plugin
The version of your plugin
The URL of your API
The URL of your OpenAPI document
The authentication method and details for your API (if required)
To create a JSON manifest file for your plugin, you can use any text editor that supports JSON format.
You can also use online tools and validators to create and check your JSON manifest file. Some popular options are:
JSON Editor Online: A web-based tool that allows you to create and edit JSON files in a graphical or code view. It provides syntax highlighting, validation, formatting, and exporting features.
JSONLint: A web-based tool that allows you to validate and format JSON files. It provides syntax highlighting, error detection, and beautifying features.
JSON Schema Validator: A web-based tool that allows you to validate JSON files against a JSON schema. It provides syntax highlighting, error detection, and schema generation features.
Regardless of how you create your JSON manifest file for your plugin, you need to make sure that it follows some best practices and standards for writing JSON files. Some of these are:
Use clear and consistent naming conventions: Use meaningful and descriptive names for your properties and values. Use camelCase for naming conventions, and avoid using spaces or special characters.
Use double quotes for strings: Use double quotes (" ") for enclosing strings, such as names, descriptions, URLs, etc. Do not use single quotes (’ ') or no quotes for strings.
Use commas to separate values: Use commas (,) to separate values in an array or properties in an object. Do not use semicolons (;) or other characters to separate values.
Use brackets to enclose arrays and objects: Use square brackets ([ ]) to enclose arrays, which are collections of values. Use curly brackets ({ }) to enclose objects, which are collections of properties and values.
Do not include comments: Do not include comments in your JSON file, as they are not supported by the JSON format. Comments are lines or sections of text that are ignored by the parser and are used for documentation or explanation purposes.
For example,
{
"name": "BookSearch",
"logo": "https://example.com/booksearch.png",
"description": "A plugin that allows ChatGPT to search for books on Amazon.",
"version": "1.0.0",
"apiUrl": "https://example.com/booksearch/api",
"openApiUrl": "https://example.com/booksearch/openapi.yaml",
"authentication":
{
"type": "apiKey",
"in": "header",
"name": "x-api-key"
}
}
Once you have created your JSON manifest file for your plugin, you need to host it at a publicly accessible URL under the /.well-known/ai-plugin.json path. For example,
https://example.com/.well-known/ai-plugin.json
This URL will be used by ChatGPT to discover and install your plugin.
How to use ChatGPT plugins:
Users can use plugins with ChatGPT by providing specific commands or keywords in their messages. These commands or keywords will trigger the plugin to perform the desired action or function. For example, users can use the Wolfram plugin to access computation, math, curated knowledge, and real-time data by typing “Wolfram” followed by a question or command. Users can also use natural language to interact with the plugin, as long as ChatGPT can understand the intent and context of the message.
Some examples of using different plugins for different scenarios and tasks are:
Example 1. Play chess with ChatGPT using Chess Plugin:
Users can use the Chess plugin to play a fully-functioning game of chess with ChatGPT, with a board that visually updates. Users can choose from different levels of difficulty, from beginner to grandmaster. Users have to type commands using SAN notation, such as “Pawn to d5”.
The below example illustrates how the Chess plugin works. There is no such conversation between the users and ChatGPT:
User: Chess
ChatGPT: Welcome to Chess! Choose your level of difficulty: Beginner, Intermediate, Advanced, Expert, Grandmaster.
User: Intermediate
ChatGPT: OK, you are playing against an intermediate-level opponent. You are playing white. Make your move using SAN notation.
Example 2. Plan a trip with ChatGPT using KAYAK plugin:
Users can use the KAYAK plugin to help them plan a trip to a destination, by searching for flights, hotels, and rental cars. Users can provide some details, such as the date, budget, and preferences, and ChatGPT will generate some recommendations and links to book them. Users can also ask ChatGPT for more information or options.
The below example illustrates how the KAYAK plugin works. There is no such conversation between the users and ChatGPT:
User: I need help planning a trip to New York City
ChatGPT: Sure, I can help you with that. When do you want to go?
User: Next month
ChatGPT: OK, how long do you want to stay?
User: 5 days
ChatGPT: Alright, what is your budget for flights?
User: $500
ChatGPT: OK, I found some flights that match your criteria. Here are some options:
Delta Airlines from Los Angeles to New York JFK on June 15th at 8:00 AM for $250
American Airlines from Los Angeles to New York LGA on June 15th at 9:00 AM for $260
United Airlines from Los Angeles to New York EWR on June 15th at 10:00 AM for $270
Which one do you prefer?
Example 3. Shop online with ChatGPT using Klarna Shopping plugin:
Users can use the Klarna Shopping plugin to search and compare prices from thousands of online shops. Users can provide some keywords or categories for what they want to buy, and ChatGPT will generate some results and links to buy them. Users can also ask ChatGPT for more options or features.
The below example illustrates how the Klarna shopping plugin works. There is no such conversation between the users and ChatGPT:
User: I want to buy a new laptop
ChatGPT: OK, what kind of laptop are you looking for?
User: Something fast and light
ChatGPT: Alright, I found some laptops that match your criteria. Here are some options:
Apple MacBook Air 13-inch M1 chip 8GB RAM 256GB SSD for $999
Dell XPS 13 9310 13-inch Intel Core i7 16GB RAM 512GB SSD for $1,299
Lenovo ThinkPad X1 Carbon Gen 9 14-inch Intel Core i5 8GB RAM 256GB SSD for $1,199
Which one do you like?
List of ChatGPT Plugins
1. Expedia
A plugin that allows ChatGPT to help users plan their trips by searching for flights, hotels, car rentals, and activities on Expedia. Users can provide some details, such as the destination, date, budget, and preferences, and ChatGPT will generate some recommendations and links to book them. Users can also ask ChatGPT for more information or options.
2. FiscalNote
A plugin that provides and enables access to select market-leading, real-time data sets for legal, political, and regulatory data and information. Users can ask ChatGPT questions or commands related to these data sets, such as the status of a bill, the voting record of a legislator, the impact of regulation, etc. ChatGPT will use FiscalNote’s API to retrieve and present the relevant data and information.
3. Isntacart
A plugin that allows ChatGPT to help users order groceries from their favorite local stores on Instacart. Users can provide some keywords or categories for what they want to buy, and ChatGPT will generate some results and links to buy them. Users can also ask ChatGPT for more options or features.
4. KAYAK
A plugin that allows ChatGPT to help users plan their trips by searching for flights, hotels, and car rentals on KAYAK. Users can provide some details, such as the destination, date, budget, and preferences, and ChatGPT will generate some recommendations and links to book them. Users can also ask ChatGPT for more information or options.
5. Klarna Shopping
A plugin that allows ChatGPT to help users shop online by searching and comparing prices from thousands of online shops on Klarna. Users can provide some keywords or categories for what they want to buy, and ChatGPT will generate some results and links to buy them. Users can also ask ChatGPT for more options or features.
6. Milo Family AI
A plugin that gives parents superpowers to turn the manic to magic, 20 minutes each day. Users can ask Milo for parenting advice, inspiration, tips, activities, games, stories, etc. Milo will use its AI-powered platform to provide personalized and engaging responses and suggestions.
7. OpenTable
A plugin that provides restaurant recommendations based on user preferences with a direct link to book on OpenTable. Users can provide some details such as location, cuisine, price, occasion, etc., and ChatGPT will generate some recommendations and links to book them. Users can also ask ChatGPT for more information or options.
8. Shop
A plugin that allows ChatGPT to help users shop online by searching for millions of products from the world’s greatest brands on Shop. Users can provide some keywords or categories for what they want to buy, and ChatGPT will generate some results and links to buy them. Users can also ask ChatGPT for more options or features.
9. Speak
A plugin that allows ChatGPT to help users learn how to say anything in another language with Speak, your AI-powered language tutor. Users can provide some words, phrases, or sentences in their native language, and ChatGPT will translate them into the target language, and provide audio pronunciation, grammar explanation, and cultural context.
10. Wolfram
A plugin that allows ChatGPT to access computation, math, curated knowledge, and real-time data through Wolfram|Alpha and Wolfram Language. Users can ask ChatGPT questions or commands related to these domains, such as solving equations, plotting graphs, finding facts, analyzing data, etc. ChatGPT will use Wolfram’s API to perform the computations and present the results.
11. Zapier
A plugin that allows ChatGPT to interact with over 5,000+ apps like Google Sheets, Trello, Gmail, HubSpot, Salesforce, and more through Zapier. Users can ask ChatGPT questions or commands related to these apps, such as creating tasks, sending emails, updating records, etc. ChatGPT will use Zapier’s API to connect and automate the apps.
Benefits of using Plugins:
They provide more functionality and diversity to ChatGPT’s responses and actions.
They connect ChatGPT to real-world applications and data sources, such as web browsing, code interpretation, travel booking, online shopping, team collaboration, and more.
They are designed specifically for language models with safety as a core principle, and help ChatGPT avoid generating harmful or inappropriate content.
Limitations of using plugins:
They require a large amount of data for training, and may not be able to handle complex or rare scenarios or queries.
They lack emotional intelligence and can generate errors or inconsistencies in their text. They may also misinterpret the user’s intent or context.
They require manual activation by the users, and may not be compatible with all devices or platforms.
They have potential risks of misuse or abuse, such as generating false or misleading information, violating privacy or security, or harming individuals or groups.
Best Practice for Using ChatGPT Plugins
Some rules and tips for using plugins effectively and safely are:
Use only plugins that are verified and trusted by OpenAI or reputable developers. Avoid using plugins from unknown or unverified sources, as they may contain malicious code or harm your data or privacy.
Check the compatibility and update status of your plugins regularly. Some plugins may not work well with older or newer versions of ChatGPT, or may require additional features or parameters. You can check the compatibility and update status of your plugins in the ChatGPT UI or the API.
Test the plugin thoroughly before using it for professional or sensitive purposes. Make sure the plugin works as expected and does not generate errors or inappropriate content. You can use the ChatGPT UI or the API to test your plugin with different inputs and outputs.
Use authentication and authorization methods when accessing your plugin’s API (if required). Authentication and authorization are essential for securing your plugin’s API from unauthorized or malicious access. There are many methods and protocols for implementing authentication and authorization in your plugin’s API, such as OAuth 2.0, JWT (JSON Web Token), API keys, etc.
Be mindful of the limitations and risks of using plugins with ChatGPT. Plugins require a large amount of data for training, and may not be able to handle complex or rare scenarios or queries. Plugins lack emotional intelligence and can generate errors or inconsistencies in their text. They may also misinterpret the user’s intent or context. Plugins have potential risks of misuse or abuse, such as generating false or misleading information, violating privacy or security, or harming individuals or groups.
Conclusion:
ChatGPT plugins are additional modules or extensions that can be added to the ChatGPT system to enhance its functionality. They allow developers to customize and extend the capabilities of the base model for specific tasks or domains.
Plugins can be created to provide specialized functionality, such as language translation, code generation, or even playing games like chess. These plugins can leverage the underlying language model's capabilities to perform specific tasks more efficiently.
Commentaires