I made my own plugin system with ChatGPT API

Hey :wave:, guys just wanted to share my work for my website called InteraxAI. I managed to create my own plugin system using some prompt engineering.


How did I do it?

In general, I utilized two prompts to accomplish this task and some helper functions. The first prompt was made to obtain the appropriate plugin endpoint from the OpenAPI specification of the plugin, in the specified format:

  "endpoint": string \\ The API endpoint (including the base URL)
  "method": string \\ The HTTP method
  "query": string \\ The required query parameters if method is GET (e.g param1=value1&param2=value2)
  "body": string \\ The required stringified body data if method is POST
  "plugin": string \\ The name of the plugin

Subsequently, I created a helper function that generates the appropriate HTTP request. The following is the output:

   plugin: 'Example Plugin',
   url: 'https://api.example.com/product-search/v1/search?query=value',
   options: { method: 'GET', headers: { Content-Type: 'application/json' } }

After obtaining the result from the endpoint, I proceed to use it as input for another chat API call.

A limitation of this system is its inability to chain results. For instance, it is not possible to request to utilize Web Search to obtain the latest product and then use another plugin to retrieve the price. Unless you do it one by one.

1 Like