Is ChatGPT correct here?

It’s been a while since I posted, but I wanted to check with someone at wappler to see how accurate ChatGPT is here?

I asked it "how do I connect to the openAI using wappler.io"

The response:

To connect to the OpenAI API using Wappler, you will need to use the built-in Server Connect feature. Here’s an overview of the steps you’ll need to take:

  1. Create a new project in Wappler, or open an existing one.
  2. In the Wappler interface, go to the Server Connect panel, and create a new connection.
  3. In the connection settings, enter the endpoint URL of the OpenAI API, which is https://api.openai.com/v1/engines/davinci/completions
  4. In the Headers section, set the Content-Type to application/json and add a new header Authorization with the value Bearer YOUR_API_KEY .
  5. In the Body section, you can create your request payload. Here’s an example of a request payload for generating text:

Copy code

{
    "prompt": "What are the latest developments in electric vehicle technology?",
    "engine": "text-davinci-002",
    "temperature": 0.5,
    "max_tokens": 2048,
    "top_p": 1,
    "frequency_penalty": 0,
    "presence_penalty": 0
}
  1. You can now use the connection in your app by creating a Server Action and select the connection you just created in the Server Connect panel.
  2. You can use the response from the API in your app, for example, to display the generated text in a text area component or to use it for further processing.

It’s important to note that you’ll need to replace YOUR_API_KEY with your actual API key, and also make sure that the payload you are sending is in accordance with the API documentation, else you may run into errors.

Additionally, you may want to consider using the dotenv package to store your API key in a secure location and access it from your code without hardcoding it.

  1. After you’ve created the connection, you can create a Server Action, by clicking on the plus button in the Server Connect panel, or in the App Structure Panel.
  2. Select the connection you just created, and you can configure the action with different options like success, error, or complete events.
  3. In the success event, you can access the response from the API and use it in your app. For example, you can set the response to a variable and use it to display the generated text in a text area component or to use it for further processing.
  4. In the error event, you can handle any errors that occur during the request, you can also access the error message to display it to the user.
  5. In the complete event, you can run some logic after the request is finished, regardless of whether it was successful or not.
  6. Once you have set up the Server Action, you can trigger it by calling the action name in your event handlers, for example, on a button click.
  7. You can also use the data returned by the API to make other requests or to save the data to a database for later use.

It’s important to note that you’ll need to replace YOUR_API_KEY with your actual API key, and also make sure that the payload you are sending is in accordance with the API documentation, else you may run into errors.

Additionally, you may want to consider using the dotenv package to store your API key in a secure location and access it from your code without hardcoding it.

1 Like

I’m continually amazed at the amount of data ChatGPT already knows. I really hope it stays available for all of us to use and not limited to large corporations.

Very impressive that it uses words/terms from Wappler like server connect etc. Maybe it could be used by the team to create the rough idea for the documentation updates and then to just go over if everything is correct, would definitely save time. (In this case the word “connection” would have to be replaced by “API Action”

1 Like

It’s actually not really accurate in details. Yes, it mentions some terms of Wappler, but a lot of it is not really correct - just guessed generic terms.

1 Like

It could be used - if trained - to provide a great resource for help instead of searching for hours for the right community post with the right example.

That would be awesome and no doubt someone is already working on a new support platform.

ChatGPT 4 is said to blow 3 out of the water we are certainly on a new precipice!!

It would be great indeed. Good stuff ahead of us.

1 Like

Be prepared to have you mind blown.

The four minute mile has been broken!

With all the data in this community and generated on a daily basis by the community and Wappler team it would be an awesome helper, literally like your own Wappler personal assistant!

1 Like