创建 LUIS 资源Create LUIS resources

创作和查询预测运行时资源为你的语言理解 (LUIS) 应用和预测终结点提供身份验证。Authoring and query prediction runtime resources provide authentication to your Language Understanding (LUIS) app and prediction endpoint.

LUIS 资源LUIS resources

LUIS 允许三类 Azure 资源和一类非 Azure 资源:LUIS allows three types of Azure resources and one non-Azure resource:

资源Resource 目的Purpose 认知服务 kindCognitive service kind 认知服务 typeCognitive service type
创作资源Authoring resource 可用于创建、管理、训练、测试和发布应用程序。Allows you to create, manage, train, test, and publish your applications. 如果计划通过编程方式或 LUIS 门户创作 LUIS 应用,请创建 LUIS 创作资源Create a LUIS authoring resource if you intend to author LUIS apps programmatically or from the LUIS portal. 在将 Azure 创作资源链接到应用程序之前,你需要迁移你的 LUIS 帐户You need to migrate your LUIS account before you link your Azure authoring resources to your application. 可以通过为人员分配参与者角色来控制对创作资源的权限。You can control permissions to the authoring resource by assigning people the contributor role.

LUIS 创作资源有一个层级可用:One tier is available for the LUIS authoring resource:
  • 免费 F0 创作资源,它每月提供 100 万个免费创作事务和 1,000 个免费测试预测终结点请求。Free F0 authoring resource, which gives you 1 million free authoring transactions and 1,000 free testing prediction endpoint requests monthly.
LUIS.Authoring Cognitive Services
预测资源Prediction resource 在发布 LUIS 应用程序后,请使用预测资源/密钥来查询预测终结点请求。After you publish your LUIS application, use the prediction resource/key to query prediction endpoint requests. 请在客户端应用发出的预测请求超出创作资源或入门资源提供的 1,000 个请求之前创建 LUIS 预测资源。Create a LUIS prediction resource before your client app requests predictions beyond the 1,000 requests provided by the authoring or starter resource.

预测资源有两个层级可用:Two tiers are available for the prediction resource:
  • 免费 F0 预测资源,它每月提供 10,000 个免费预测终结点请求。Free F0 prediction resource, which gives you 10,000 free prediction endpoint requests monthly.
  • 标准 S0 预测资源,这是付费层级。Standard S0 prediction resource, which is the paid tier. 详细了解定价。Learn more about pricing.
LUIS Cognitive Services
入门版/试用版资源Starter/Trial resource 可用于创建、管理、训练、测试和发布应用程序。Allows you to create, manage, train, test, and publish your applications. 如果在首次登录到 LUIS 时选择入门版资源选项,则会默认创建此资源。This resource is created by default if you choose the starter resource option when you first sign in to LUIS. 入门版密钥最终会被弃用。The starter key will eventually be deprecated. 所有 LUIS 用户都将需要迁移其帐户并将其 LUIS 应用程序链接到创作资源。All LUIS users will need to migrate their accounts and link their LUIS applications to an authoring resource. 不同于创作资源,此资源不提供用于 Azure 基于角色的访问控制的权限。Unlike the authoring resource, this resource doesn't give you permissions for Azure role-based access control.

与创作资源一样,入门版资源也提供 100 万个免费创作事务和 1,000 个免费测试预测终结点请求。Like the authoring resource, the starter resource gives you 1 million free authoring transactions and 1,000 free testing prediction endpoint requests.
- 不是 Azure 资源。Not an Azure resource.
认知服务多服务资源密钥Cognitive Services multiservice resource key 与 LUIS 和其他受支持的认知服务共享的查询预测终结点请求。Query prediction endpoint requests shared with LUIS and other supported cognitive services. CognitiveServices Cognitive Services

备注

LUIS 提供了两种类型的 F0(免费层级)资源:一种用于创作事务,另一种用于预测事务。LUIS provides two types of F0 (free tier) resources: one for authoring transactions and one for prediction transactions. 如果用于预测事务的免费配额不足,请确保你使用的是每月提供 10,000 个免费事务的 F0 预测资源,而不是每月提供 1,000 个预测事务的创作资源。If you're running out of free quota for prediction transactions, make sure you're using the F0 prediction resource, which gives you a 10,000 free transactions monthly, and not the authoring resource, which gives you 1,000 prediction transactions monthly.

