Skip to main content
Version: 2024.1

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.

Open AI InteractionOpen AI InteractionOpen AI Interaction

Example prompts:

  • Translate to Klingon
  • Shorten the text to less than 70 words
  • Add a short text about Naboo
info

For the action to work, you need to select exactly one element. Selection of none or more than one element is currently not supported and will result in an error. This also means you can´t use the selection context with this action (e.g. Data Object Car Selection)

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

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 used
  • target_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.
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
icon: null