Text Generation with Prompts via OpenAI
This interaction type can be executed on an object context (events) and lets you create texts for data objects and refine the result by interacting with the OpenAI ChatGPT model.
To refine the result, enter a prompt in the text field below the result and click the enter button. The result will be refined based on your prompt.
Example prompts:
Translate to Klingon
Shorten the text to less than 70 words
Add a short text about Naboo
Available Context
For more information on context limitations refer to the Available Context section.
Multiselect: No Elements: Data Objects
Configuration Options
Type to be used: 'Pimcore\Bundle\CopilotBundle\Samples\InteractionAction\OpenAiTextPrompt'
Type specific configuration options:
# Template for initial prompt automatically sent to ChatGPT when action is started.
template: |
We have an event with title {{ subject.title }} that starts at {{ subject.fromDate }} and ends at {{ subject.toDate }}.
{% if subject.description %}
Optimize following description and include all information: {{ subject.description | raw }}
{% else %}
Generate a short description for that event.
{% endif %}
# AI model to be used
model: 'gpt-4o'
# Target data object field.
target_field: 'description'
# Defines, if target field is localized.
target_field_localized: true
# Defines the system prompt
system_prompt: 'All events should include a Star Wars reference.'
Detailed Configuration Options
template
: Template for initial prompt automatically sent to ChatGPT when action is started. It is a twig template with access to the subject on which action is started, e.g. data object. Thus, data from data object can be used to generate initial prompt and deliver additional information.model
: AI model to be usedtarget_field
: Target data object field, where generated text should be assigned to.target_field_localized
: Defines, if target field is localized. If set to true, then additional language selection is shown in Pimcore Copilot when assigning result to target field.system_prompt
(optional): System prompt to be used for the AI model. This prompt is used in addition to the template prompt and acts as a general guideline for the AI model. It will be considered for alle requests sent to the model.
info
This action requires a OpenAI token, which needs to be provided as via OPEN_AI_AUTH_TOKEN
environment variable:
OPEN_AI_AUTH_TOKEN=<YOUR_API_TOKEN>
Full Configuration Example
pimcore_copilot:
interaction_actions:
actions:
event_description_generation:
context_limitations: ['object_event']
search_terms: []
type: 'Pimcore\Bundle\CopilotBundle\Samples\InteractionAction\OpenAiTextPrompt'
configuration:
template: |
We have an event with title {{ subject.title }} that starts at {{ subject.fromDate }} and ends at {{ subject.toDate }}.
{%% if subject.description %%}
Optimize following description and include all information: {{ subject.description | raw }}
{%% else %%}
Generate a short description for that event.
{%% endif %%}
model: 'gpt-4o'
target_field: 'description'
target_field_localized: true
system_prompt: 'All events should include a Star Wars reference.'
icon: null