Appgyver with ChatGPT

I’m trying to use the ChatGPT API but I’m not getting success.

I have a simple screen with a button and a text field.

When clicking on the button, I want it to make a call to the ChatGPT API passing the following question: “A sentence of optimism”.

Next I want to display the response coming from ChatGPT in the text field.

Can anyone help?

You’d need to give more details (with screenshots if that helps) of what you did / tried to do.

In short, make a proper call to the API with all the right headers and parameters and then store the response to a page var that will display the value in your page.

That’s the problem: I’ve already read the AppGyver documentation here and even watched some videos on YouTube, but unfortunately I can’t make any kind of use with the API. So I’m seeing ships without knowing how to proceed.

The API call to openAI follows the same principles as any other API calls.
You have a Request URL with params, headers with API key, etc, and request body where you specify all chatGPT parameters as per their documentation. You need to follow openAI API doc.

1 Like

Hi @Leo_Sussuarana,

You may find this blog useful:

Even though it instructs on using Build Apps, this is possible in AppGyver the exact same way.

1 Like

Use a flow function by installing an http request component and create the logic.

Hello @Leo_Sussuarana
Open AI currently does not offer an API for ChatGPT. However, if you want to implement a simple text model that answers a question with a text, I could help you with that.

Yo u can do it like this:
Snap 2023-02-27 at 18.47.25
Snap 2023-02-27 at 18.47.38




I used the BLOG template. I did exactly as instructed. When clicking on the button it just keeps turning as if it were processing.

I checked everything twice more and saw that I did nothing different from what is explained.

Believing it could be an error in the API Key, I requested a new one and did new tests.

The same problem.

It keeps processing and gives no return.

I really appreciate the help…

…but it did not work!

OpenAI might have had a downtime at that time: https://status.openai.com/. It seems to be all good now, you can try again.

1 Like

Hi - I got this working fine albeit after some trial and error. See my images for more info:

Essentially I have it set-up as a POST API with a couple of headers and the post schema set-up. I then use a data entry box to change the question which is parsed to the API. The response goes into a page variable and the response message gets parsed to a message page variable.

Kind Regards

Josh





2 Likes

It works perfectly. Thanks a lot.

No Problem - I have also figured out how to get a “Stream” like response - but will post that soon (next couple of days) took me hours to figure it out!

1 Like

I think that the stream mode will works only in back end (for sample with node.js) since the response will be a “stream”. I don’t know if it’s possible to get a buffer stream in Appgyver directly… Let me know if you can. Thanks again.

It took me 2 hours to realize that I need to use gpt-3.5-turbo-0301 instead of gpt-3.5-turbo