Module of Magnolia CMS that adds the following features to create contents using Large language models like GPT from Open AI.
- Integration with OpenAI and Azure OpenAI
- Field
textFieldAI
to create and edit text contents using AI. - Prompt generator to create prompts from existing contents.
- UI field
imageAI
to create images using AI.
Text field whose content can be created from existing contents using AI.
Definition of field textFieldAI
textFieldUsingAI:
$type: textFieldAI
strategy: completion
model: gpt-3.5-turbo
words: 300
promptGenerator:
template: ai.prompt.template.hotels-app.description
properties:
title:
name: title
category:
targetWorkspace: category
targetPropertyName: displayName
rooms:
name: rooms
country:
name: country
city:
name: city
Property | Description |
---|---|
strategy |
Required
Specifies the completion strategy to create the text.
|
model |
Optional
AI model used to create text, it can be a general purpose model like |
words |
Optional
Number of words of the generated text. The value of |
promptGenerator |
Optional
Prompt template and fields of the form that will be used to build the prompt used by AI to generate the text. properties List of fields in the form whose value will appear in the prompt. In case of
template Name of the copy that contains the template of the prompt. The copy can include the following tokens:
Example of prompt template
|
This field extends Text field and it is possible to specify any property from this field.
- Add maven dependency to your bundle of Magnolia
<dependencies>
<dependency>
<groupId>org.formentor</groupId>
<artifactId>magnolia-ai-contents</artifactId>
<version>0.0.1</version>
</dependency>
</dependencies>
- Activate and configure Open AI or Azure OpenAI
- Specify the host of the API of OpenAI in the configuration of the module.
config:/magnolia-ai-contents/openAI
- Specify the
API key
of OpenAI in the secret namedopenai/api-key
of Password Manager.
- Specify
apiVersion
,deployment
,host
andresource
in configuration of the module.
config:/magnolia-ai-contents/azure
- Specify the
API key
in the secret namedazure/api-key
of Password Manager.
- Specify the models available to create texts. It can be general purpose models - see https://platform.openai.com/docs/models - or fine-tuned models.
Creates image content from a given prompt.
Definition of field imageAI
imageAI:
$type: imageAI
subApps:
detail:
label: Blog
form:
properties:
imageAI:
$type: compositeField
label: Image AI
itemProvider:
$type: jcrChildNodeProvider
nodeName: jcr:content
nodeType: mgnl:resource
properties:
image:
label: ""
$type: imageAI