Skip to content

Commit d56eb2e

Browse files
committed
add prompt transf draft; rm duplicate content
1 parent fe4aa0a commit d56eb2e

File tree

2 files changed

+72
-22
lines changed

2 files changed

+72
-22
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: Azure OpenAI prompt transformation concepts
3+
titleSuffix: Azure OpenAI
4+
description: Learn about the prompt transformation feature in Azure OpenAI DALL-E 3, how it works, and why it's needed.
5+
author: PatrickFarley
6+
ms.author: pafarley
7+
ms.service: azure-ai-openai
8+
ms.topic: conceptual
9+
ms.date: 07/16/2024
10+
manager: nitinme
11+
---
12+
13+
# What is prompt transformation?
14+
15+
Prompt transformation is a process that applies a safety and quality system message to your original prompt via a large language model (LLM) call prior to being sent to the model for image generation. This system message enriches your original prompt with the goal of generating more diverse and higher-quality images, while maintaining intent.
16+
17+
Prompt transformation is applied to all Azure OpenAI DALL-E 3 requests by default. There may be scenarios in which your scenario requires a lower level of enrichment. To generate images that use prompts that more closely resemble your original prompt, append this text to your prompt: `I NEED to test how the tool works with extremely simple prompts. DO NOT add any detail, just use it AS-IS:`. This will ensure there is minimal prompt transformation. Evaluating your system with this prompt will help you better understand the impact and value of prompt transformation.
18+
19+
After prompt transformation is applied to the original prompt, content filtering is applied as a secondary step prior to image generation; see [Content filtering](tbd) for more information.
20+
21+
Learn more about image generation prompting in OpenAI’s [DALL·E documentation](tbd).
22+
23+
24+
| **Example text prompt** | **Example generated image without prompt transformation** | **Example generated image with prompt transformation** |
25+
|---|---|---|
26+
|"Watercolor painting of the Seattle skyline" | ![Watercolor painting of the Seattle skyline (simple).](../media/how-to/generated-seattle.png) | ![Watercolor painting of the Seattle skyline, with more detail and structure.](../media/how-to/generated-seattle-prompt-transformed.png) |
27+
28+
29+
## Why is Prompt Transformation needed?
30+
31+
Prompt transformation is essential to responsible and high-quality generations. Not only does prompt transformation enhance the safety of your generated image, but it also enriches your prompt in a more descriptive manner, leading to higher quality and descriptive imagery.
32+
33+
Default prompt transformation in Azure OpenAI DALL-E 3 contains safety enhancements that steer the model away from generating images of Copyright Studio Characters and Artwork, Public Figures, and other harmful content such as sexual, hate and unfairness, violence, and self-harm content.
34+
35+
## How do I use Prompt Transformation?
36+
37+
Prompt transformation is applied by default to all Azure OpenAI DALL-E 3 requests. No additional set-up is required to benefit from prompt transformation enhancements.
38+
Like image generation, prompt transformation is non-deterministic due to the nature of large language models. A single original prompt may lead to a a variety of image variants.
39+
Your revised or transformed prompt will be visible in the response object as shown below, in the `revised_prompt` field.
40+
41+
### Example response
42+
43+
```json
44+
Input Content:
45+
{
46+
"prompt": "Watercolor painting of the Seattle skyline",
47+
"n": 1,
48+
"size": "1024x1024"
49+
}
50+
51+
Output Content:
52+
{
53+
"created": 1720557218,
54+
"data": [
55+
{
56+
"content_filter_results": {
57+
...
58+
},
59+
"prompt_filter_results": {
60+
...
61+
},
62+
"revised_prompt": "A soft and vivid watercolor painting capturing the scenic beauty of the Seattle skyline. The painting illustrates a setting sun casting warm hues over the sprawling cityscape, with the Space Needle prominently standing tall against the sky. Imagine the scattered high-rise buildings, a soothing blend of the lush green of the parks with the winding blue water of the Puget Sound, and the snow-covered peak of Mount Rainier in the distance. A play of light and shadow adds depth and dynamism to this multihued urban panorama."
63+
}
64+
}
65+
```
66+
67+
68+
The Azure OpenAI Service does not offer configurability for prompt transformation at this time. To bypass prompt transformation, prepend the following to any request: `I NEED to test how the tool works with extremely simple prompts. DO NOT add any detail, just use it AS-IS:`.
69+
70+
While this addition will encourage the revised prompt to be more representative of your original prompt, the system may alter specific details.

articles/ai-services/openai/how-to/dall-e.md

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -255,30 +255,10 @@ It's also possible that the generated image itself is filtered. In this case, th
255255

256256
Your image prompts should describe the content you want to see in the image, as well as the visual style of image.
257257

258-
> [!TIP]
259-
> For a thorough look at how you can tweak your text prompts to generate different kinds of images, see the [Dallery DALL-E 2 prompt book](https://dallery.gallery/wp-content/uploads/2022/07/The-DALL%C2%B7E-2-prompt-book-v1.02.pdf).
260-
261-
#### [DALL-E 3](#tab/dalle3)
262-
263258
When writing prompts, consider that the image generation APIs come with a content moderation filter. If the service recognizes your prompt as harmful content, it doesn't generate an image. For more information, see [Content filtering](../concepts/content-filter.md).
264259

265-
### Prompt transformation
266-
267-
DALL-E 3 includes built-in prompt rewriting to enhance images, reduce bias, and increase natural variation of images.
268-
269-
| **Example text prompt** | **Example generated image without prompt transformation** | **Example generated image with prompt transformation** |
270-
|---|---|---|
271-
|"Watercolor painting of the Seattle skyline" | ![Watercolor painting of the Seattle skyline (simple).](../media/how-to/generated-seattle.png) | ![Watercolor painting of the Seattle skyline, with more detail and structure.](../media/how-to/generated-seattle-prompt-transformed.png) |
272-
273-
The updated prompt is visible in the `revised_prompt` field of the data response object.
274-
275-
While it is not currently possible to disable this feature, you can use special prompting to get outputs closer to your original prompt by adding the following to it: `I NEED to test how the tool works with extremely simple prompts. DO NOT add any detail, just use it AS-IS:`.
276-
277-
#### [DALL-E 2 (preview)](#tab/dalle2)
278-
279-
When writing prompts, consider that the image generation APIs come with a content moderation filter. If the service recognizes your prompt as harmful content, it doesn't generate an image. For more information, see [Content filtering](../concepts/content-filter.md).
280-
281-
---
260+
> [!TIP]
261+
> For a thorough look at how you can tweak your text prompts to generate different kinds of images, see the [Image prompt engineering guide](/azure/ai-services/openai/concepts/gpt-4-v-prompt-engineering).
282262
283263

284264
## Specify API options

0 commit comments

Comments
 (0)