在 Azure 资源创建过程完成之后,请在 LUIS 门户中为应用分配资源When the Azure resource creation process is finished, assign the resource to the app in the LUIS portal.

重要

你应当在要进行发布和查询的区域中创作 LUIS 应用。You should author LUIS apps in the regions where you want to publish and query.

资源所有权Resource ownership

Azure 资源(例如 LUIS 资源)归包含该资源的订阅所有。An Azure resource, like a LUIS resource, is owned by the subscription that contains the resource.

若要更改资源的所有权,可以执行以下操作:To change the ownership of a resource, you can take this action:

  • 将 LUIS 应用导出为文件,然后在其他订阅上导入该应用。Export the LUIS app as a file, and then import the app on a different subscription. 可以从 LUIS 门户中的“我的应用”页面进行导出。Export is available on the My apps page in the LUIS portal.

资源限制Resource limits

创作密钥创建限制Authoring key creation limits

可以按订阅为每个区域创建最多 10 个创作密钥。You can create as many as 10 authoring keys per region, per subscription. 发布区域不同于创作区域。Publishing regions are different from authoring regions. 请确保在与你希望将客户端应用程序置于其中的发布区域对应的创作区域中创建应用。Make sure you create an app in the authoring region that corresponds to the publishing region where you want your client application to be located. 有关创作区域映射到发布区域的方式的信息,请参阅创作和发布区域For information on how authoring regions map to publishing regions, see Authoring and publishing regions.

有关密钥限制的详细信息,请参阅密钥限制For more information on key limits, see key limits.

有关密钥使用限制的错误Errors for key usage limits

使用限制取决于定价层。Usage limits are based on the pricing tier.

如果超过了每秒事务数 (TPS) 配额,则会出现 HTTP 429 错误。If you exceed your transactions-per-second (TPS) quota, you receive an HTTP 429 error. 如果超过了每月事务数 (TPM) 配额,则会出现 HTTP 403 错误。If you exceed your transaction-per-month (TPM) quota, you receive an HTTP 403 error.

重置创作密钥Reset an authoring key

对于已迁移的创作资源应用:如果创作密钥已泄露,请在 Azure 门户中该创作资源的“密钥”页上重置密钥。For migrated authoring resource apps: If your authoring key is compromised, reset the key in the Azure portal, on the Keys page for the authoring resource.

对于尚未迁移的应用:可在 LUIS 门户的所有应用中重置此密钥。For apps that haven't been migrated: The key is reset on all your apps in the LUIS portal. 如果通过创作 API 创作应用,则需要将 Ocp-Apim-Subscription-Key 的值更改为新密钥。If you author your apps via the authoring APIs, you need to change the value of Ocp-Apim-Subscription-Key to the new key.

重新生成 Azure 密钥Regenerate an Azure key

可以在 Azure 门户的“密钥”页上重新生成 Azure 密钥。You can regenerate an Azure key from the Keys page in the Azure portal.

应用所有权、访问权限和安全性App ownership, access, and security

应用是由其 Azure 资源定义的,这些资源取决于所有者的订阅。An app is defined by its Azure resources, which are determined by the owner's subscription.

你可以移动自己的 LUIS 应用。You can move your LUIS app. 可使用以下资源来帮助你通过 Azure 门户或 Azure CLI 实现此目的:Use the following resources to help you do so by using the Azure portal or Azure CLI:

其他作者的贡献Contributions from other authors

对于已迁移的创作资源应用:可以在 Azure 门户中使用“访问控制(IAM)”页面来管理创作资源的参与者。For migrated authoring resource apps: You can manage contributors for an authoring resource in the Azure portal by using the Access control (IAM) page. 了解如何使用协作者的电子邮件地址和参与者角色添加用户Learn how to add a user by using the collaborator's email address and the contributor role.

