Table of Contents
Overview

Generative AI has captured the imagination of everyone. The accuracy and quality of responses have drastically improved with each new model release by OpenAI. It is widely used in multiple industries like health, fitness, education, media, finance, marketing, and more.
With the emergence of ChatGPT, the masses have become aware of the generative AI potential. If you looking for ways to integrate OpenAI with Gravity Forms then this article will guide you through the whole process.
Gravity Forms Integration with OpenAI

AI for Gravity Forms is your ultimate solution with a set of features like generating AI Images, improving Gravity Forms Field Labels with AI, and generating AI text responses from form submissions. With this addon, you can output AI responses at the confirmation page or include them in email notifications.
Consider if you have an education-related website and your website users use it to submit queries related to the subject you teach then you can configure the form to automatically generate an answer for the query. The use cases for this functionality are endless.
Setting up Gravity Forms for AI Text Generation

Gravity Forms doesn’t have the built-in integration with OpenAI so, we will use the following addons to connect it. These add-ons are specially created for Gravity Forms so, they are easy to use and take full advantage of Gravity Forms functionalities like merge tags, confirmation messages, and email notifications.
Gravity Booster is a free add-on for Gravity Forms and is used by more than 40000 sites. It has a built-in form styler along with support for material design, bootstrap design, form field input label icons, and AI for Gravity Forms add-ons.
Enabling AI Text Generation in Gravity Forms

- Once you have installed and activated AI for Gravity Forms then navigate to the Gravity Booster interface by clicking on Forms -> Booster.
- Now click on the Settings icon at the bottom-left corner and add your OpenAI API key. If you haven’t created your key yet then check the OpenAI API key generation steps.
- Now go to the AI panel and then the Text Generation Section.
- Here you can enable the feed for text generation, give it a name, select the AI model ( GPT-4o, GPT-4 turbo, GPT-4, and GPT 3.5 Turbo), and add context, prompt, max tokens, and temperature. We have a detailed explanation of all these AI text-generation settings.
- Now map the results to a form field ( ideally a textarea field ) and then save your changes.
Use Gravity Forms Merge Tags in Text Generation Context and Prompt
Gravity Forms merge tags are essential for generating different kinds of AI text responses on form submissions. If you are familiar with Gravity Forms merge tags then you already know that they get replaced by actual data submitted by the user.
To better illustrate the use of merge tags inside context and prompt let’s take an example. Consider you have a website that teaches multiple subjects like Maths, Science, and English. The students use this form to submit their queries regarding any of these subjects. So, your form will contain the following fields
- Name of the Student: This is a single-line text input field.
- Subject: This is radio input with three choices ( Maths, Science, and English)
- Question: This is a textarea field where students can input their questions.
So, in the Context field you can enter the following:

You are an experienced high school {subject} teacher.
In the above context replace {subject} with the actual merge tag of the subject field.
In the Prompt field, you can enter the following.

Answer the following query so, that it can be easily understood by a high school student. The query is: {question}
In the above prompt replace {question} with the actual merge tag of the question field.
Show AI Text Response in Form Confirmation and Notification
After you have saved your AI Text generation settings in the backend then the AI text generation will happen every time the form is submitted in the frontend. If you have mapped the results to the field then you can include it in your confirmation message or notification.
We recommend that you add a hidden field in your form and then map the AI text generation results to it. This way the field won’t show in the form to the users in frontend.
Frequently Asked Questions?
Can I Execute Multiple Prompts on a Single Form Submission?
Yes, you can execute multiple prompts with different contexts on a single form submission. For this you will need to create multiple AI text generation feeds for the same form.
How can I ensure the AI-generated response is accurate and appropriate?
AI can make mistakes sometimes. However, you can vastly reduce the mistakes by giving a detailed prompt. You should continue to monitor the responses and update the prompt so, that those mistakes don’t happen again.
What is the Recommended AI Model for Text Generation?
We highly recommend that you use the latest available model as it is always more accurate and faster compared to its predecessor. Right now GPT-4o is the most recent model.
What is the Cost of Each Text Generation Submission?
You can check the pricing of the model you are using by clicking here.

0 Comments