GPTs

Actions in GPTs

Discover how to create a GPT feature that skillfully interfaces with your API.

What exactly is a GPT?

GPTs enable tailored adaptation of ChatGPT for specific scenarios, offering unique functionalities. You can develop a GPT that:

  • Directs its interactions with users through bespoke guidelines,
  • Incorporates tools such as browsing, DALL·E, and a Code Interpreter,
  • Provides preconfigured initial prompts for both new and recurring users,
  • Features custom actions for API integration.

What does an action entail in a GPT?

Beyond the inbuilt features like browsing, DALL·E, and Code Interpreter, you have the option to create custom actions by linking the GPT with one or more APIs. These actions empower GPTs to assimilate external information or engage with the real world. This could mean linking GPTs to databases, integrating them with your email systems, or transforming them into shopping assistants, all via APIs.

The concept of actions is an evolution from our plugins beta, offering developers more influence over the model and the way their APIs are engaged. Actions are crafted using the OpenAPI specification, a recognized standard for API description.

GPT action flow

To successfully create a GPT with a custom action, it’s essential to grasp the complete process.

  1. Start by generating a GPT in the ChatGPT user interface.
  2. You can either manually set up or utilize the GPT builder to create your GPT.
  3. Choose the API(s) you wish to integrate.
  4. Navigate to the “Configure” section in the GPT editor and opt for “Create new action”.
  5. You’ll encounter three key steps: choosing the authentication schema for the action, inputting the schema, and specifying the privacy policy URL.
  6. The Schema should adhere to the OpenAPI specification (distinct from OpenAI) to outline the GPT’s access to an external API.
  7. Complete the details for the schema, authentication, and privacy policy.
  8. For authentication, you’ll find three choices: “None”, “API Key”, and “OAuth”. We’ll delve into these more thoroughly later.
  9. Regarding the schema, either use an existing OpenAPI spec for your API or create a new one. If you’ve already published an OpenAPI spec online, it can be imported via the “Import from URL” feature.
  10. The privacy policy URL is shown to users when they activate a GPT and view the dropdown in the top left, displaying the GPT’s name.
  11. Decide your GPT’s visibility level.
    • By default, GPTs are private.
    • Upon saving, you can publish the GPT to a specific audience: “Only me”, “Anyone with a link”, or “Everyone”.
    • Different visibility levels have varying constraints and requirements, such as more stringent naming rules for GPTs shared with others.

Users interact with your GPT

  1. Based on the GPT’s visibility, users might access it through a link you provide or discover it in the GPT store.
  2. If OAuth is necessary, users will be prompted to log in during their session.
  3. The GPT, behind the scenes, incorporates the configuration details (including actions, tools, and instructions) into the model’s context.
  4. When a user makes a request, the model reviews the available tools, actions, and instructions to determine the GPT’s response.
  5. For instance, if a user requests weather information for a specific location and you’ve included a “Check weather” action, the model will utilize your OpenAPI spec to query that API and relay the response to the user.

Read related articles:


Tags: