oo

Generating Text Content Using AI

Liferay DXP 2023.Q4+/Portal 7.4 GA98+

Web content provides integration with OpenAI’s ChatGPT engine using the AI Creator tool. With an OpenAI API key configured for your instance or site, you can use the AI Creator feature in the Web Content editor. Once configured, you can begin generating content to work with, in a few clicks.

Enabling AI Creator

To begin, you must add an API key to authenticate your access to ChatGPT. You can add it to a Liferay instance through Instance Settings or add it to a specific site.

Adding an API Key to a Liferay Instance

  1. Open the Global Menu (Global Menu) and navigate to the Control Panel tab → Instance Settings (under Configuration).

  2. Click AI Creator under Content and Data.

  3. Paste your OpenAI API key into the API Key field.

  4. Click Save.

Adding an API Key to a Specific Site

By adding an API key in the scope of a specific site, you can use different keys for each site or disable a key in a specific site.

  1. Open the Product Menu (Product Menu icon) and select ConfigurationSite Settings.

  2. Click AI Creator under Content and Data.

  3. Paste your OpenAI API key into the API Key field.

  4. Click Save.

Note

You can enable or disable the AI Creator button by toggling the Enable OpenAI to Create Content checkbox. If you choose to disable the feature, the button does not appear in the Web Content editor.

Using AI Creator

After enabling the feature flag and configuring the API Key, AI Creator becomes available in the web content editor. To begin generating content, follow these steps:

  1. Open the Global Menu(Global Menu icon) and select your site on the right.

  2. Open the Product Menu (Product Menu Icon) and select the Web Content app under Content & Data.

  3. Click Add (Add icon) to create a Basic Web Content article.

  4. Click AI Creator.

    After enabling the feature flag, you can see the AI Creator button in the Web Content editor.

  5. In the AI Creator modal window, fill in these three fields:

    • Description: The desired content (e.g. “A blog post about the sleeping habits of cats”).
    • Tone: The tone for your text. There are five options available: Neutral, Casual, Friendly, Formal, and Academic.
    • Word Count: An approximate word count for your text.
  6. Click Create.

  7. (Optional) If you don’t like the AI-generated content, you can click Try Again to regenerate the content.

    You can choose the content, the tone, and the approximate number of words in your content. You can also ask the AI Creator to regenerate the content if you don't like it.

    Important

    Each request to generate content consumes OpenAI API tokens. When your limit is reached, a generic error message will appear.

  8. Click Add to insert the content into your web content article.

You can now begin working with your generated content.