Skip to main content

Script Basics & Art Prompter

This Cookbook takes about 5 minutes.

You'll learn how to improve the quality of AI art by rewriting prompts. Along the way, you'll learn the concepts needed to create your own AI workflows:

  • Creating a Script
  • Testing a Script
  • Prompt Engineering Techniques
  • Templates & Variables
Before/after prompt rewrite comparison. Top row is original prompt, bottom is rewritten prompt.

Before/after prompt rewrite comparison. Top row is original prompt, bottom is rewritten prompt. Comparison done using Stable Diffusion 3 on May 6th 2024.

Case Study: Built-in Rewrites in OpenAI DALL·E 3 & Google Gemini

OpenAI's DALL·E 3 is used by ChatGPT to generate art. DALL·E 3 is also available in Telosnex. It revises your prompt before generating the image. As part of Telosnex's commitment to transparency, images generated by DALL·E 3 show the revised prompt.


OpenAI does this for quality, as well as to mitigate a significant issue: AI has inherent biases in it, due to the data it was trained on being skewed towards what is on the internet.


In late 2023, Google's AI, Gemini, was moving to launch, but, generations for "a smart person" were comically biased towards white men.


Google quickly added a prompt revision system to work around the issue. It was too aggressive, making it easy to abuse and generate offensive content such as placing minorities in the WWII-era Germany army.


DALL·E 3 has identical issues, but they were not as widely discussed and manipulated as Gemini's.

Plan

Goal

AI takes a prompt, revises it by adding more detail, then generates art based on the rewritten prompt.

Script Steps

  1. Dialogue: Instructions for rewriting prompts.
  2. AI Chat: Revise the prompt.
  3. AI Art: Generate art based on the revised prompt.

Create Script

  1. Get to the Scripts screen. From the Home screen, press the Go button, then press Scripts.
  2. Press the Add button (plus icon) at the top.

Add Steps

1. Dialogue

Press Code at the top of the screen, then press Dialogue.

Copy this into it:

Please rewrite that prompt for an AI art generator. Be extremely verbose and reiterate only a few core concepts, and be verbose for each concept, that way it re-enforces what we want the art generator to latch on to. Think of it like a really cool art history major you know helping write art prompts.

2. AI Chat

In the Code tab, press AI Chat. That step is where the AI responds to the prompt. You don't have to change anything.

3. Test

Let's test the Script. Press the Test tab, and type in a prompt. For example, downtown boston in spring. Change Tests to 3. Press Test, then review the responses.

My tests showed two things to improve:

  • Instructions are visible in the response.
  • Responses were chatty, like "Certainly! Here's a more verbose and reiterated prompt for an AI art generator:", and we don't want that in the AI Art prompt.

4. Revise Dialogue

  • First, let's hide the instructions. Press the eye icon at the top of the Dialogue step, then press Hide. Note: Telosnex is committed to transparency & control. Make hidden steps visible in chats by pressing the magic wand, and turning on Show Code.
  • Now, let's fix the chatty responses. We'll add two examples of inputs and outputs. AI will learn from them to just give back the prompt. Press New Instructions below to see the new Dialogue.
New Instructions

# EXAMPLES
Input: Serene lake at dawn
Output: A mirror-like expanse of placid water stretches out towards the horizon, its smooth surface gently kissed by the first golden rays of the rising sun. Wispy tendrils of mist hover above the lake, softening the edges of the surrounding landscape and lending an ethereal quality to the scene. The shoreline is fringed with towering evergreens, their dark silhouettes standing in stark contrast to the luminous sky, while the distant mountains are painted in soft shades of lavender and rose, their peaks still cloaked in the lingering shadows of the night. As the sun climbs higher, the mist begins to dissipate, revealing the crystal-clear depths of the lake, where the inverted reflection of the heavens creates a stunning mirror world of light and color.


Input: Rugged desert landscape
Output: An endless expanse of sun-scorched earth stretches out before the eye, its rugged terrain carved by the relentless forces of wind and time. Towering mesas and jagged buttes rise from the desert floor like ancient sentinels, their weathered faces bearing the scars of countless millennia. The parched ground is painted in a palette of muted earth tones - rusty reds, burnished oranges, and deep ochres - creating a tapestry of stark beauty that is at once harsh and mesmerizing. Scattered amidst the barren landscape are hardy desert plants, their twisted forms and thorny branches a testament to their resilience in the face of the unforgiving environment. As the sun traverses the vast expanse of the sky, the shifting shadows and play of light transform the desert into a living canvas, its colors and textures constantly evolving in a captivating display of nature's raw power and enduring majesty.


# INSTRUCTIONS
Please rewrite that prompt for an AI art generator. Be extremely verbose and reiterate only a few core concepts, and be verbose for each concept, that way it re-enforces what we want the art generator to latch on to. Think of it like a really cool art history major you know helping write art prompts.


Input: {{prompt}}

tip

The new instructions show 3 prompt engineering techniques:

  • Example-based learning: AI learns from examples. The examples show the AI what we want it to do.
  • Sectioning: There are headers for the instructions and examples. Using headers makes it clear what each section is for, writing long sets of instructions can confuse the AI.
  • Prompt reiterated via templating: AI focuses better on the text it saw last. The prompt is reiterated at the end of the instructions. This avoids issues like the AI thinking the examples are the prompt it should generate a response for. You can use {{prompt}} in any script step to reiterate the prompt.

5. Revise AI Chat

In the Code tab, scroll to the AI Chat step. Change variable name to rewrite. That lets us refer to the AI's response in templates, just like we did with the prompt.

6. AI Art

At the bottom of the Code tab, press AI Art.

Change prompt to {{rewrite}}. This tells the AI to use the rewritten prompt for generating the art.

Now, you can test the Script again. The AI should generate art based on the rewritten prompt.

Recap

🎉 Congratulations! You're done, and ready to make the best AI art you've ever made.

Best of all, you learned the core concepts for creating your own AI workflows:

  • Creating a Script: using the Scripts screen, adding steps, and hiding ones that will clutter the AI's response.
  • Testing & Revising Scripts: using the Test tab to see how the AI responds to different prompts, and making adjustments based on the results.
  • Prompt Engineering Techniques: example-based learning, sectioning, and prompt reiterated via templating
  • Templates & Variables: using {{prompt}} to reiterate the prompt and {{rewrite}} to refer to the AI's response.