创建 LUIS 资源Create LUIS resources

创作和查询预测运行时资源为 LUIS 应用和预测终结点提供身份验证。Authoring and query prediction runtime resources provide authentication to your 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 programtically or from the LUIS Portal. 需要先迁移 LUIS 帐户,以便能够将 Azure 创作资源链接到应用程序。You need to first migrate your LUIS account to be able to link your Azure authroring resources to your application. 可以通过为人员分配参与者角色来控制对创作资源的权限。You can control permissions to the authoring resource by assigning people to the contributor role.

有一个层级可用于 LUIS 创作资源:There is one tier avialable for the LUIS authoring resource:
* 免费 F0 创作资源,它每月提供 1000000 个免费创作事务和 1000 个免费测试预测终结点请求。* Free F0 Authoring resource whcih gives you 1M Free authoring transactions and 1000 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 the starter resource.

有两个层级可用于预测资源:There are two tiers avialble 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 the pricing details
LUIS Cognitive Services
入门/试用资源Starter/Trial Resource 可用于创建、管理、训练、测试和发布应用程序。Allows you to create, manage, train, test and publish your applications. 如果在首次注册到 LUIS 时选择入门资源选项,则默认会创建此类资源。This is created by deafult if you choose the starter resource option while first signing up tp LUIS. 但是,入门密钥最终将会被弃用,并且所有的 LUIS 用户都会需要迁移其帐户并将其 LUIS 应用程序链接到创作资源。However, the starter key will eventually be deprecated and all LUIS users will need to migrate their accounts and link their LUIS applications to an authoring resource. 此类资源不会像创作资源一样提供用于 Azure 基于角色的访问控制的权限。This resource does not give you permissions for Azure role-based access control like the authoring resource.

就像创作资源一样,入门资源也提供 1000000 个免费创作事务和 1000 个免费测试预测终结点请求。Just as the authoring resource, the starter resource gives you 1M Free authoring transactions and 1000 free testing prediction endpoint requests.
- 不是 Azure 资源Not an Azure resource
认知服务多服务资源密钥Cognitive Service multi-service resource key 与 LUIS 和其他受支持的认知服务共享的查询预测终结点请求。Query prediction endpoint requests shared with LUIS and other supported Cognitive Services. CognitiveServices Cognitive Services

备注

LUIS 提供的 F0(免费层级)资源有两类。There are two types of F0 (free tier) resources that LUIS provides. 一类用于创作事务,另一类用于预测事务。One for authoring transactions and one for prediction transactions. 如果用于预测事务的免费配额不足,请确保实际使用的是每月提供 10,000 个免费事务的 F0 预测资源,而不是每月提供 1000 个预测事务的创作资源。If you are running out of free quota for prediction transactions, make sure that you are in fact using the F0 prediction resource that gives you a 10,000 free transactions monthly and not the authoring resource that gives you 1000 prediction transactions monthly.

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

请务必在想要进行发布和查询的区域创作 LUIS 应用。It is important to author LUIS apps in regions where you want to publish and query.

资源所有权Resource ownership

Azure 资源(如 LUIS)由包含资源的订阅所有。An Azure resource, such as a LUIS, is owned by the subscription containing the resource.

若要转让资源的所有权,可以执行以下任一操作:To transfer ownership of a resource, you can either:

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

资源限制Resource limits

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

可以按订阅为每个区域创建最多 10 个创作密钥。You can create up to 10 authoring keys per region per subscription.

请参阅密钥限制Azure 区域See Key Limits and Azure regions.

发布区域不同于创作区域。Publishing regions are different from authoring regions. 请确保在对应于发布区域的创作区域中创建应用,你需要将客户端应用程序置于该发布区域中。Make sure you create an app in the authoring region corresponding to the publishing region you want your client application to be located.

密钥使用限制错误Key usage limit errors

使用限制取决于定价层。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 (TPS) quota, you receive an HTTP 403 error.

重置创作密钥Reset authoring key

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

对于尚未迁移的应用:可在 LUIS 门户的所有应用中重置此密钥。For apps that have not migrated yet: 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 Azure key

在 Azure 门户的“密钥”页上重新生成 Azure 密钥。Regenerate the Azure keys from the Azure portal, on the Keys page.

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

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

你可以移动自己的 LUIS 应用。You can move your LUIS app. 在 Azure 门户或 Azure CLI 中,请参阅以下文档资源:Use the following documentation resources in the Azure portal or Azure CLI:

其他作者的贡献Contributions from other authors

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

对于尚未迁移的应用:所有协作者都在 LUIS 门户中通过“管理 -> 协作者”页面进行管理。For apps that have not migrated yet: all collaborators are managed in the LUIS portal from the Manage -> Collaborators page.

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

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

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

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