对于尚未迁移的应用:你可以在 LUIS 门户中的“管理 > 协作者”页上管理所有协作者。For apps that haven't yet migrated: You can manage all collaborators on the Manage -> Collaborators page in the LUIS portal.

专用和公共应用的查询预测访问权限Query prediction access for private and public apps

对于专用应用,所有者和参与者可以使用查询预测运行时访问权限。For private apps, query prediction runtime access is available for owners and contributors. 对于公共应用,具有自己的 Azure 认知服务LUIS 运行时资源和公共应用 ID 的用户可以使用运行时访问权限。For public apps, runtime access is available to users who have their own Azure Cognitive Service or LUIS runtime resource and the public app's ID.

目前没有公共应用的目录。There isn't currently a catalog of public apps.

创作权限和访问权限Authoring permissions and access

LUIS 门户或创作 API 访问应用的权限由 Azure 创作资源控制。Access to an app from the LUIS portal or the authoring APIs is controlled by the Azure authoring resource.

所有者和所有参与者具有创作应用所需的访问权限。The owner and all contributors have access to author the app.

创作访问权限包括:Authoring access includes: 说明Notes
添加或删除终结点密钥Add or remove endpoint keys
导出版本Export version
导出终结点日志Export endpoint logs
导入版本Import version
公开应用Make app public 如果应用是公共的,任何拥有创作密钥或终结点密钥的人员都可以查询应用。When an app is public, anyone who has an authoring or endpoint key can query the app.
修改模型Modify model
发布Publish
查看用于主动学习的终结点陈述Review endpoint utterances for active learning
定型Train

预测终结点运行时访问权限Prediction endpoint runtime access

查询预测终结点所需的访问权限由“应用程序信息”页上“管理”部分的设置进行控制。Access for querying the prediction endpoint is controlled by a setting on the Application Information page in the Manage section.

专用终结点Private endpoint 公共终结点Public endpoint
可供所有者和参与者使用Available to owner and contributors 可供所有者、参与者以及知道应用 ID 的任何其他人使用Available to owner, contributors, and anyone else who knows the app ID

可以通过在服务器到服务器环境中调用 LUIS 运行时密钥来控制谁可以查看该密钥。You can control who sees your LUIS runtime key by calling it in a server-to-server environment. 如果在机器人上使用 LUIS,则机器人和 LUIS 之间的连接已经更安全。If you're using LUIS from a bot, the connection between the bot and LUIS is already more secure. 如果直接调用 LUIS 终结点,则应创建具有受控访问权限(通过 Azure AD 之类的方式)的服务器端 API(例如 Azure 函数)。If you're calling the LUIS endpoint directly, you should create a server-side API (like an Azure function) with controlled access (via something like Azure AD). 如果调用并验证服务器端 API,则在确认授权后将调用传递到 LUIS。When the server-side API is called and authenticated and authorization is verified, pass the call on to LUIS. 此策略不能防止中间人攻击。This strategy doesn't prevent man-in-the-middle attacks. 但它会对你的用户的密钥和终结点 URL 进行模糊处理,允许你跟踪访问,并允许你添加终结点响应日志记录(例如 Application Insights)。But it does obfuscate your key and endpoint URL from your users, allow you to track access, and allow you to add endpoint response logging (like Application Insights).

专用应用的运行时安全性Runtime security for private apps

专用应用的运行时仅适用于以下密钥:A private app's runtime is available only to the following keys:

密钥和用户Key and user 说明Explanation
所有者的创作密钥Owner's authoring key 最多 1,000 个终结点命中数Up to 1,000 endpoint hits
协作者/参与者的创作密钥Collaborator/contributor authoring keys 最多 1,000 个终结点命中数Up to 1,000 endpoint hits
由作者或协作者/参与者分配给 LUIS 的任何密钥Any key assigned to LUIS by an author or collaborator/contributor 基于密钥用法层Based on key usage tier

公共应用的运行时安全性Runtime security for public apps

