你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Azure AI Studio 中的流 Prompt 工具

重要

本文中标记了“(预览版)”的项目目前为公共预览版。 此预览版未提供服务级别协议,不建议将其用于生产工作负载。 某些功能可能不受支持或者受限。 有关详细信息,请参阅 Microsoft Azure 预览版补充使用条款

提示流 Prompt 工具提供文本模板集合,可从这些模板开始创建提示。 这些模板基于 Jinja 模板引擎,能够帮助你更轻松地定义提示。 将提示馈送到提示流的大型语言模型 (LLM) 中之前,如果需要对提示进行微调,此工具非常有用。

先决条件

准备提示。 LLM 工具和 Prompt 工具都支持 Jinja 模板。

在此示例中,提示整合了 Jinja 模板化的语法以动态生成欢迎辞,并根据用户的名字进行个性化。 此外,它还提供一份选项菜单供用户选择。 根据是否提供了 user_name 变量,提示要么称呼用户的名字,要么使用通用问候语。

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

有关更多信息和最佳做法,请参阅提示工程技术

使用 Prompt 工具进行生成

  1. Azure AI Studio 中创建或打开流。 有关详细信息,请参阅创建流

  2. 选择“+ Prompt”,将 Prompt 工具添加到流中。

    显示已在 Azure AI Studio 中向流添加 Prompt 工具的屏幕截图。

  3. 输入输入表所述的 Prompt 工具输入参数的值。 若要了解如何准备提示输入,请参阅先决条件

  4. 根据需要将更多工具(如 LLM 工具)添加到流。 或者,选择“运行”以运行流

  5. 输出表中介绍了输出。

输入

以下输入参数可用。

名称 Type 描述 必需
prompt string Jinja 中的提示模板。
输入 - 提示模板的变量及其赋值的列表。 -

Outputs

示例 1

输入:

变量 类型 示例值
website_name 字符串 “Microsoft”
user_name 字符串 “Jane”

输出:

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

示例 2

输入:

变量 类型 示例值
website_name 字符串 “Bing”
user_name 字符串 "

输出:

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

后续步骤