Skip to content

Commit 7615781

Browse files
authored
Merge pull request #267368 from eric-urban/eur/prompt-flow-refresh
prompt flow refresh
2 parents 3a597eb + d2875f6 commit 7615781

File tree

3 files changed

+67
-31
lines changed

3 files changed

+67
-31
lines changed

articles/ai-studio/how-to/flow-process-image.md

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
11
---
2-
title: Process images in prompt flow (preview)
3-
titleSuffix: Azure Machine Learning
4-
description: Learn how to incorporate images into prompt flow.
5-
services: machine-learning
6-
ms.service: machine-learning
7-
ms.subservice: prompt-flow
2+
title: Process images in prompt flow
3+
titleSuffix: Azure AI Studio
4+
description: Learn how to use images in prompt flow.
5+
ms.service: azure-ai-studio
86
ms.topic: how-to
9-
ms.author: jinzhong
10-
author: zhongj
11-
ms.reviewer: lagayhar
12-
ms.date: 02/05/2024
7+
ms.date: 2/26/2024
8+
ms.reviewer: jinzhong
9+
ms.author: lagayhar
10+
author: lgayhardt
1311
---
1412

15-
# Process images in prompt flow (preview)
13+
# Process images in prompt flow
14+
15+
[!INCLUDE [Azure AI Studio preview](../includes/preview-ai-studio.md)]
1616

1717
Multimodal Large Language Models (LLMs), which can process and interpret diverse forms of data inputs, present a powerful tool that can elevate the capabilities of language-only systems to new heights. Among the various data types, images are important for many real-world applications. The incorporation of image data into AI systems provides an essential layer of visual understanding.
1818

19-
In this article, you'll learn:
19+
In this article, you learn:
2020
> [!div class="checklist"]
2121
> - How to use image data in prompt flow
2222
> - How to use built-in GPT-4V tool to analyze image inputs.
2323
> - How to build a chatbot that can process image and text inputs.
2424
> - How to create a batch run using image data.
2525
> - How to consume online endpoint with image data.
2626
27-
> [!IMPORTANT]
28-
> Prompt flow image support is currently in public preview. This preview is provided without a service-level agreement, and is not recommended for production workloads. Certain features might not be supported or might have constrained capabilities.
29-
> For more information, see [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/).
30-
3127
## Image type in prompt flow
3228

3329
Prompt flow input and output support Image as a new data type.
@@ -38,10 +34,10 @@ To use image data in prompt flow authoring page:
3834
:::image type="content" source="../media/prompt-flow/how-to-process-image/add-image-type-input.png" alt-text="Screenshot of flow authoring page showing adding flow input as Image type." lightbox = "../media/prompt-flow/how-to-process-image/add-image-type-input.png":::
3935
2. Preview the image. If the image isn't displayed correctly, delete the image and add it again.
4036
:::image type="content" source="../media/prompt-flow/how-to-process-image/flow-input-image-preview.png" alt-text="Screenshot of flow authoring page showing image preview flow input." lightbox = "../media/prompt-flow/how-to-process-image/flow-input-image-preview.png":::
41-
3. You might want to **preprocess the image using Python tool** before feeding it to LLM, for example, you can resize or crop the image to a smaller size.
37+
3. You might want to preprocess the image using the [Python tool](./prompt-flow-tools/python-tool.md) before feeding it to the LLM. For example, you can resize or crop the image to a smaller size.
4238
:::image type="content" source="../media/prompt-flow/how-to-process-image/process-image-using-python.png" alt-text="Screenshot of using python tool to do image preprocessing." lightbox = "../media/prompt-flow/how-to-process-image/process-image-using-python.png":::
4339
> [!IMPORTANT]
44-
> To process image using Python function, you need to use the `Image` class, import it from `promptflow.contracts.multimedia` package. The Image class is used to represent an Image type within prompt flow. It is designed to work with image data in byte format, which is convenient when you need to handle or manipulate the image data directly.
40+
> To process images using a Python function, you need to use the `Image` class that you import from the `promptflow.contracts.multimedia` package. The `Image` class is used to represent an `Image` type within prompt flow. It is designed to work with image data in byte format, which is convenient when you need to handle or manipulate the image data directly.
4541
>
4642
> To return the processed image data, you need to use the `Image` class to wrap the image data. Create an `Image` object by providing the image data in bytes and the [MIME type](https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) `mime_type`. The MIME type lets the system understand the format of the image data, or it can be `*` for unknown type.
4743
@@ -51,7 +47,7 @@ If the Image object from Python node is set as the flow output, you can preview
5147

5248
## Use GPT-4V tool
5349

54-
Azure OpenAI GPT-4 Turbo with Vision tool and OpenAI GPT-4V are built-in tools in prompt flow that can use OpenAI GPT-4V model to answer questions based on input images. You can find the tool by selecting **More tool** in the flow authoring page.
50+
The [Azure OpenAI GPT-4 Turbo with Vision tool](./prompt-flow-tools/azure-open-ai-gpt-4v-tool.md) and OpenAI GPT-4V are built-in tools in prompt flow that can use OpenAI GPT-4V model to answer questions based on input images. You can find the tool by selecting **+ More tools** in the flow authoring page.
5551

5652
Add the [Azure OpenAI GPT-4 Turbo with Vision tool](./prompt-flow-tools/azure-open-ai-gpt-4v-tool.md) to the flow. Make sure you have an Azure OpenAI connection, with the availability of GPT-4 vision-preview models.
5753

@@ -65,11 +61,11 @@ You can assign a value to the image input through the following ways:
6561

6662
- Reference from the flow input of Image type.
6763
- Reference from other node's output of Image type.
68-
- Upload, drag, paste an image, or specify an image URL or the relative image path.
64+
- Upload, drag, or paste an image, or specify an image URL or the relative image path.
6965

7066
## Build a chatbot to process images
7167

72-
In this section, you'll learn how to build a chatbot that can process image and text inputs.
68+
In this section, you learn how to build a chatbot that can process image and text inputs.
7369

7470
Assume you want to build a chatbot that can answer any questions about the image and text together. You can achieve this by following the steps below:
7571

@@ -120,13 +116,13 @@ If the batch run outputs contain images, you can check the **flow_outputs datase
120116

121117
You can [deploy a flow to an online endpoint for real-time inference](./flow-deploy.md).
122118

123-
Currently the **Test** tab in the deployment detail page does not support image inputs or outputs.
119+
Currently the **Test** tab in the deployment detail page doesn't support image inputs or outputs.
124120

125121
For now, you can test the endpoint by sending request including image inputs.
126122

127123
To consume the online endpoint with image input, you should represent the image by using the format `{"data:<mime type>;<representation>": "<value>"}`. In this case, `<representation>` can either be `url` or `base64`.
128124

129-
If the flow generates image output, it will be returned with `base64` format, for example, `{"data:<mime type>;base64": "<base64 string>"}`.
125+
If the flow generates image output, it is returned with `base64` format, for example, `{"data:<mime type>;base64": "<base64 string>"}`.
130126

131127
## Next steps
132128

articles/ai-studio/how-to/prompt-flow-tools/azure-open-ai-gpt-4v-tool.md

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: This article introduces the Azure OpenAI GPT-4 Turbo with Vision to
55
manager: nitinme
66
ms.service: azure-ai-studio
77
ms.topic: how-to
8-
ms.date: 1/8/2024
8+
ms.date: 2/26/2024
99
ms.reviewer: keli19
1010
ms.author: lagayhar
1111
author: lgayhardt
@@ -27,18 +27,51 @@ The prompt flow *Azure OpenAI GPT-4 Turbo with Vision* tool enables you to use y
2727

2828
- An [Azure AI hub resource](../../how-to/create-azure-ai-resource.md) with a GPT-4 Turbo with Vision model deployed in one of the regions that support GPT-4 Turbo with Vision: Australia East, Switzerland North, Sweden Central, and West US. When you deploy from your project's **Deployments** page, select: `gpt-4` as the model name and `vision-preview` as the model version.
2929

30-
## Connection
30+
## Build with the Azure OpenAI GPT-4 Turbo with Vision tool
3131

32-
Set up connections to provisioned resources in prompt flow.
32+
1. Create or open a flow in [Azure AI Studio](https://ai.azure.com). For more information, see [Create a flow](../flow-develop.md).
33+
1. Select **+ More tools** > **Azure OpenAI GPT-4 Turbo with Vision** to add the Azure OpenAI GPT-4 Turbo with Vision tool to your flow.
3334

34-
| Type | Name | API KEY | API Type | API Version |
35-
|-------------|----------|----------|----------|-------------|
36-
| AzureOpenAI | Required | Required | Required | Required |
35+
:::image type="content" source="../../media/prompt-flow/azure-openai-gpt-4-vision-tool.png" alt-text="Screenshot of the Azure OpenAI GPT-4 Turbo with Vision tool added to a flow in Azure AI Studio." lightbox="../../media/prompt-flow/azure-openai-gpt-4-vision-tool.png":::
36+
37+
1. Select the connection to your Azure OpenAI Service. For example, you can select the **Default_AzureOpenAI** connection. For more information, see [Prerequisites](#prerequisites).
38+
1. Enter values for the Azure OpenAI GPT-4 Turbo with Vision tool input parameters described [here](#inputs). For example, you can use this example prompt:
39+
40+
```jinja
41+
# system:
42+
As an AI assistant, your task involves interpreting images and responding to questions about the image.
43+
Remember to provide accurate answers based on the information present in the image.
44+
45+
# user:
46+
Can you tell me what the image depicts?
47+
![image]({{image_input}})
48+
```
49+
50+
1. Select **Validate and parse input** to validate the tool inputs.
51+
1. Specify an image to analyze in the `image_input` input parameter. For example, you can upload an image or enter the URL of an image to analyze. Otherwise you can paste or drag and drop an image into the tool.
52+
1. Add more tools to your flow as needed, or select **Run** to run the flow.
53+
1. The outputs are described [here](#outputs).
54+
55+
Here's an example output response:
56+
57+
```json
58+
{
59+
"system_metrics": {
60+
"completion_tokens": 96,
61+
"duration": 4.874329,
62+
"prompt_tokens": 1157,
63+
"total_tokens": 1253
64+
},
65+
"output": "The image depicts a user interface for Azure's OpenAI GPT-4 service. It is showing a configuration screen where settings related to the AI's behavior can be adjusted, such as the model (GPT-4), temperature, top_p, frequency penalty, etc. There's also an area where users can enter a prompt to generate text, and an option to include an image input for the AI to interpret, suggesting that this particular interface supports both text and image inputs."
66+
}
67+
```
3768

3869
## Inputs
3970

40-
| Name | Type | Description | Required |
41-
|------------------------|-------------|------------------------------------------------------------------------------------------------|----------|
71+
The following are available input parameters:
72+
73+
| Name | Type | Description | Required |
74+
| ---- | ---- | ----------- | -------- |
4275
| connection | AzureOpenAI | The Azure OpenAI connection to be used in the tool. | Yes |
4376
| deployment\_name | string | The language model to use. | Yes |
4477
| prompt | string | Text prompt that the language model uses to generate its response. | Yes |
@@ -51,6 +84,13 @@ Set up connections to provisioned resources in prompt flow.
5184

5285
## Outputs
5386

87+
The following are available output parameters:
88+
5489
| Return Type | Description |
5590
|-------------|------------------------------------------|
5691
| string | The text of one response of conversation |
92+
93+
## Next steps
94+
95+
- [Learn more about how to create a flow](../flow-develop.md)
96+
163 KB
Loading

0 commit comments

Comments
 (0)