LUIS 门户或创作 API 访问应用的权限由 Azure 创作资源控制。Access to the 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
导出版本Exporting version
导出终结点日志Export endpoint logs
导入版本Importing version
公开应用Make app public 如果应用公开,任何拥有创作或终结点密钥的人员都可以查询应用。When an app is public, anyone with an authoring or endpoint key can query the app.
修改模型Modify model
发布Publish
查看用于主动学习的终结点陈述Review endpoint utterances for active learning
定型Train

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

查询预测终结点所需的访问权限由“应用程序信息” 页上“管理” 部分的设置进行控制。Access to query 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 that knows 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 are using LUIS from a bot, the connection between the bot and LUIS is already secure. 如果直接调用 LUIS 终结点,则应创建具有受控访问权限(如 AAD)的服务器端 API(如 Azure 函数)。If you are calling the LUIS endpoint directly, you should create a server-side API (such as an Azure function) with controlled access (such as AAD). 如果调用并验证服务器端 API,则在确认授权后将调用传递到 LUIS。When the server-side API is called and authenticated and authorization is verified, pass the call on to LUIS. 尽管此策略不能防范中间人攻击,但会模糊化处理用户的密钥和终结点 URL,允许跟踪访问,并允许添加终结点响应日志记录(如 Application Insights)。While this strategy doesn't prevent man-in-the-middle attacks, it obfuscates your key and endpoint URL from your users, allows you to track access, and allows you to add endpoint response logging (such as Application Insights).

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

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

密钥和用户Key and user 说明Explanation
所有者的创作密钥Owner's authoring key 最多 1000 个终结点命中数Up to 1000 endpoint hits
协作者/参与者的创作密钥Collaborator/contributor authoring keys 最多 1000 个终结点命中数Up to 1000 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 终结点密钥都可以查询应用,只要该密钥未使用整个终结点配额 。Once an app is configured as public, any valid LUIS authoring key or LUIS endpoint key can query your app, as long as the key has not used the entire endpoint quota.

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

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

保护查询预测终结点Securing the 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 are using LUIS from a bot, the connection between the bot and LUIS is already secure. 如果直接调用 LUIS 终结点,则应创建具有受控访问权限(如 AAD)的服务器端 API(如 Azure 函数)。If you are calling the LUIS endpoint directly, you should create a server-side API (such as an Azure function) with controlled access (such as AAD). 如果调用服务器端 API 并且身份验证和授权得到验证,则将调用传递到 LUIS。When the server-side API is called and authentication and authorization are verified, pass the call on to LUIS. 尽管此策略不会防止中间人攻击,但会模糊化处理用户的终结点,允许跟踪访问,并允许添加终结点响应日志记录(如 Application Insights)。While this strategy doesn't prevent man-in-the-middle attacks, it obfuscates your endpoint from your users, allows you to track access, and allows you to add endpoint response logging (such as Application Insights).

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

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

  2. 通过选择 Azure LUIS 创作密钥,开始使用 LUIS 应用。Begin your LUIS app by choosing your Azure LUIS authoring key.

    选择语言理解创作资源的类型

  3. 完成资源选择过程以后,请创建新应用When you are done with your resource selection process, create a new app.

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

    创建语言理解资源Create the language understanding resource

  3. 单击“查看 + 创建” 并等待创建资源。Click Review + create and wait for the resource to be created.

  4. 创建这两个资源后,请仍在 Azure 门户中选择新的创作资源,然后选择“快速入门” 以获取创作终结点 URL 和密钥 ,从而以编程方式进行创作。After both resources are created, still in the Azure portal, select the new authoring resource, then Quickstarts 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 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 opens a browser to allow you to select the correct account and provide authentication.

  2. 在名为 my-resource-group 的现有资源组中为 China East 2 区域创建一个类型为 LUIS.Authoring、名称为 my-luis-authoring-resourceLUIS 创作资源Create a LUIS authoring resource , of kind LUIS.Authoring, named my-luis-authoring-resource in the existing resource group named my-resource-group for the China East 2 region.

    az cognitiveservices account create -n my-luis-authoring-resource -g my-resource-group --kind LUIS.Authoring --sku F0 -l chinaeast2 --yes
    
  3. 在名为 my-resource-group 的现有资源组中为 chinaeast2 区域创建一个类型为 LUIS、名称为 my-luis-prediction-resourceLUIS 预测终结点资源Create a LUIS prediction endpoint resource , of kind LUIS, named my-luis-prediction-resource in the existing resource group named my-resource-group for the chinaeast2 region. 如果需要比免费层更高的吞吐量,请将 F0 更改为 S0If you want a higher throughput than the free tier, 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 chinaeast2 --yes
    

    备注

    在 LUIS 门户的“管理 -> Azure 资源”上分配此密钥之前,该门户不能使用此密钥。 This keys are not used by the LUIS portal until they are assigned in the LUIS portal on the Manage -> Azure resources .

