OpenAIPRO

This knowledge base article relates to the WS Form OpenAI add-on. This add-on is free to download.

The WS Form OpenAI add-on provides two key features:

  1. The ability dynamically create WordPress forms simply by entering a prompt describing the form you need.
  2. Integration with the core OpenAI endpoints into your WordPress forms for generating text and image content.

What is OpenAI?

Let’s ask OpenAI what it is…

Human: What is OpenAI?

AI: OpenAI is a nonprofit artificial intelligence research organization. It works on developing friendly AI systems to enhance human well-being, as well as create responsible, equitable AI solutions. OpenAI strives to operate transparently and collaboratively with the global AI research community. OpenAI’s main research areas are robotics, reinforcement learning, natural language processing, computer vision, and generative modeling.

Example Use Cases

Example use cases include:

  • Create a form by providing a description.
  • Produce text and image content when creating a post using the post management add-on.
  • Provide the ability to improve copy in a text area field using instructions (e.g. Fix my grammar!).
  • Create an avatar image when using the user management add-on.
  • Question and answer capability on a support page.
  • Moderate form submissions for inappropriate content.
  • Create text from an audio file containing speech.
  • Create spoken audio files from text.

Installation

The OpenAI plugin is free to purchase. Click here to download the add-on.

The OpenAI plugin is installed in the same way as installing the WS Form PRO plugin.

Once installed you will need to activate the license for the plugin. When you purchase the OpenAI plugin, you will be given a license key. If you have lost your license key(s), click here.

To activate your license key:

  1. Click WS Form in the WordPress administration menu.
  2. Click Settings.
  3. Click the OpenAI tab at the top of the page.
  4. Enter your license key.
  5. Click the Activate button.

If your license key fails to activate, please ensure you are using the correct license key and not your WS Form PRO license key.

Create an OpenAI Account

  1. Visit the OpenAI homepage and click on Sign Up in the top right corner.
  2. Fill out the form with your information accept the terms and conditions and click Submit.
  3. Verify your email address by clicking on the link sent to your inbox.
  4. Log in to your new OpenAI account using the credentials you set up during the sign up process.
  5. Create an API key on the OpenAI API Keys page.

You are now ready to connect WS Form to OpenAI.

Connect WS Form to OpenAI

Connecting WS Form to OpenAI is easy!

  1. Click WS Form in the WordPress administration menu.
  2. Click Settings.
  3. Click the OpenAI tab at the top of the page.
  4. Enter your OpenAI API key. You can find this on the OpenAI API Keys page.
  5. Optionally enter your OpenAI organization ID.

There might be a short delay between setting your account up with OpenAI and your API key being ready for use.

Templates

The following templates are included with the OpenAI add-on. To access these templates, click on Add New in the WS Form admin and then click the OpenAI tab.

The AI Generated Form template allows you to create a WordPress form simply by describing the type of form you want.

To create an AI generated form:

  1. Click WS Form in the WordPress administration menu.
  2. Click Add New.
  3. Click the OpenAI tab at the top of the page.
  4. Choose the AI Generated Form template.
  5. Enter a prompt that describes the form your require.
  6. Click Create to create the form.

An example prompt is as follows:

Create a support request form. Add instructions to the top of it and require the user to upload a screenshot. First name, last name, email and license key are required as well as a description of the issue. Include help text on each field to improve accessibility.

An example of the form generated by this prompt is shown below:

The following WS Form fields are currently supported when using this template:

  • Text
  • Text Area
  • Email
  • Phone
  • URL
  • Number
  • File Upload
  • Rating
  • Select
  • Checkbox
  • Radio
  • Number

Help text and placeholders can also be generated for each field. You can request these features in the description you provide to WS Form.

Once a form is created you can edit as you would any other form using the layout editor.

The OpenAI Audio Transcription endpoint is an AI-powered tool that allows you to convert speech in an audio file uploaded using a file upload field to text that is inserted into a text based field on your form.

The OpenAI Audio Speech endpoint is an AI-powered tool that allows you to convert text in a field on your form to an audio file that is inserted into a file upload field.

The OpenAI Chat endpoint is an AI-powered search engine that uses natural language processing to help you find the answers you need. It can return a list of possible answers, including relevant webpages, articles, and other sources of information, so you can find what you’re looking for quickly and easily.

Note: The demo above is capped to a predetermined number of requests per day and maximum number of tokens per request. If the demo does not return an expected result, please try again later.

