Working with AI Generated Content Inside Gravity Forms
By the Gravity Forms community Published September 8, 2023Written by the Editorial team at Gravity Wiz…
Gravity Forms is the perfect interface layer to interact with OpenAI models. Here’s why.
- Predefine prompts using Gravity Forms fields.
- Edit generated live results in real time on your site.
- Create scalable tools for internal or external use.
- Easily send a model’s output to another form, field, WordPress Post, notification, or anywhere else.
We’ve touched on a few different ways you can use Gravity Forms OpenAI in this series: semantic analysis, content moderation, and others.
This article will explore working with live OpenAI results using the free Gravity Forms OpenAI plugin in real time, using a post excerpt generator as a use case.
Let’s dive in!
How to Set Up an Editable Post Excerpt Generator
Using Live Merge Tags, you can send the AI output you’ve generated through a prompt anywhere else in Gravity Forms. The live results can be output in field labels (dropdowns, HTML fields, Checkbox fields, etc) as field values, and in confirmations, notifications, or elsewhere.
We’re going to explore an example where we want to create an internal tool for generating AI summaries of articles that we’re going to submit. And it takes only a few minutes.
1. Create a simple form.
2. Add fields for the Post title, Post Body, and Post Excerpt.
Once you have the Gravity Forms OpenAI plugin installed, set up an OpenAI feed within your new form.
1. Feed title: Post Excerpt Generator.
2. OpenAI Endpoint: Completions.
3. OpenAI Model: text-davinci-003 (feel free to play around with others!).
4. Now, add a prompt: “Summarize the following article into one sentence: {Post Body:5}”
5. Enable Merge Tag.
6. Map Merge Tag Result to Field. In this case: Post Excerpt.
7. Place Live Merge Tag it in the Default Value (Advanced Tab) of the Post Excerpt field.
Now, we can test what we’ve created. Input your text, and edit as desired.
Now you’re ready to submit!
We’ve barely scratched the surface here. The same concept can be applied in dozens of ways.
For example — add another field to generate a list of article title ideas simultaneously with your post excerpt. Revise as desired, and map the output of that field to the Post Title.
What else?
- Get suggestions: prompt for feedback on tone, readability, word usage, rewrites.
- Generate a list of social media post write-ups or ideas simultaneously with the article submission.
- Generate ideas and outlines for potential follow-up articles based on the Post Body.
Taking it Further: Submit a Draft for Review
Depending on your workflow, you may want to publish a post as soon as you’ve reviewed the excerpt, or submit the drafted post for review — for example, to another editor involved in the approval process. When the post is submitted, you can notify this editor and other stakeholders, giving them a final set of eyes prior to hitting publish.
To do this:
1. Select the Post Title field.
2. Select Field Settings.
3. Configure the Post Status on form submission as desired.
With the Post Status set up, head over to your form’s Settings > Notifications > Add New.
1. Create a name for the notification.
2. Event: Form is submitted.
3. Send to Email: whoever you want to notify.
4. Subject: “Ready for Review: {Post Title:4}”
5. Set a message: “The following post by {user:display_name} is ready for review. {all_fields}”
You’re good to go! We have a detailed guide if you want to learn more about creating user-submitted posts with Gravity Forms.
Note: if you have multiple stakeholders or editors you may want to submit a Post to depending on the contents of that post, you can create a field within the form that allows you to specify that person, and configure notifications to the person based on who is selected.
Get started with Gravity Forms OpenAI
We’ve seen Gravity Forms users venture into fun, exploratory territory with Gravity Forms OpenAI. For example, AutoClassmate.io is using the plugin to generate dynamic teaching lessons and activities for students, and Storybooker.AI uses it to help write stories and build on ideas (using very few prompts!).
We’re excited to see what you come up with and we encourage you to share! Feel free to download and play with Gravity Forms OpenAI. It supports GPT 4, integrates with Gravity Flow, and it’s completely free.