Check out a free preview of the full First Look: ChatGPT API for Web Developers course

The "Plugins" Lesson is part of the full, First Look: ChatGPT API for Web Developers course featured in this preview video. Here's what you'd learn in this lesson:

Maximiliano discusses creating and utilizing ChatGPT plugins to enhance the generated responses. The discussion includes practical examples of a ChatGPT plugin manifest and endpoint description.

Preview
Close

Transcript from the "Plugins" Lesson

[00:00:00]
>> Another thing that we can do or we can start thinking about as web developers is plugins for ChatGPT, and potentially for other LLMs or apps such as Bing Chat in the future. So this is a new feature to GPT, it's not yet available for everyone. In fact in my account, I don't yet have access to it, but I know how that works from a development point of view.

[00:00:26]
And the idea is that the user can pick from a list of plugins that you can install from a marketplace at any time when you're making a query in the ChatGPT website, and then ChatGPT will use those plugins for enhancing the answer. I will explain how that works in a minute.

[00:00:47]
So it's not like ChatGPT will know all the time all the plugins. The user will install plugins, and then the user will pick at any particular moment, hey, for the query that I'm going to do right now, I want you to use those plugins if you feel ChatGPT that that will be useful, that's the idea.

[00:01:09]
And plugins are basically web services. Going back to the idea that I mentioned before, we can make a plugin from Frontend Master videos. So then we need to create first a web service that will expose the endpoints to ChatGPT with information that is useful for wherever we think that ChatGPT can use our data for.

[00:01:31]
We integrate the JSON manifest and register that manifest with ChatGPT. I will show you a sample of that manifest in a minute. And also if you want, you can require authentication from users to the system, because that plugin can actually read, for example, your emails. It doesn't need to be a public API.

[00:01:53]
It can also have an authentication token that goes to that user. And maybe you wanna charge for that, so it needs to be a premium user. How does it work? So we are developers. When we think about plugins, we think that there is an API where we can hook our web services or something like that, and then the GPT model will know that our service is doing something and it will work.

[00:02:24]
But actually, it's much more simple, and I could say sometimes even silly than that. This is how it works. So the user is in ChatGPT and the user added your plugin to their system from the marketplace, and ChatGPT will check, will have the list of plugins enable. And every plugin has a text that you define explaining what kind of data is available in that plugin.

[00:02:59]
ChatGPT uses GPT to actually ask the model if for the user's question, it seems likely that that plugin is useful. So let's say that I'm asking or I wanna know where I can find information about PHP in Frontend Masters. So then ChatGPT will send to the model a question.

[00:03:28]
Do you feel like any of these plugins will enhance the answer? And the model will say, yeah, the Frontend Master plugin can do that. Then ChatGPT will go, it will call our service and it will enhance the prompt. How is going to enhance the prompt? It will copy and paste the response from the web service into the prompt.

[00:03:54]
So if it feels weird, we will do something similar, so no worries. The thing I'm telling you here is that if we're making a web service for a ChatGPT plugin, the information that we provide from the service will finally end up within the prompt as text, okay, as context for the prompt.

[00:04:16]
It's not really applying into the GPT model. You're just hacking the prompt with the data from our plugin, that's how it works, it's kind of weird. So the plugin is a JSON file that you must store in your well-known folder, is a JSON file with metadata. And here, you will see that there is a name for human and name for model, a description for human and a description for model.

[00:04:45]
So the description for human is for the marketplace, so the human can check or uncheck that plugin. But the most important one is description for the model, because this description is the one that is going to be used to determine if that plugin is useful or not for the current query.

[00:05:07]
Does it makes sense? It's a little hacky. And where do you define your endpoints and the data structure of your web services? In a YAML file. So we have a JSON file and also a YAML file. The YAML file looks like this, where you said the URL of the endpoint.

[00:05:30]
And then it's like a web service description that you have a get. The get has a summary, the possible responses, the structure, the schema of the answer that you will provide. You can even ask ChatGPT to make this file for you. Have in mind that plugins are not just for reading information, they can also be for acting.

[00:05:55]
So you can add things to your database based on the ChatGPT response. It's not just to receive data. It's the main purpose, but not the only purpose. So let me show you quickly how plugins work. For that, I will show you a video, just to understand in case you haven't seen this, how a plugin will work from a user's perspective.

[00:06:19]
So you see-
>> I'm going to show you.
>> Let me mute. The guy here, but actually, what you have is a selector for the model that we have today, and there is a model for using plugins. And then you enable the plugins that you wanna use for this particular query.

[00:06:35]
You go to the store, you install plugins, and then on each query, you can enable or disable plugins. And again, the first step will be for the model to see if the plugins enable, these three, are suitable for this prompt. The same GPT model will say, I think that maybe this one is useful.

[00:07:01]
So if the prompt makes that decision, then it will act and open that web service. It will call the web service and it will inject the respond in the prompt. So that's how a plugin works. So you're not actually hooking into the model, you are hooking into the prompt.

[00:07:26]
You are hacking the prompt, the string that goes to the model. So that's how you need to think about creating plugins. So if you are a source of information, then maybe it's a good idea to start thinking about creating a plugin. And if you wanna create a plugin, you can apply today for a waitlist for developers.

[00:07:48]
In that case, you explain what your plugin is for, why it's useful. And if you get access to it, you can start playing and trying your plugins there. So as a developer, that's the plugin.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now