The OpenAI Chat Playground is an interactive tool that helps you explore and create AI-powered conversations. It allows you to customize chatbot responses, experiment with natural language processing models, and fine-tune your conversational skills.

Note: The demo above is capped to a predetermined number of requests per day and maximum number of tokens per request. If the demo does not return an expected result, please try again later.

The OpenAI image endpoint is an AI-powered tool that helps you extract, analyze and generate images. It can be used to create automated image classifiers, identify objects in photos, and create digital artwork.

Note: The demo above is capped to a predetermined number of requests per day and maximum number of tokens per request. If the demo does not return an expected result, please try again later.

The OpenAI image endpoint is an AI-powered tool that helps you extract, analyze and generate images. It can be used to create automated image classifiers, identify objects in photos, and create digital artwork.

Note: The demo above is capped to a predetermined number of requests per day and maximum number of tokens per request. If the demo does not return an expected result, please try again later.

The OpenAI moderation endpoint is a tool for automatically detecting, analyzing, and moderating potentially offensive content. It can help you protect user-generated content on your website.When a form is submitted in WS Form the moderation action can be used to mark a submission as spam if obscene language, hate speech, and other inappropriate content is detected.

Creating a Form Integrated With OpenAI

Automatically

WS Form can create a form for an OpenAI endpoint in a single click. This process not only creates a form but also fully configures WS Form so that the form is ready to use immediately.

To create a OpenAI form in WS Form:

  1. Click WS Form in the WordPress administration menu.
  2. Click Add New.WS Form PRO - OpenAI Integration - Add New Template
  3. Select the OpenAI tab at the top of the page.
  4. Click on an OpenAI template to create a form.
  5. Wait a few moments while the form is created.

That’s it! Your form will be created and is ready to add to your website.

Manually

It is also possible to use any form created in WS Form and add an action so that you can make OpenAI requests.

Add an OpenAI Action

  1. When editing your form, click the Actions  icon at the top of the page. The Actions sidebar will open on the right-hand side of the page.
  2. Click the Add  icon to add a new action.
  3. Select Make OpenAI Request from the Action pulldown.
  4. Click Save & Close.

You will noticed that the When Should This Action Run? setting has neither checkbox checked. This is because we recommend using conditional logic to run the OpenAI action when a custom button is clicked. This ensures the OpenAI requests run without submitting the form and keep the user on the form while they interact with it.

Add Conditional Logic to Run the OpenAI Action

  1. Add a custom button to your form.
  2. Click the Conditional Logic  icon at the top of the layout editor.
  3. Create an IF condition that checks if the custom button has been clicked.
  4. Create a THEN statement and choose the Make OpenAI Request action, then choose Run Immediately.
  5. Click Save & Close.

The Make OpenAI Request action will now run when the custom button is clicked.

The OpenAI action settings depend on the endpoint selected.

Audio – Transcription

The OpenAI Audio endpoint is an advanced API designed for generating and manipulating audio content through AI algorithms.

The audio transcription action settings are as follows:

OpenAI Model

Choose the OpenAI model you want to use for this action.

An OpenAI Model is a pre-trained machine learning model that can be used for a variety of tasks such as natural language processing, image recognition, and more. OpenAI models can be used to build applications that are intelligent and able to learn from their data.

Learn more about OpenAI models.

Language

Choose the language of the speech in the audio file uploaded to the File Field.

File Field

Choose a file field on your form to use as the input.

Prompt Type

There are two ways of obtaining input for OpenAI:

  • Field
  • Mask
Prompt Field

If you choose the Field type, you simply choose a field on your form to use for the OpenAI input. You can choose any text based field such as a Text or Text Area field.

Mask

If you choose the Mask method you can create an input mask for OpenAI and use WS Form variables to dynamically insert field variables. See Input Mask below.

Prompt Field

Choose the field to use for the input (prompt). This will typically be a text area field on your form.

Prompt Mask

Use the input mask to create a custom prompt for OpenAI and use WS Form variables to dynamically insert field variables. This is particularly useful if you are developing prompt engineering for OpenAI.
To learn more:

Response Format

Choose the response format of the converted speech.

Output Field

Choose the field to use for the output (speech to text). This will typically be a text area field on your form. The output field can also be configured as the same field as your input field. An example of this can be found in the Completion – Chat template where input and output are both contained within the same text area field.

Temperature