当你的应用配置为公共后,任何有效的 LUIS 创作密钥或 LUIS 终结点密钥都可以查询它,只要该密钥未使用整个终结点配额。When your app is configured as public, any valid LUIS authoring key or LUIS endpoint key can query it, as long as the key hasn't used the entire endpoint quota.

不是所有者或参与者的用户只有在获得应用 ID 后才能访问公共应用的运行时。A user who isn't an owner or contributor can access a public app's runtime only if given the app ID. LUIS 没有为用户提供公共市场或任何其他搜索公共应用的方式。LUIS doesn't have a public market or any other way for users to search for a public app.

公共应用在所有区域中发布。A public app is published in all regions. 因此,具有基于区域的 LUIS 资源密钥的用户可以在与资源密钥关联的任何区域中访问该应用。So a user with a region-based LUIS resource key can access the app in whichever region is associated with the resource key.

控制对查询预测终结点的访问Control access to your query prediction endpoint

可以通过在服务器到服务器环境中调用 LUIS 预测运行时终结点密钥来控制谁可以查看该密钥。You can control who can see your LUIS prediction runtime endpoint key by calling it in a server-to-server environment. 如果在机器人上使用 LUIS,则机器人和 LUIS 之间的连接已经更安全。If you're using LUIS from a bot, the connection between the bot and LUIS is already more secure. 如果直接调用 LUIS 终结点,则应创建具有受控访问权限(通过 Azure AD 之类的方式)的服务器端 API(例如 Azure 函数)。If you're calling the LUIS endpoint directly, you should create a server-side API (like an Azure function) with controlled access (via something like Azure AD). 如果调用服务器端 API 并且身份验证和授权得到验证,则将调用传递到 LUIS。When the server-side API is called and authentication and authorization are verified, pass the call on to LUIS. 此策略不能防止中间人攻击。This strategy doesn't prevent man-in-the-middle attacks. 但它会对你的用户的终结点进行模糊处理,允许你跟踪访问,并允许你添加终结点响应日志记录(例如 Application Insights)。But it does obfuscate your endpoint from your users, allow you to track access, and allow you to add endpoint response logging (like Application Insights).

登录 LUIS 门户并开始创作Sign in to the LUIS portal and begin authoring

  1. 登录 LUIS 门户并同意使用条款。Sign in to the LUIS portal and agree to the terms of use.

  2. 通过选择你的 Azure LUIS 创作密钥,开始创作 LUIS 应用:Start authoring your LUIS app by choosing your Azure LUIS authoring key:

    显示了欢迎屏幕的屏幕截图。

  3. 完成资源选择过程后,创建一个新应用When you're done with the resource selection process, create a new app.

在 Azure 门户中创建 LUIS 资源Create LUIS resources in the Azure portal

  1. 使用此链接在 Azure 门户中开始创建 LUIS 资源。Use this link to begin creating LUIS resources in the Azure portal.

  2. 输入所有必需的设置:Enter all required settings:

    名称Name 目的Purpose
    订阅Subscription 将对资源计费的订阅。The subscription that will be billed for the resource.
    资源组Resource group 你选择或创建的自定义资源组名称。A custom resource group name that you choose or create. 使用资源组可将 Azure 资源分组,以便进行访问和管理。Resource groups allow you to group Azure resources for access and management.
    名称Name 你选择的自定义名称。A custom name that you choose. 它用作创作以及预测终结点查询的自定义子域。It's used as your custom subdomain for your authoring and prediction endpoint queries.
    创作位置Authoring location 与模型关联的区域。The region associated with your model.
    创作定价层Authoring pricing tier 确定每秒和每月的最大事务数。Determines the maximum transactions per second and month.
    预测位置Prediction location 与已发布的预测终结点运行时关联的区域。The region associated with your published prediction endpoint runtime.
    预测定价层Prediction pricing tier 确定每秒和每月的最大事务数。Determines the maximum transactions per second and month.

    显示“创建”下的“基本信息”选项卡的屏幕截图。Screenshot that shows the Basics tab under Create.

  3. 选择“查看 + 创建”并等待创建资源。Select Review + create, and wait for the resource to be created.

  4. 创建这两个资源之后,仍然在 Azure 门户中选择新的创作资源。After both resources are created, still in the Azure portal, select the new authoring resource. 然后选择“密钥和终结点”,获取创作“终结点 URL”和“密钥”,通过编程方式进行创作 。Then select Keys and Endpoint to get the authoring endpoint URL and key for authoring programmatically.

提示

若要使用资源,请在 LUIS 门户中分配资源To use the resources, in the LUIS portal, assign the resources.

在 Azure CLI 中创建资源Create resources in the Azure CLI

使用 Azure CLI 单独创建每项资源。Use the Azure CLI to create each resource individually.

资源 kindResource kind:

  • 创作:LUIS.AuthoringAuthoring: LUIS.Authoring
  • 预测:LUISPrediction: LUIS
  1. 登录 Azure CLI:Sign in to the Azure CLI:

    az cloud set -n AzureChinaCloud
    az login
    

    此命令打开一个浏览器,使你可以选择正确的帐户并提供身份验证。This command opens a browser so you can select the correct account and provide authentication.

  2. 创建一个 LUIS.Authoring 种类的名为 my-luis-authoring-resource 的 LUIS 创作资源。Create a LUIS authoring resource of kind LUIS.Authoring, named my-luis-authoring-resource. chinanorth 区域的名为 my-resource-group 的现有资源组中创建它。Create it in the existing resource group named my-resource-group for the chinanorth region.

    az cognitiveservices account create -n my-luis-authoring-resource -g my-resource-group --kind LUIS.Authoring --sku F0 -l chinanorth --yes
    
  3. 创建 LUIS 种类的名为 my-luis-prediction-resource 的 LUIS 预测终结点资源。Create a LUIS prediction endpoint resource of kind LUIS, named my-luis-prediction-resource. chinanorth 区域的名为 my-resource-group 的现有资源组中创建它。Create it in the existing resource group named my-resource-group for the chinanorth region. 如果需要比免费层提供的吞吐量更高的吞吐量,请将 F0 更改为 S0If you want higher throughput than the free tier provides, change F0 to S0. 详细了解定价层和吞吐量Learn more about pricing tiers and throughput.

    az cognitiveservices account create -n my-luis-prediction-resource -g my-resource-group --kind LUIS --sku F0 -l chinanorth --yes
    

    备注

    在 LUIS 门户的“管理 > Azure 资源”页上分配这些密钥之前,该门户不会使用这些密钥。 These keys aren't used by the LUIS portal until they're assigned on the Manage > Azure Resources page in the LUIS portal.

在 LUIS 门户中分配资源Assign resources in the LUIS portal

可以在 LUIS 中为单个应用或所有应用分配创作资源。You can assign an authoring resource for a single app or for all apps in LUIS. 以下过程将所有应用分配给单个创作资源。The following procedure assigns all apps to a single authoring resource.

  1. 登录到 LUIS 门户Sign in to the LUIS portal.
  2. 在右上角选择你的用户帐户,然后选择“设置”。In the upper-right corner, select your user account, and then select Settings.
  3. 在“用户设置”页上选择“添加创作资源”,然后选择现有的创作资源。 On the User Settings page, select Add authoring resource, and then select an existing authoring resource. 选择“保存” 。Select Save.

将资源分配给应用Assign a resource to an app

备注

如果你没有 Azure 订阅,将无法分配或创建新资源。If you don't have an Azure subscription, you won't be able to assign or create a new resource. 你需要创建一个 Azure 试用帐户,然后返回到 LUIS,以便从门户创建新资源。You'll need to create an Azure Trial and then return to LUIS to create a new resource from the portal.

可以使用此过程创建创作或预测资源,或将其分配给应用程序:You can use this procedure to create an authoring or prediction resource or assign one to an application:

  1. 登录到 LUIS 门户Sign in to the LUIS portal. 从“我的应用”列表中选择应用。Select an app from the My apps list.

  2. 转到“管理” > “Azure 资源” :Go to Manage > Azure Resources:

    显示了“Azure 资源”页面的屏幕截图。

  3. 在“预测资源”或“创作资源”选项卡上,选择“添加预测资源”或“添加创作资源”按钮。 On the Prediction resource or Authoring resource tab, select the Add prediction resource or Add authoring resource button.

  4. 使用窗体中的字段查找正确的资源,然后选择“保存”。Use the fields in the form to find the correct resource, and then select Save.

  5. 如果没有现有的资源,可通过在窗口底部选择“是否创建新 LUIS 资源?”来创建一个。If you don't have an existing resource, you can create one by selecting Create a new LUIS resource? at the bottom of the window.

取消分配资源Unassign a resource

  1. 登录到 LUIS 门户,然后从“我的应用”列表中选择一个应用。Sign in to the LUIS portal, and then select an app from the My apps list.
  2. 转到“管理” > “Azure 资源” 。Go to Manage > Azure Resources.
  3. 在“预测资源”或“创作资源”选项卡上,选择与资源对应的“取消分配资源”按钮。 On the Prediction resource or Authoring resource tab, select the Unassign resource button for the resource.

取消分配资源时,不会将其从 Azure 中删除。When you unassign a resource, it's not deleted from Azure. 只会将其从 LUIS 取消链接。It's only unlinked from LUIS.

删除帐户Delete an account

要了解删除帐户时一并删除了哪些数据,请参阅数据存储和删除See Data storage and removal for information about what data is deleted when you delete your account.

更改定价层Change the pricing tier

  1. Azure 门户中,查找并选择你的 LUIS 订阅:In the Azure portal, find and select your LUIS subscription:

    显示了 Azure 门户中的 LUIS 订阅的屏幕截图。

  2. 选择“定价层”以查看可用的定价层:Select Pricing tier to see the available pricing tiers:

    显示了定价层菜单项的屏幕截图。

  3. 选择定价层,然后单击“选择”以保存更改:Select the pricing tier, and then click Select to save your change:

    显示了如何选择并保存定价层的屏幕截图。

    定价更改完成后,会出现一个用于验证定价层更新的弹出窗口:When the pricing change is complete, a pop-up window verifies the pricing tier update:

    用于验证定价更新的弹出窗口的屏幕截图。

  4. 请记住在“发布”页分配此终结点密钥,并将其用于所有终结点查询。Remember to assign this endpoint key on the Publish page and use it in all endpoint queries.

查看 Azure 资源指标View Azure resource metrics

查看 Azure 资源使用情况的摘要View a summary of Azure resource usage

可以在 Azure 门户中查看 LUIS 使用情况信息。You can view LUIS usage information in the Azure portal. “概述”页会显示摘要,其中包含最近的调用和错误。The Overview page shows a summary, including recent calls and errors. 如果你发出 LUIS 终结点请求,则最多需要五分钟才会显示更改。If you make a LUIS endpoint request, allow up to five minutes for the change to appear.

显示“概述”页面的屏幕截图。

自定义 Azure 资源使用图表Customizing Azure resource usage charts

“指标”页提供了更详细的数据视图:The Metrics page provides a more detailed view of the data:

显示了“指标”页面的屏幕截图。

可针对特定的时间段和指标类型配置指标图表:You can configure your metrics charts for a specific time period and metric type:

显示了自定义图表的屏幕截图。

总事务数阈值警报Total transactions threshold alert

如果你希望知道何时达到特定的事务阈值(例如 10,000 个事务),则可以创建警报:If you want to know when you reach a certain transaction threshold, for example 10,000 transactions, you can create an alert:

显示了“警报规则”页面的屏幕截图。

添加针对特定时间段内“总调用数”指标的指标警报。Add a metric alert for the total calls metric for a certain time period. 添加应接收该警报的所有人员的电子邮件地址。Add email addresses of all the people who should receive the alert. 添加应接收该警报的所有系统的 Webhook。Add webhooks for all the systems that should receive the alert. 还可在触发警报时运行逻辑应用。You can also run a logic app when the alert is triggered.

后续步骤Next steps