|
| 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" |  |  | |
| 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. |
0 commit comments