在 LUIS 门户中分配资源Assign resource 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. 在右上角的导航栏中选择用户帐户,然后选择“设置”。At the top navigation bar, to the far right, select your user account, then select Settings .
  3. 在“用户设置”页上选择“添加创作资源”,然后选择现有的创作资源。 On the User Settings page, select Add authoring resource then select an existing authoring resource. 选择“保存” 。Select Save .

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

请注意,如果没有 Azure 订阅,将无法分配或创建新资源。Please note that if you do not have an Azure subscription, you will not be able to assign or create a new resource. 你将需要先去创建一个 Azure 1 元人民币试用帐户,然后返回到 LUIS,以便从门户创建新资源。You will have to first go and create an Azure 1rmb-trial then return to LUIS to create a new resource from the portal.

可以使用以下过程为应用程序分配或创建创作资源或预测资源:You can assign or create an authoring or a prediction resource to an application with the following procedure:

  1. 登录到 LUIS 门户,然后从“我的应用”列表中选择一个应用Sign in to the LUIS portal, then select an app from the My apps list

  2. 导航到“管理”->“Azure 资源”页Navigate to the Manage -> Azure resources page

    在 LUIS 门户中选择“管理 -> Azure 资源”,以便为应用分配资源。

  3. 选择“预测资源”或“创作资源”选项卡,然后选择“添加预测资源”或“添加创作资源”按钮 Select the Prediction or Authoring resource tab then select the Add prediction resource or Add authoring resource button

  4. 选择表单中的字段以找到正确的资源,然后选择“保存”Select the fields in the form to find the correct resource, then select Save

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

取消分配资源Unassign resource

  1. 登录 LUIS 门户,然后从“我的应用”列表中选择一个应用。Sign in to the LUIS portal, then select an app from the My apps list.
  2. 导航到“管理 -> Azure 资源”页。Navigate to the Manage -> Azure resources page.
  3. 对于此资源,选择“预测或创作资源”选项卡,然后选择“取消分配资源”按钮。Select the Prediction or Authoring resource tab then select the Unassign resource button for the resource.

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

删除帐户Delete account

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

更改定价层Change pricing tier

  1. Azure 中查找你的 LUIS 订阅。In Azure, find your LUIS subscription. 选择该 LUIS 订阅。Select the LUIS subscription. 查找 LUIS 订阅Find your LUIS subscription
  2. 选择“定价层”以查看可用的定价层。Select Pricing tier in order to see the available pricing tiers. 查看定价层View pricing tiers
  3. 选择定价层,然后选择“选择”以保存更改。Select the pricing tier and select Select to save your change. 更改 LUIS 支付层Change your LUIS payment tier
  4. 定价更改完成后,页面将出现一个供于验证新定价层的弹出窗口。When the pricing change is complete, a pop-up window verifies the new pricing tier. 验证 LUIS 支付层Verify your LUIS payment tier
  5. 请记住在“发布”页分配此终结点密钥,并将其用于所有终结点查询。Remember to assign this endpoint key on the Publish page and use it in all endpoint queries.

查看 Azure 资源指标Viewing Azure resource metrics

查看 Azure 资源使用摘要Viewing Azure resource summary usage

可在 Azure 中查看 LUIS 使用情况信息。You can view LUIS usage information in Azure. “概述”页显示包含调用和错误在内的最新摘要信息。The Overview page shows recent summary information including calls and errors. 如果发出 LUIS 终结点请求并立即查看“概述”页,则最多需要五分钟才会显示使用情况。If you make a LUIS endpoint request, then immediately watch the Overview page , allow up to five minutes for the usage to show up.

查看使用概况

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

通过指标可更加详细地了解数据。Metrics provides a more detailed view into the data.

默认指标

可针对时间期限和指标类型配置度量值图表。You can configure your metrics charts for time period and metric type.

自定义指标

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

如果希望在达到特定事务阈值(例如 10,000 个事务)时收到通知,则可以创建警报。If you would like to know when you have reached 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 people that should receive the alert. 添加应接收该警报的所有系统的 Webhook。Add webhooks for all systems that should receive the alert. 还可在触发警报时运行逻辑应用。You can also run a logic app when the alert is triggered.

后续步骤Next steps