AI Customization

Commitspark's content editing frontend provides a native integration with OpenAI's GPT4. This allows content editors to use the full features of GPT when working with content - be it to generate new or modify existing content.

In order to better guide GPT in generating output, Commitspark's content model (schema) can be extended via a GraphQL directive in order to provide field- and type-specific instructions to GPT.

Directives are a feature of GraphQL that allows schemas to carry additional information to provide to schema consuming services. See the GraphQL specification for details.


The directive Ai is used to configure interactions of OpenAI's GPT4 with content.

To use the directive, it must first be declared in the GraphQL schema file as follows:


The value of $ARGUMENTS depends on which arguments should be available for use in the schema. Combine the directive argument definitions of all customizations you want to use into a comma-separated string and replace $ARGUMENTS with this string.


This directive argument allows providing an instruction to GPT for a given GraphQL type or field.

The concrete argument definition is as follows:


This directive can be applied to a type as well as any number of fields of a type.


directive @Ai(instruction:String) on OBJECT | FIELD_DEFINITION

directive @Entry on OBJECT

type Page @Entry {
    id: ID! @Ai(instruction: "Do not fill or modify this field.")
    title: String!
    slug: String!
    components: [Component!]!

union Component =
    | Hero
    | Text

type Hero @Ai(instruction: "Use only as the first component of a page.") {
    heading: LocalizedString! @Ai(instruction: "Must be a catchy headline with five words or less.")

type Text {
    body: LocalizedString! @Ai(instruction: "Write prose text only. Do not use bullet points. Use multiple 'Text' components instead of line breaks.")

type LocalizedString {
    en: String! @Ai(instruction: "English text here.")
    de: String! @Ai(instruction: "German text here.")