OpenAI has developed plugins that integrate ChatGPT with external third-party applications. These plugins enhance ChatGPT’s functionality by allowing it to interact with APIs created by developers, thus expanding its range of capabilities. With these plugins, ChatGPT can:
- Access up-to-date information, such as current sports scores, stock market trends, and breaking news.
- Retrieve data from knowledge bases, like company documents or personal notes.
- Help users with various tasks, such as booking flights or ordering food.
- As an introductory guide, you can start with plugin quickstart repository to see an example in action while you explore the documentation and learn more about these plugins.
Developers of these plugins provide one or more API endpoints, along with a standard manifest file and an OpenAPI specification. This setup defines the plugin’s features, enabling ChatGPT to utilize these files and interact with the APIs as defined by the developers.
In this system, the AI model serves as a savvy API user. With a given API specification and a user’s natural-language request, the model actively engages with the API to execute tasks. For example, in response to a query like “Where should I stay in Paris for a couple of nights?”, the AI might utilize a hotel booking plugin API. It would process the API’s response and craft an answer for the user, blending the received API data with its natural language processing abilities.
We expect that over time, the system will advance to handle increasingly complex applications and user needs.
ChatGPT Plugin Flow
To develop a plugin, it’s crucial to grasp the complete process:
Manifest File Creation and Hosting:
- Create a manifest file and host it on your domain (e.g., yourdomain.com/.well-known/ai-plugin.json).
- This file should include metadata about your plugin (like name and logo), authentication details (authentication type, OAuth URLs, etc.), and an OpenAPI specification for the endpoints you wish to make available.
OpenAPI Description:
- The model will access the OpenAPI description fields. Use these fields to provide natural language descriptions for different fields in your API.
Plugin Complexity:
- Initially, limit your plugin to 1-2 endpoints with as few parameters as possible. This helps keep the text length manageable, as the plugin description, API requests, and responses will be part of the ChatGPT conversation, which has a context limit.
Plugin Registration
- Register your plugin in the ChatGPT user interface (UI).
- Go to the plugin model in the top drop-down menu, then select “Plugins”, “Plugin Store”, and “Develop your own plugin”.
- If your plugin requires authentication, provide an OAuth 2 client_id and client_secret or an API key.
User Activation:
- Users must activate your plugin manually in the ChatGPT UI. ChatGPT won’t use your plugin by default.
- You can share your plugin with up to 100 additional users (note that only other developers can install unverified plugins).
- If OAuth authentication is necessary, users will be redirected to your plugin for sign-in via OAuth.
User Interaction:
- When a conversation starts, OpenAI injects a brief description of your plugin into the ChatGPT message stream, invisible to end users. This includes the plugin description, endpoints, and examples.
- If a user asks a relevant question, the model might use an API call from your plugin if it’s appropriate. For POST requests, developers should create a user confirmation flow to prevent destructive actions.
- The model then integrates the results of the API call into its response to the user.
- Links from API calls might be included in the response and displayed as rich previews (using the OpenGraph protocol to pull information like site name, title, description, image, and URL).
- The model can also present data from your API in markdown, which the ChatGPT UI will render automatically.
Location Data:
- The user’s country and state will be sent in the Plugin conversation header (e.g., {“openai-subdivision-1-iso-code”: “US-CA”}). This can be useful for plugins related to shopping, restaurants, weather, etc. More details can be found in the developer terms of use.
Read related articles: