Редагувати

Поділитися через


Prompt tool for flows in Azure AI Studio

Important

Items marked (preview) in this article are currently in public preview. This preview is provided without a service-level agreement, and we don't recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.

The prompt flow Prompt tool offers a collection of textual templates that serve as a starting point for creating prompts. These templates, based on the Jinja template engine, facilitate the definition of prompts. The tool proves useful when prompt tuning is required before the prompts are fed into the large language model (LLM) in the prompt flow.

Prerequisites

Prepare a prompt. The LLM tool and Prompt tool both support Jinja templates.

In this example, the prompt incorporates Jinja templating syntax to dynamically generate the welcome message and personalize it based on the user's name. It also presents a menu of options for the user to choose from. Depending on whether the user_name variable is provided, it either addresses the user by name or uses a generic greeting.

Welcome to {{ website_name }}!
{% if user_name %}
    Hello, {{ user_name }}!
{% else %}
    Hello there!
{% endif %}
Please select an option from the menu below:
1. View your account
2. Update personal information
3. Browse available products
4. Contact customer support

For more information and best practices, see Prompt engineering techniques.

Build with the Prompt tool

  1. Create or open a flow in Azure AI Studio. For more information, see Create a flow.

  2. Select + Prompt to add the Prompt tool to your flow.

    Screenshot that shows the Prompt tool added to a flow in Azure AI Studio.

  3. Enter values for the Prompt tool input parameters described in the Inputs table. For information about how to prepare the prompt input, see Prerequisites.

  4. Add more tools (such as the LLM tool) to your flow, as needed. Or select Run to run the flow.

  5. The outputs are described in the Outputs table.

Inputs

The following input parameters are available.

Name Type Description Required
prompt string The prompt template in Jinja. Yes
Inputs - The list of variables of a prompt template and its assignments. -

Outputs

Example 1

Inputs:

Variable Type Sample value
website_name string "Microsoft"
user_name string "Jane"

Outputs:

Welcome to Microsoft! Hello, Jane! Please select an option from the menu below: 1. View your account 2. Update personal information 3. Browse available products 4. Contact customer support

Example 2

Inputs:

Variable Type Sample value
website_name string "Bing"
user_name string "

Outputs:

Welcome to Bing! Hello there! Please select an option from the menu below: 1. View your account 2. Update personal information 3. Browse available products 4. Contact customer support

Next steps