Create a Plugin from 3rd Party API#
Imprompt enables you to create new plugins, import them into an OpenPlugin Manifest, and use them in an LLM environment. This tutorial will help walk through those steps. The plugin we will be creating is OpenAI Dalle2 plugin that will take a string of text and convert it to an image and responding with the URL.
Getting Started#
To get started, we will first need to understand the API docs for the OpenAI Dalle2 model. This will allow us to understand what the model expects and returns.
Create OpenAPI Document#
Now that we understand the API docs, we can create an OpenAPI document. If you are familiar with creating this yourself, you can use Swagger Editor. I will instead create a Postman Collection so I can first test the API.
Next, I will import the collection into Stoplight for the ease of modifying & creating the OpenAPI document. When I am happy with the OpenAPI document, I will export it as a JSON file.
Import into Imprompt#
Now that we have our OpenAPI document, we can import it into Imprompt.
You have the option to enable/disable operations from your OpenAPI document. In this case, we only have one operation, so we will enable it.
Edit & Save OpenPlugin Manifest#
After we have imported our plugin, it will produce us with a starter OpenPlugin Manifest.
We will need to edit this manifest to include more information about our plugin, such a description, logo, etc.
I will add human_usage_examples
to give the user an idea of how to use the plugin. I will also add
plugin_signature_helpers
to assist the LLM in using the plugin and assigning the correct values to the
operation. Lastly, I will add plugin_cleanup_helpers
to assist the LLM in cleaning up the response from the
API operation. To learn more about these fields, please visit the OpenPlugin Manifest
docs.
Try Plugin#
Now we can try our plugin in Imprompt!