Choose the temperature setting for the OpenAI request.

The OpenAI Temperature setting is used to adjust how much of a random element is introduced into the output generated by the OpenAI model. A lower completion temperature indicates that the model should be more conservative in its output, while a higher temperature indicates that the model should be more creative with its output.

API Request Timeout (Seconds)

The maximum permissible time in seconds that the API request will run for. Longer timeouts may be required for longer or more complex OpenAI requests.

Audio – Speech

The OpenAI Audio endpoint is an advanced API designed for generating and manipulating audio content through AI algorithms.

The Audio – Speech endpoint is used to convert text into an audio file containing speech.

The audio speech action settings are as follows:

OpenAI Model

Choose the OpenAI model you want to use for this action.

An OpenAI Model is a pre-trained machine learning model that can be used for a variety of tasks such as natural language processing, image recognition, and more. OpenAI models can be used to build applications that are intelligent and able to learn from their data.

Learn more about OpenAI models.

Voice

Choose the style of voice to use in the audio file. Learn more

Speed

Choose the speed of the voice to use in the audio file.

Prompt Type

at
There are two ways of obtaining input for OpenAI:

  • Field
  • Mask
Prompt Field

If you choose the Field type, you simply choose a field on your form to use for the OpenAI input. You can choose any text based field such as a Text or Text Area field.

Mask

If you choose the Mask method you can create an input mask for OpenAI and use WS Form variables to dynamically insert field variables. See Input Mask below.

Prompt Field

Choose the field to use for the input (prompt). This will typically be a text area field on your form.

Prompt Mask

Use the input mask to create a custom prompt for OpenAI and use WS Form variables to dynamically insert field variables. This is particularly useful if you are developing prompt engineering for OpenAI.
To learn more:

Response Format

Choose the response format of the generated speech.

Output Field

Choose the field to use for the output (speech to text). This will typically be a text area field on your form. The output field can also be configured as the same field as your input field. An example of this can be found in the Completion – Chat template where input and output are both contained within the same text area field.

API Request Timeout (Seconds)

The maximum permissible time in seconds that the API request will run for. Longer timeouts may be required for longer or more complex OpenAI requests.

Chat – Completion

The OpenAI Chat endpoint creates a completion for a chat input.

The completion action settings are as follows:

OpenAI Model

Choose the OpenAI model you want to use for this action.

An OpenAI Model is a pre-trained machine learning model that can be used for a variety of tasks such as natural language processing, image recognition, and more. OpenAI models can be used to build applications that are intelligent and able to learn from their data.

Learn more about OpenAI models.

Prompt Type

There are two ways of obtaining input for OpenAI:

  • Field
  • Mask
Prompt Field

If you choose the Field type, you simply choose a field on your form to use for the OpenAI input. You can choose any text based field such as a Text or Text Area field.

Mask

If you choose the Mask method you can create an input mask for OpenAI and use WS Form variables to dynamically insert field variables. See Input Mask below.

Input Field

Choose the field to use for the input (prompt). This will typically be a text area field on your form.

Input Mask

Use the input mask to create a custom prompt for OpenAI and use WS Form variables to dynamically insert field variables. This is particularly useful if you are developing prompt engineering for OpenAI.

The following is a conversation between an Agent and a Customer. The agent will attempt to diagnose the problem and suggest a solution, whilst refraining from asking any questions related to PII. Instead of asking for PII, such as username or password, refer the user to the help article wsform.com/knowledgebase

Customer: #field(123)
Agent:

In the above example mask, the pre-amble provides OpenAI with context about the prompt. We then insert the customers question from field ID 123 into that prompt.

To learn more:

Output Field

Choose the field to use for the output (completion). This will typically be a text area field on your form. The output field can also be configured as the same field as your input field. An example of this can be found in the Completion – Chat template where input and output are both contained within the same text area field.

Trim Output

If checked, the completion will be trimmed.

Apply WPAutoP to Output

wpautop is a WordPress function that automatically adds paragraph and line break tags to the text content of a post or page, to properly format the text and make it easy to read on the website.

If checked, WS Form will apply wpautop to the output from OpenAI so that it can be used in fields such as HTML and Text Editor field types.

Use Output Mask

If checked, an Output Mask field will appear allowing you to finely control the output that is injected into the Output Field. You can use WS Form variables in the mask. Use #output to inject the OpenAI output anywhere in the mask.

Append Output

