#How do Actions work in GPTs

1 messages · Page 1 of 1 (latest)

glacial dune
#

Can you please explain what are actions and how to fix my issue? I'm trying to create a new GPT and make it use Actions to connect with a weather API as an example. However, I'm facing problems when I click the test button. Here's what happens.

User
Call the weather.example.com API with the GetCurrentWeather operation
[debug] Calling HTTP endpoint
[debug] Calling HTTP endpoint
[debug] Response received
Error talking to
It seems there was an issue accessing the weather information for New York, NY using the weather.example.com API. If you have a specific location in mind, or if you'd like me to try again or use a different source for weather information, please let me know.

idle barnBOT
#

Hi @glacial dune. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Actions in GPTs are a way to connect a GPT to a custom API. They allow GPTs to integrate external data or interact with the real-world. For example, you can connect GPTs to databases, plug them into emails, or make them your shopping assistant. Actions are defined using an OpenAPI specification, which can be hosted by OpenAI. This specification defines the endpoints (now called "functions") that your GPT can call. Actions also support multiple authentication schemas, which can be set on a per-endpoint basis. This means you can have some endpoints that require authentication and some that don't. You can also set certain endpoints as "consequential", which means the operation must always prompt the user for confirmation before running[^1^].

To create an Action, you can start by creating a GPT in the ChatGPT UI and then connect it to your existing plugin OpenAPI reference. From the GPT editor, you can select "Configure", then "Add Action", and fill in your OpenAPI spec or paste in a URL where it is hosted[^2^].

Regarding the issue you're facing, it could be due to a few reasons. One possibility is that the UI isn't saving changes to your OpenAPI schema. You can check this by exiting edit mode and coming back in to see if any changes you made were actually saved[^5^]. Another possibility is that there might be an issue with your API or the way it's being called. You can test your API with a tool like Postman to ensure it's working correctly[^3^].

If you're still having trouble, you might find it helpful to look at some examples of how to connect a GPT to an external API[^4^].

#

^1^]: [Docs > Actions in GPTs > Actions vs Plugins (https://platform.openai.com/docs/actions)
^2^]: [Docs > Actions in GPTs > Create an Action (https://platform.openai.com/docs/actions)
^3^]: [Forum Post: Issue with GPT Actions not triggering external API calls > Original post (https://community.openai.com/t/495495)
^4^]: [Forum Post: [SOLVED] How to connect private database with GPT? > Official Answer (https://community.openai.com/t/529309)
^5^]: [Forum Post: Issue with GPT Actions not triggering external API calls > Official Answer (https://community.openai.com/t/495495)

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@glacial dune kapa.ai is still learning and improving, please let us know how it did by reacting below

glacial dune
#

@idle barn Please provide a simple example of a schema that doesn't require any Authentication.

idle barnBOT
#

Let me check the knowledge base for you. One moment! :books:

#

Sure, here's an example of a simple OpenAPI schema that doesn't require any authentication. This schema is for a hypothetical API that has a GET endpoint at /search, which takes a query parameter input_text.

{
    "openapi": "3.1.0",
    "info": {
        "title": "WebdadiAPI",
        "version": "0.1.0"
    },
    "servers": [
        {
            "url": "MyFQDN/"
        }
    ],
    "paths": {
        "/search": {
            "get": {
                "summary": "Search GPT-generated content",
                "operationId": "searchGPTContent",
                "parameters": [
                    {
                        "name": "input_text",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        }
    }
}

This schema is defined without any security or securitySchemes fields, which means it doesn't require any authentication. The input_text parameter is required and must be a string.

Please replace "MyFQDN/" with your actual server URL.

This example was extracted from a forum post on the OpenAI community[^1^].

^1^]: [Forum Post: How do you pass a user question as a param inside the OpenAI Spec schema > Official Answer Part 1 (https://community.openai.com/t/535556)

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

glacial dune
#

I am trying to make a simple test with an API that doesn't require a key. Can you provide an example that would work ? @idle barn ?

idle barnBOT
#

Let me check the knowledge base for you. One moment! :books:

#

Sure, here's an example of how you can set up a simple test with an API that doesn't require a key. This example uses the OpenAPI schema for a hypothetical API with a GET endpoint at /search, which takes a query parameter input_text.

{
    "openapi": "3.1.0",
    "info": {
        "title": "WebdadiAPI",
        "version": "0.1.0"
    },
    "servers": [
        {
            "url": "<https://your-api-url.com/">
        }
    ],
    "paths": {
        "/search": {
            "get": {
                "summary": "Search GPT-generated content",
                "operationId": "searchGPTContent",
                "parameters": [
                    {
                        "name": "input_text",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        }
    }
}

In this schema, replace "<https://your-api-url.com/"> with the actual URL of your API. The input_text parameter is required and must be a string.

To test this API, you can use a tool like Postman or curl. Here's an example of how you can do it with curl:

curl "<https://your-api-url.com/search?input_text=test">

Replace "<https://your-api-url.com/search?input_text=test"> with your actual API URL and the test input you want to use.

Please note that this is a hypothetical example and the actual implementation may vary depending on the specific API you are using.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: