How to retrieve information from external API?

Hi, I’ve successfully set up a custom custom GPT model with a custom action to retrieve information from an external API, which works fairly well, though it has occasional issues (but that’s a separate matter).

I’m now attempting to create a similar assistant in the OpenAI Playground to be used via API, but I’m struggling to configure a custom action in the same manner as I did with ChatGPT. When I try to replicate the JSON configuration from the custom actions in my GPT-3 model, I get an “Invalid JSON” error.

I’ve loaded an example JSON of actions in the Playground, but it’s not clear how to set up the external API call.

Additionally, I’m looking to build an assistant that fetches a product list from my API and makes recommendations to the user based on that list.

Where shoud I to configure the call to my API?

Thanks.

2 Likes

The AI doesn’t call APIs or access the web.

It returns a function call specification back to you.

What you do with the text {"location": "Pismo Beach", "unit": "c"} is up to you.

1 Like

But in ChatGPT you can do it. Why with API you can’t? Maybe It’ll be a future functionality?

1 Like

Anyone can help me with this? I would need to create an assistant to can call it via API and that assistant can call endpoints.

ChatGPT has an authentication method similar to plugins to access your API site on your given domain, not to randomly hit other party’s APIs for profit.

When using the OpenAI API to use models, you would use function call (now tools) to specify a particular function (such as do_trigonometry), and then you would receive a function call from the AI when obtaining the status of a run.

Then in your own code, you would calculate when the AI wants to know sin(3/17), or you would send that to the other mathematics API site that you subscribe to. Then return the result to the assistant so that it can answer the user (which is giving the result back to your code but in language model answer form).

Calling an external API like ‘https: // xxx.xxx.xx.5:5000 / send_data’ is possible from an assistant API or not? in functions section

Not.

An assistant cannot reply to the internet. It can only reply to you.

The second post of this thread should give an idea what it looks like when a function to check the weather has been specified and is needed by the AI.

1 Like