If checked, the OpenAI output will be appended to the existing content in the output field.

Max Tokens

Choose the maximum number of tokens you want to allow each time the action runs. This defaults to 150.

The GPT family of models process text using tokens, which are common sequences of characters found in text. The models understand the statistical relationships between these tokens, and excel at producing the next token in a sequence of tokens.

Learn more about OpenAI tokens.

Inject Start Text

This setting injects text to the beginning of the output prior to it being added to the output field. This setting is included in case you want to simulate output similar to that provided by the API playground.

Inject Restart Text

This setting injects text at the end of the output prior to it being added to the output field.This setting is included in case you want to simulate output similar to that provided by the API playground.

Stop Sequences

OpenAI Stop Sequences are used to determine when OpenAI models should stop generating responses. The stop sequence is a predetermined set of words or characters that, when encountered, will indicate to the model that it has reached the end of its output and should not generate any more data. Up to 4 stop sequences can be configured.

Temperature

Choose the temperature setting for the OpenAI request.

The OpenAI Temperature setting is used to adjust how much of a random element is introduced into the output generated by the OpenAI model. A lower completion temperature indicates that the model should be more conservative in its output, while a higher temperature indicates that the model should be more creative with its output.

Top P

Choose the top p setting for the OpenAI request.

The OpenAI Completion Top P setting is used to adjust the probability of which tokens will be included in the generated output. A higher top p value indicates that the model should prioritize tokens with a higher probability, while a lower top p value indicates that the model should consider tokens with lower probabilities.

Frequency Penalty

Choose the frequency penalty setting for the OpenAI request.

The OpenAI Frequency Penalty setting is used to adjust how much frequency of tokens in the source material will influence the output of the model. A higher frequency penalty indicates that the model should favor tokens with a higher frequency, while a lower frequency penalty indicates that the model should prioritize tokens with a lower frequency.

Presence Penalty

Choose the presence penalty setting for the OpenAI request.

The OpenAI Presence Penalty setting is used to adjust how much presence of tokens in the source material will influence the output of the model. A higher presence penalty indicates that the model should favor tokens with a higher presence, while a lower presence penalty indicates that the model should prioritize tokens with a lower presence.

User

An optional unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse, e.g. #user_id.

API Request Timeout (Seconds)

The maximum permissible time in seconds that the API request will run for. Longer timeouts may be required for longer or more complex OpenAI requests.

Moderation

The OpenAI moderation endpoint is a tool for automatically detecting, analyzing, and moderating potentially offensive content. It can help you protect user-generated content on your website.When a form is submitted in WS Form the moderation action can be used to mark a submission as spam if obscene language, hate speech, and other inappropriate content is detected.

The moderation action settings are as follows:

OpenAI Model

Choose the OpenAI model you want to use for this action.

An OpenAI Model is a pre-trained machine learning model that can be used for a variety of tasks such as natural language processing, image recognition, and more. OpenAI models can be used to build applications that are intelligent and able to learn from their data.

Learn more about OpenAI models.

Input Field

Choose the field to use for the input (prompt). This will typically be a text area field on your form.

API Request Timeout (Seconds)

The maximum permissible time in seconds that the API request will run for. For longer or more complex OpenAI requests, you may need to set longer timeouts.

Image

The OpenAI image endpoint is an AI-powered tool that helps you extract, analyze and generate images.

The image action settings are as follows:

Input Field

Choose the field to use for the input (prompt). This will typically be a text area field on your form.

Output Field

Choose the field to use for the output (completion). There are two options for handling the output:

  1. Use a file field configured as a DropzoneJS type to load the resulting images into.
  2. Use a text or URL field to store the resulting URL from OpenAI.

Number

Choose the number of images to create (max 10).

User

x
An optional unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse, e.g. #user_id.

API Request Timeout (Seconds)

The maximum permissible time in seconds that the API request will run for. For longer or more complex OpenAI requests, you may need to set longer timeouts.

Variables

The OpenAI add-on introduces a variables for use in actions:

Name / VariableAdditional Information
Input
#openai_input
Returns the input for OpenAI.
Output
#openai_mode
Returns the OpenAI mode.
Output
#openai_output
Returns the output from OpenAI.
Output
#openai_completion_tokens
Returns the completion token count from OpenAI.
Output
#openai_total_tokens
Returns the total token count from OpenAI.
Prompt Tokens
#openai_prompt_tokens
Returns the prompt token count from OpenAI.