如何以编程方式将预测资源添加到LUIS应用程序 [英] How to add a Prediction Resource to LUIS app programmatically

查看:59
本文介绍了如何以编程方式将预测资源添加到LUIS应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C#SDK创建具有所需Intent,Utterances和Entities的LUIS应用程序,然后使用在Azure门户中创建的Authoring密钥训练和发布这些应用程序.此后,我使用REST Prediction端点进行Intent匹配,直到现在,我都使用了免费的Starter Prediction Key.自Starter密钥过期以来一个月后,我在Azure中创建了一个Cognitive服务,用作Prediction资源.现在,如何通过SDK或REST将这个新的预测资源(认知服务)添加到我的LUIS应用程序中?我可以从LUIS Portal进行操作,但不希望手动干预.

解决方案

一旦创建了预测端点资源,则该资源应仅用于端点预测查询,而不应用于对应用程序进行更改.如果您不想通过门户网站将预测资源添加到您的应用程序中,并且出于CI/CD管道之类的目的将资源自动分配给LUIS应用程序,则可以按照以下步骤操作:

  • 从此

    此API返回LUIS订阅的JSON对象数组,包括作为帐户名返回的订阅ID,资源组和资源名称.在数组中找到一个项目,它是分配给LUIS应用程序的LUIS资源.

    • 使用

      此API成功执行后,将返回201创建状态.

      希望这会有所帮助.

      I am using C# SDK to create the LUIS apps with required Intents, Utterances and Entities, and then training and Publishing the apps using an Authoring key created in Azure portal. After this, I use the REST Prediction endpoint for Intent matching, and till now I used the free Starter Prediction Key. After a month since the Starter key gets expired, I created a Cognitive service in Azure to be used as the Prediction resource. Now, how to add this new Prediction resource(Cognitive service) to my LUIS apps via SDK or REST? I am able to do so from LUIS Portal though, but don't want manual intervention.

      解决方案

      Once you create the prediction endpoint resource, the resource should be only used for endpoint prediction queries and not for authoring changes to the app. If you want to add the prediction resource to your app by not going through the portal and automate the assignment of the resource to a LUIS app for purposes like CI/CD pipeline, then you can follow the steps below:

      • Get an Azure Resource Manager token from this website. This token does expire so use it immediately. The request returns an Azure Resource Manager token.
      • Use the token to request the LUIS runtime resources across subscriptions, from the Get LUIS azure accounts API, which your user account has access to.

      This POST API requires the following settings:

      This API returns an array of JSON objects of your LUIS subscriptions including subscription ID, resource group, and resource name, returned as account name. Find the one item in the array that is the LUIS resource to assign to the LUIS app.

      This POST API requires the following settings:

      When this API is successful, it returns a 201 - created status.

      Hope this helps.

      这篇关于如何以编程方式将预测资源添加到LUIS应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