New section for ChatGPT plugin manifest

In the OpenAI blog entry

Function calling and other API updates

is this statement

These use cases are enabled by new API parameters in our /v1/chat/completions endpoint, functions and function_call , that allow developers to describe functions to the model via JSON Schema, and optionally ask it to call a specific function.


Earlier today before reading/knowing of the blog entry created this ChatGPT prompt

Prompt
ChatGPT May 24 Version

Modify this ChatGPT plugin manifest to now include that the plugin can additionally execute a Prolog query.

{
  "schema_version": "v1",
  "name_for_human": "SWI-Prolog REPL",
  "name_for_model": "SWI_Prolog_REPL",
  "description_for_human": "Compile SWI-Prolog code and return results, success or errors.",
  "description_for_model": "Validate Prolog code generated by ChatGPT using SWI-Prolog and return results, success or errors. Transform Prolog code in prompt to application/json before sending to plugin.",
  "auth": {
    "type": "none"
  },
  "api": {
    "type": "openapi",
    "url": "http://localhost:5003/openapi.yaml",
    "is_user_authenticated": false
  },
  "logo_url": "http://localhost:5003/logo.png",
  "contact_email": "support@example.com",
  "legal_info_url": "https://example.com/legal"
}

Completion

Here’s the modified manifest. I’ve added a new function executeQuery under the functions field, which represents the new capability of executing a Prolog query.

{
  "schema_version": "v1",
  "name_for_human": "SWI-Prolog REPL",
  "name_for_model": "SWI_Prolog_REPL",
  "description_for_human": "Compile and execute SWI-Prolog code, return results, success or errors.",
  "description_for_model": "Validate and execute Prolog code generated by ChatGPT using SWI-Prolog and return results, success or errors. Transform Prolog code in prompt to application/json before sending to plugin.",
  "auth": {
    "type": "none"
  },
  "api": {
    "type": "openapi",
    "url": "http://localhost:5003/openapi.yaml",
    "is_user_authenticated": false
  },
  "functions": [
    {
      "name": "compileCode",
      "description": "Compile Prolog code and return results, success or errors."
    },
    {
      "name": "executeQuery",
      "description": "Execute a Prolog query and return results, success or errors."
    }
  ],
  "logo_url": "http://localhost:5003/logo.png",
  "contact_email": "support@example.com",
  "legal_info_url": "https://example.com/legal"
}

Please note that the actual implementation of the executeQuery function would need to be done on the server side where the plugin is hosted. This manifest file only describes the capabilities of the plugin.


If you have been developing ChatGPT plugins then you know that this section of a manifest is new.

  "functions": [
    {
      "name": "compileCode",
      "description": "Compile Prolog code and return results, success or errors."
    },
    {
      "name": "executeQuery",
      "description": "Execute a Prolog query and return results, success or errors."
    }
  ]

I left the new section in the manifest to see if it was validated when a plugin was installed, this is the result


To learn about function_call created a similar prompt for ChatGPT.

Prompt
ChatGPT May 24 Version

Modify this ChatGPT manifest file to include a function_call for each function

{
  "schema_version": "v1",
  "name_for_human": "SWI-Prolog REPL",
  "name_for_model": "SWI_Prolog_REPL",
  "description_for_human": "Compile and execute SWI-Prolog code, return results, success or errors.",
  "description_for_model": "Validate and execute Prolog code generated by ChatGPT using SWI-Prolog and return results, success or errors. Transform Prolog code in prompt to application/json before sending to plugin.",
  "auth": {
    "type": "none"
  },
  "api": {
    "type": "openapi",
    "url": "http://localhost:5003/openapi.yaml",
    "is_user_authenticated": false
  },
  "functions": [
    {
      "name": "compileCode",
      "description": "Compile Prolog code and return results, success or errors."
    },
    {
      "name": "executeQuery",
      "description": "Execute a Prolog query and return results, success or errors."
    }
  ],
  "logo_url": "http://localhost:5003/logo.png",
  "contact_email": "support@example.com",
  "legal_info_url": "https://example.com/legal"
}

Completion

Here’s the modified manifest. I’ve added a function_call field for each function, which describes how to call the function:

{
  "schema_version": "v1",
  "name_for_human": "SWI-Prolog REPL",
  "name_for_model": "SWI_Prolog_REPL",
  "description_for_human": "Compile and execute SWI-Prolog code, return results, success or errors.",
  "description_for_model": "Validate and execute Prolog code generated by ChatGPT using SWI-Prolog and return results, success or errors. Transform Prolog code in prompt to application/json before sending to plugin.",
  "auth": {
    "type": "none"
  },
  "api": {
    "type": "openapi",
    "url": "http://localhost:5003/openapi.yaml",
    "is_user_authenticated": false
  },
  "functions": [
    {
      "name": "compileCode",
      "description": "Compile Prolog code and return results, success or errors.",
      "function_call": {
        "method": "POST",
        "path": "/compile",
        "parameters": {
          "code": "string"
        }
      }
    },
    {
      "name": "executeQuery",
      "description": "Execute a Prolog query and return results, success or errors.",
      "function_call": {
        "method": "POST",
        "path": "/execute",
        "parameters": {
          "query": "string"
        }
      }
    }
  ],
  "logo_url": "http://localhost:5003/logo.png",
  "contact_email": "support@example.com",
  "legal_info_url": "https://example.com/legal"
}

The function_call field describes how to call the function. It includes the HTTP method to use (method), the path to the function on the server (path), and the parameters to pass to the function (parameters). The parameters field is a dictionary where the keys are the parameter names and the values are the parameter types.


Was not expecting function_call to be subpart of a specific function from reading the blog but makes sense.

I left the new section in the manifest to see if it was validated when a plugin was installed, this is the result


Checked if the official ChatGPT plugin documentation noted this but not of this date. June 13, 2023. Seems ChatGPT now knows more than the public documentation.

Don’t forget to checkout the blog section Function calling example which has some nice examples, more detail than shown in the completions above.

Enjoy!!!

3 Likes

awesome, thanks for sharing this @EricGT :smiley:

1 Like