Exploring The ChatGPT Retrieval Plugin Code

Post author: Adam VanBuskirk
Adam VanBuskirk
3/31/23 in
AI

The ChatGPT Retrieval Plugin lets you easily search and find personal or work documents by asking questions in everyday language. Open AI made the plugin’s source code open source, meaning anyone is free to look at it, use it, and fork it for their own use. In this post, we’ll review in general what the plugin consists of so to gain a better understanding of what must be done to create a ChatGPT plugin.

Where is the source code?

The source code is stored on GitHub and can be found here. Looking at the language analyzer on GitHub, we see that the plugin is 99.5% Python, meaning the plugin is written in Python. If you’re a PHP, JavaScript, or C# person, you should still be able to follow along, but might need to study Python a bit to fully understand the code.

An Example of The Plugin Working

You can see an example of the plugin retrieving data from folders and using the data in its response in the below 40 second video.

The General Components of a ChatGPT Plugin

Developers can create a plugin by exposing an API through their website and providing a standardized manifest file that describes the API. ChatGPT consumes these files and allows the AI models to make calls to the API defined by the developer.

In a nutshell, a plugin consists of:

  • An API
  • An API schema (OpenAPI JSON or YAML format)
  • A manifest (JSON file) that defines relevant metadata for the plugin

Standup Your Plugin

To standup your plugin for use, you simply deploy your code on a server. Heroku us a great option, but it could literally be any server on any website running in any programming language. At the end of the day, the plugin is simply a setup of restful API endpoints that ChatGPT will call and return data from.

Deploy Your Plugin in Developer Mode

To install a developer plugin, follow the steps below:

  • First, create your developer plugin by deploying it to your preferred hosting platform (e.g. Fly.io, Heroku, etc.) and updating the plugin URL in the manifest file and OpenAPI schema.
  • Go to ChatGPT and select “Plugins” from the model picker.
  • From the plugins picker, scroll to the bottom and click on “Plugin store.”
  • Go to “Develop your own plugin” and follow the instructions provided. You will need to enter the domain where your plugin is deployed.
  • Follow the instructions based on the authentication type you have chosen for your plugin (e.g. if your plugin uses Service Level HTTP, you will have to paste in your access token, then paste the new access token you receive from the plugin flow into your ai-plugin.json file and redeploy your app).
  • Next, you must add your plugin. Go to the “Plugin store” again and click on “Install an unverified plugin.”
  • Follow the instructions provided, which will require you to enter the domain where your plugin is deployed.
  • Follow the instructions based on the authentication type you have chosen for your plugin (e.g. if your plugin uses User Level HTTP, you will have to paste in your bearer token).

After completing these steps, your developer plugin should be installed and ready to use in ChatGPT.

Conclusion

The linked source code in the beginning of this post has all the details for the ChatGPT retrieval plugin. As discussed above, a plugin is ultimately an API endpoint(s), API schema, and a manifest. You deploy these onto a webserver on your domain / website, and then install the plugin in ChatGPT. From a software development perspective, it’s very straightforward.

Sign up today for our weekly newsletter about AI, SEO, and Entrepreneurship

Leave a Reply

Your email address will not be published. Required fields are marked *


Read Next




© 2024 Menyu LLC