Overview
Gravity Forms OpenAI is a free plugin that integrates Gravity Forms with OpenAI – the leading provider of cutting-edge AI language models.
This plugin allows you to send prompts constructed from your form data to OpenAI and capture its responses alongside the submission. You can also utilize the power of AI to edit submitted data for grammar, spelling, word substitutions, and even full rewrites for readability or tone. Lastly, GF OpenAI allows you to moderate submissions and flag, block, or spam undesirable content.
Getting Started
Install plugin
Get an OpenAI API key
Assuming you’re already using Gravity Forms, there’s only one thing you’ll need to get started with GF OpenAI: an OpenAI API key!
We’ll let ChatGPT (powered by OpenAI) explain how to get your own. 😉
Here’s a shortcut if you already have an OpenAI account.
Once you have your API key, copy it and paste it into the GF OpenAI plugin settings by navigating to Forms › Settings › OpenAI.
Workshop Crash Course
Before we dig into the instructions for using this plugin, you may find our crash course workshop to be a useful starting point. Take a look as we explore some popular use cases, fine-tune models, explore how a marketing agency can use OpenAI with Gravity Forms, and answer questions from the audience!
Don't miss a thing. Get our weekly updates by owl or email. Ok, we're still working on the owl service, so just email for now.
Using the Plugin
Our plugin works with Gravity Forms in a few different ways to make it easy to use OpenAI’s powerful AI capabilities with your forms.
Chat Completions
Chat Completions is OpenAI’s newest endpoint, while also the cheapest and fastest by far. It’s also the most robust model, able to handle and respond accurately with to largest variety of prompt types. In fact, it’s the same model that powers ChatGPT.
Some great use cases for Chat Completions include: debugging code, generating documentation, and answering user questions!
Chat Completion Options
OpenAI Model – Chat completions uses the gpt-3.5-turbo
model. gpt-4
is also supported, but gpt-3.5-turbo
is the fastest and most cost-effective option from OpenAI.
Prompt – Any combination of form data (represented as merge tags) and static text that will be sent to the selected OpenAI model and to which the model will respond.
Merge Tag – Enable merge tags to output the result of an OpenAI feed in form confirmations, notifications, or even live in your form fields (via Populate Anything’s Live Merge Tags).
Map Results to Field – All OpenAI responses will be captured as an entry note. Use this setting to optionally map the response to a form field.
Completions
Completions provide an easy way to interact with OpenAI’s versatile language models. Send any combination of form data as a prompt and whatever model you’ve selected will generate a text completion with its best attempt to match the intent of your prompt.
For example, if you give the API the prompt, “Write a slogan for Gravity Forms”, it will return a completion like “Effortlessly capture and manage your data with Gravity Forms.”
Completion Options
OpenAI Model – Select the model that is the best fit for your needs. OpenAI offers a variety of models, each with its own strengths and capabilities. This plugin supports gpt-3.5-turbo
and gpt-4
, among others. The key differentiators between each model will be speed, quality, and cost.
Prompt – Any combination of form data (represented as merge tags) and static text that will be sent to the selected OpenAI model and to which the model will respond.
Merge Tag – Enable merge tags to output the result of an OpenAI feed in form confirmations, notifications, or even live in your form fields (via Populate Anything’s Live Merge Tags).
Map Results to Field – All OpenAI responses will be captured as an entry note. Use this setting to optionally map the response to a form field.
Edits
Edits makes it easy to generate and capture suggestions for texts edits to submitted form data. Provide a prompt and an instruction for how that prompt should be edited and OpenAI will return an edited version of the prompt.
This can be useful for a variety of purposes, such as improving the grammar and clarity of user-generated content, or providing automated copyediting services.
OpenAI Model – Select the model that is the best fit for your needs. OpenAI offers two models here – one focused on editing text and the other on code.
Input – Any combination of form data (represented as merge tags) and static text that will be sent to the selected OpenAI model and to which the model will apply the Instruction.
Instruction – Explain to the model how you would like the input edited. Example: “Fix spelling mistakes and format as a sentence.”
Merge Tag – Enable merge tags to output the result of an OpenAI feed in form confirmations, notifications, or even live in your form fields (via Populate Anything’s Live Merge Tags).
Map Results to Field – All OpenAI responses will be captured as an entry note. Use this setting to optionally map the response to a form field.
Moderations
Moderations allow you to check if submitted data complies with OpenAI’s content policy. This will flag inappropriate or harmful content and our plugin will let you decide what to do with that submission. You can block the submission, returning a validation error, mark the entry as spam, or record OpenAI’s response but do nothing.
OpenAI Model – Select the model that is the best fit for your needs. If you want the latest AI technology, use test-moderation-latest
. Otherwise, stick with text-moderation-stable
.
Input – Any combination of form data (represented as merge tags) and static text that will be sent to the selected OpenAI model for evaluation.
Behavior – Decide what to do if the submitted input fails validation. You can:
- Prevent submission by showing validation error
The submission will be blocked and a validation error will be displayed. Due to the nature of how data is sent to OpenAI, specific fields cannot be highlighted as having failed validation. - Mark entry as spam
The submission will be allowed by the entry will be marked as spam. Gravity Forms does not process notifications or feeds for spammed entries. - Do nothing
The submission will be allowed and the failed validation will be logged as a note on the entry.
Live Results with Live Merge Tags
If you’d like to show live results from OpenAI directly in your form, Populate Anything’s Live Merge Tags (LMTs) makes this possible. LMTs provide the ability to automatically replace a merge tag with live content as soon as its associated field is updated. LMTs work anywhere inside your form (field values, labels, HTML content) and can be used to process GF OpenAI feeds.
You can get the “live” version of your GF OpenAI feed merge tag by enabling the Enable Merge Tag setting on your GF OpenAI feed and copying the desired merge tag.
@{:1:openai_feed_2}
→ Will process the specified feed anytime the value in field ID 1 is changed. Update the “1” to any field that you would like to trigger the Live Merge Tag.
@{all_fields:openai_feed_2}
→ This LMT will be processed when any field value changes. This is useful if your prompt contains more than one field value.
Trigger Live Results by Button Click
When you use Live Merge Tags with an OpenAI feed, by default, the feed processes as soon as the merge tag value changes. This may not be ideal if the user is still entering data.
Thankfully, there’s a snippet that solves this problem. This snippet changes the default behavior to only trigger the feed when a button is clicked instead of when the input field is changed.
Merge Tag Modifiers
Include Line Breaks in Text
If you’re looking to include line breaks when using an OpenAI merge tag with an HTML field, you can include the :nl2br
modifier in your merge tag code. Here’s an example of what the output looks like with and without the modifier:
Without the modifier, all results are on one line:
@{:1:openai_feed_2}
1. Mars 2. Venus 3. Pluto
With the modifier added, each result gets separated on its own line:
@{:1:openai_feed_2,nl2br}
1. Mars
2. Venus
3. Pluto
Integrations
Populate Anything
With the power of Live Merge Tags, you can process OpenAI feeds as your users type and display the response live in an HTML field or capture it in any text-based field type (i.e. Single Line Text, Paragraph, etc).
Gravity Flow
GF OpenAI is fully integrated with Gravity Flow. While you’re building your workflow, choose Open AI as the step type and select the OpenAI feed you’d like to use:
Here’s a quick example of what a workflow in Gravity Flow could look like:
- A user submits a form designed to create an outline for their article.
- GF OpenAI handles the outline.
- A Gravity Flow approval step requires an editor to approve the outline.
- After approval, a rough article draft is generated based on that outline via GF OpenAI.
- A Notification step brings users back to review the generated article, make edits, and submit a final version.
- Post Creation generates an article and publishes it.
FAQs
How much does this cost?
Gravity Forms OpenAI (this plugin) is free! OpenAI (the service this plugin integrates with) also gives you $18 in free credit when you signup. After that, OpenAI is still remarkably inexpensive. As of Dec 15th, 2022, you’ll pay about $0.02 per 1000 tokens (~750 words) generated by OpenAI. Full pricing details here.
I need some inspiration… what can I do with OpenAI?
OpenAI has an amazing list of examples here. If that doesn’t whet your whistle, try asking ChatGPT itself. You’ll be surprised with how clever it can be. 😉
I want to contribute to this plugin!
If you’re looking to contribute to the codebase, PRs are welcome! Come work with us on Github. If you want to contribute financially, pick up a Gravity Perks license. It’s a win-win. 😄
Did this resource help you do something awesome with Gravity Forms?
Then you'll absolutely love Gravity Perks; a suite of 47+ essential add-ons for Gravity Forms with support you can count on.
I was curious if there was any documentation on this to account for the email I received from OpenAI — I saw that the latest version of the plugin should have v4 available, and it says I need that active on my account; but I can’t see how to do that:
Earlier this year, we announced that on January 4th, 2024, we will shut down our older completions and embeddings models, including the following models (see the bottom of this email for the full list): text-davinci-003 text-davinci-002 ada babbage curie davinci text-ada-001 text-babbage-001 text-curie-001 text-davinci-001 You are receiving this email because in the last 30 days…
According to OpenAI’s docs, GPT-4 API access is available to any user who has made a successful payment of $1 or more.
Assuming you qualify there, GPT-4 should be selectable as a language model when setting up a feed. You’ll first need to select Chat Completions as your OpenAI Endpoint.
Hi,
I can’t seem to generate responses using live merge tags if I use the GPT 4 32k Chat Completion option. Only seems to work if I use GPT 4 (not the 32 k version). Any ideas why this would be?
Is there any ETA on when GPT 4 Turbo will be available as an option?
Hi James, we’ve followed up via email. We’ve already passed this on to our development team. About GPT 4 Turbo we don’t have an ETA yet.
Best,
Will there be any support for GPT4 Vision? It will integrate perfectly with the File Upload Pro plugin
No definite plans but it is enticing! Agreed that this would be a nice complement to File Upload Pro. 🙏
Hey guys,
I have a question: is it possible to give output from OpenAi back to user after payment has been processed?
Example: users fills in several fields, selects a few options and pays money. We give them an OpenAi generated answer back.
Hi,
You could insert the openai merge tag on the confirmation page to display the openai response after submission. Since the confirmation page will be displayed after payment is completed, the openai content will show after payment is made.
Best,
Hello, thank you for the great plugin you’ve created. I wanted to know if you have a program for this plugin to connect to DALL·E as well? Do you have any updates for it?
Hi, not at this time, but I’ll pass it on as a feature request to our product manager.
I don’t see the option to use GPT-4. It only shows me these options:
text-davinci-003 text-curie-001 text-babbage-001 text-ada-001 code-davinci-002 code-cushman-001
What am I missing?
Hi Luke,
If it’s been a while since you installed the plugin, download the Gravity Forms Open AI plugin again to get the latest version. On the feed’s page, you should see the Chat Completions Endpoint, select that to show the GPT-4 model.
Best,
Just wanted to say thank you for the wonderful plugin. It has helped me to get a lot of things done :)
Hi KA,
You’re welcome. Glad to know the plugin has been useful to you.
Best,
When I put many options for analysis in the prompt, the data transfer speed decreases and it takes a long time to display the results to me. When I only put one option from the form in the prompt, it determines the result in less than 30 seconds, but when the options increase, it takes more than 2 minutes. I would appreciate it if you could suggest how to solve this problem.
Hi Eli,
API requests to OpenAI can be quite slow, and the speed is dependent on the amount of data that is fed into the request. There’s a lot of processing that is happening behind the scenes. You can use this snippet to make the feed asynchronous. This should allow the form to submit faster and process the Open AI feed in the background.
I want to receive 10 different suggestions from ChatGPT and display each suggestion in a checkbox so that the user can select whichever they want. However, when I place the code in the options, it combines all the choices into a single selection instead of separating them. Do you have any ideas on how I can solve this issue?
Hi Aras,
I’m unsure if this is possible. If you an active Gravity Perks license, submit a ticket for this via our support form, so that we can forward this as a feature request and have our developers look into this.
Best,
Thank you for the great plugin you’ve created. I have an issue with the multi-page form. When I submit the form and the result from the API is displayed on the last page, I want the user to reach that page after filling in a series of information and see the result based on the provided data. However, when the user fills in their information, such as their name or work experience, the “Next” button takes a long time to become active as it analyzes the information. Is this issue related to the plugin and is it a normal occurrence? or does it have to do with the speed of my server and the processing of information from my server’s side?
Hi Mo,
API requests to OpenAI can be quite slow given the amount of processing that is happening behind the scenes. You can use this snippet to make the feed asynchronous. This should allow the form to submit faster and process the Open AI feed in the background.
If this doesn’t work for you, we’ll need to take a look at your setup, and for that you’ll need a Gravity Perks license. Please note that while the plugin is free, support is not. We’re happy to answer questions here, but help with specific configurations requires a Gravity Perks license.
If you have one already, we’ll be happy to help if you contact us via the support form.
Best,
I want to create an extension that, when a user enters the name of a job, searches the internet and lists job advertisements related to that job. Can this be done if I connect this extension to the GPT-4 API?
Hi Mo,
This will depend on the capabilities of GPT-4. I suggest you test this on the ChatGPT platform and see if it’s possible for GPT-4 to search the internet for jobs matching a keyword. If the result is positive, you can use our GF OpenAI plugin to connect Gravity Forms to the GPT4 API and return the results on the confirmation page.
Best,
Hi Dario, as you might remember, I’m working on a project where I need to use OpenAI’s ChatGPT within a form to suggest modifications to user inputs. This process happens three times in sequence, meaning I have to call OpenAI’s ChatGPT three times and use three live merge tags to display the resulting suggestions to the user.
I’m struggling with two key challenges:
1) Figuring out the best format for the form. Would a multi-page form work best?
2) Preventing all live merge tags from updating simultaneously every time the form progresses.
Using the workaround you provide, I’ve ensured the live tag updates only when the user clicks ‘next’. However, this still triggers an update for all OpenAI-connected live merge tags all the time and seems to bog things down.
Ultimately, I aim to incorporate three or four OpenAI-connected merge tags or feeds within a single multi-page form. Is this objective feasible? I’d appreciate any advice on this.
Sorry to pepper you with this: my live merge tags are populating with some weird values as soon as the page loads.
I want them to wait out until a specific checkbox (Field ID 3) in my form (Form ID 49) is checked. I tried some JavaScript magic to make the GPPA listener take a break when the page loads and only get back to work when the checkbox is changed. But nope, those live merge tags are still doing their own thing right on page load.
Oh, and I’m using OpenAI for some feed stuff, and I’ve made it asynchronous to speed things up with form submissions.
Any ideas on how I can get this to work? Is there any secret sauce in Gravity Perks, like built-in filters or actions, that I could use to control these live merge tags? Any other tips or tricks?
Hi Marc,
Both a single-page form and a multi-page form will work just fine. However, I’m unsure if it’s currently possible to prevent all the live merge tags from updating simultaneously every time the form progresses. I’ll forward this to our product manager as a feature request, and we’ll get back to you with updates on this.
Best,
When I map the AI output to a field, it removes all the formatting that ChatGPT has created.
I’m pulling the mapped field into a GravityView layout so it can be displayed in our client’s account, but the formatting being gone is making it just look like a blob of text. I tried using the :nl2br merge tag to add breaks but it didn’t work because it is being mapped via the back end Ai settings. Any ideas on how to keep the line breaks and formatting for the mapped field?
Hi Rachel,
You’ll have to map the AI output to a Paragraph Text field with the Rich Text Editor enabled to preserve the formatting from ChatGPT.
Best,
When I integrate Live Merge Tags with an OpenAI feed in a multi-page form, the displayed information from the feed tends to update multiple times, seemingly reflecting different thought stages of ChatGPT, until the OpenAI API process completes. How can I modify the setup so that only the final output is displayed? FYI: I’ve already implemented a snippet to initiate the API call only upon clicking the ‘next’ button.
Hi Marc, we’ve already followed up by email with a snippet to process OpenAI feed async.
This plugin is causing ERROR 500 when you try to edit Limit Submissions Feeds from GFLimit Submissions plugin!! Once you deactivate OpenAI plugin it works.
Hi Maradona,
This isn’t a known issue so we’ll have to dig into this further to know exactly what’s happening. If you have an active Gravity Perks license, you can contact us via our support form so that we can ask some additional information and look into this further.
Best,
Thank you for a great plugin. I am using it with a form that uses the plugin to pass some data to the api and then save the response to a custom post type. It works great but takes a couple of minutes to complete. Is there a way to immediately send the user to the confirmation screen and run the api call in the background? Just curious.
Hi Steve,
We have a snippet that will process the OpenAI feed asynchronously.
Following up on Ali’s question about Azure, we have a use case that needs GPT for our private data, not for the general ChatGPT.
The Azure team seem to support that as per this link: https://techcommunity.microsoft.com/t5/ai-applied-ai-blog/revolutionize-your-enterprise-data-with-chatgpt-next-gen-apps-w/ba-p/3762087
It would be really great if we could be a Gravity Forms OpenAI customer and be able to link to an Azure-hosted dataset and have a similar usage based pricing model with Gravity WIZ.
Do you think this is possible in the near future? Would much rather wait than to chase off on a major one-off development project.
Thanks!
Marty
Hi Marty,
This is currently not in our plans in the near future. I will still forward this as a feature request. Hopefully, with more similar requests, this may be a priority.
Best,
Hello!
Any chance we can use Azure? Having some issues with Openai but have azure api access.
Hi Ali,
This is currently not possible. I will forward your request to our Product manager as a feature request.
Best,
thank you! I’ve also heard that because of extreme load on chat gpt, azure might offer better speeds.
Does anyone have an example of executing this from a button click? I can’t seem to get the code to work.
Hi Conor,
I’m not sure I’m tracking this question. When the submit button is clicked, the OpenAI feed processes and the results are stored in the field that has been mapped in the feed settings.
If you’re having trouble using the plugin and are a Gravity Perks subscriber, reach out to support. We’re happy to help.
Hi,
Any updates on the GPT 4 support in the plugin? Saw that you are working on it beneath my last question.
Hi Harry,
Support for GPT 4 has been added to the Open AI plugin. Download the plugin again to get the latest version. It requires your account have GPT-4 enabled.
Best,