As a developer, you can think of countless use cases for automatically generated texts in inline-editable text properties
Let's start with a "Page summary" content element that automatically fills with a summary of the current page - streamed directly into the user interface with NEOSidekick.
The NEOSidekick YAML API
You only need a few lines of additional code for this:
'Vendor.Site:Content.PageSummary':
superTypes:
'Neos.Neos:Content': true
ui:
label: page summary
icon: align-left
properties:
text:
type: string
ui:
inlineEditable: true
options:
sidekick:
onCreate: true
module: 'page_conclusion_writer'
In the property options, you can use sidekick.onCreate to define a module that should be used. Here we take page_conclusion_writer. The module is automatically sent the current content of the page. For other modules you have various configuration options, here are a few more examples.
Let's use content from the Creation dialog to automatically generate texts. To do this, we define a title and another text property that is prefilled with text based on the title.
The NEOSidekick YAML API
You can realize this with a YAML NodeType like this:
'Vendor.Site:Content.Text':
superTypes:
'Neos.Neos:Content': true
ui:
label: Magic Text
icon: align-left
properties:
title:
type: string
ui:
label: Title
showInCreationDialog: true
inlineEditable: true
text:
type: string
ui:
inlineEditable: true
options:
sidekick:
onCreate: true
module: paragraph_generation
arguments:
topic: 'SidekickClientEval: node.properties.title'
For the arguments, you can use ClientEval to always use the current title property value. You can also use SidekickClientEval, which extends ClientEval and also supports documentTitle, documentContent and an AssetUri function. The paragraph_generation has an argument topic, and here we use the title of the content element.
You are not limited to our ready-made modules. Let's create a TLDR content element with its own prompt.
The NEOSidekick YAML API
With these few lines you can implement your own prompt to create any text:
'NEOSidekick.Site:Content.TLDR':
superTypes:
'Neos.Neos:Content': true
ui:
label: TLDR
icon: list
properties:
text:
type: string
ui:
inlineEditable: true
options:
sidekick:
onCreate: true
module: free_conversation
arguments:
content: 'Generate a TDLR with 5 bulletpoint for this page, in HTML without a code block. Keep the sentences short. Make it engaging, so that visitors want to read the whole page.'
writingStyle: 'tech_advocate'
A lot happens here in just a few lines. The NEOSidekick module free_conversation is called and receives the content of the current page and its own prompt. In this prompt we describe what we want "Generate a TDLR with 5 bulletpoint for this page", in which format "in HTML without a code block" and with which writing style "Keep the sentences short. Make it engaging, so that visitors want to read the whole page."
We can also specify one of the predefined writing styles.
The NEOSidekick YAML API
And here is another example where we use a node property:
'NEOSidekick.Site:Document.BlogPost':
superTypes:
'Neos.Neos:Document': true
ui:
label: BlogPost
properties:
transcript:
type: string
ui:
label: 'YouTube Transcript'
showInCreationDialog: true
text:
type: string
ui:
inlineEditable: true
options:
sidekick:
onCreate: true
module: free_conversation
arguments:
content: >-
SidekickClientEval: `
You are the worlds best journalist. You write in an informal style aimed at engaging and educating the reader. The tone is friendly and approachable, using direct address ("I") to create a sense of dialog. The article breaks down complex topics into understandable segments, using relatable examples and personal anecdotes to clarify points. You often include rhetorical questions to provoke thought and keep the reader engaged. The structure is well-organized, with clear headings and bullet points that make the content easy to follow.
YouTube transcript:
"""
${node.properties.transcript}
"""
Please re-write the transcript as a blog post in Markdown. Skip the title, start with an introduction and then start with the headline level 2.
`
In this example, we use SidekickClientEval to access node properties. And we use JavaScript template strings to be able to write the long prompt nicely in YAML.
The NEOSidekick YAML API
Since GPT-4 is associated with considerable costs, we cannot publish the interface unprotected on the Internet. You can buy a 14-day trial version via our store or contact us via support@neosidekick.com, then we can create an API key for testing and demos.
Modules for Inspector property text generation:
Available writing styles:
You can also create generate buttons in the Neos Inspector.
Let your creativity run wild! Design and configure your own buttons, we are excited to see what use cases you find.
Is the naming consistent and clear? Do you understand the use cases? What would you like to develop with it?
Or on Slack #neos-general and mention @rolandschuetz