1
votes

I am developing a bot using botbuilder SDK V4 for Node.js and Microsoft Azure services …

In the .bot file, we find the encrypted LUIS app informations.

{
  "type": "luis",
  "name": "luis",
  "appId": <appId>,
  "authoringKey": <authoringKey>,
  "subscriptionKey": <subscriptionKey>,
  "version": "0.1",
  "region": <region>,
  "id": <id>
}

My question is how to change the LUIS app used by my bot in the .bot file?

in the LUIS endpoint, there is a parameter called staging, which will specify if I am using the LUIS app in staging or production mode.

So, how to specify the staging or production mode in the .bot file?

1

1 Answers

3
votes

TL;DR

You cannot use a Staging slot by just editing the configuration of your bot.

But you can use staging with the Options of the Recognizer, so use another parameter to activate Staging use.


Details - Use of Staging vs Production in LUIS

Technically speaking, the difference between calls to Staging versus Production slots of a LUIS app can be seen in the URL called, where there is a staging=true field:

  • Staging: https://_AzureRegion_.api.cognitive.microsoft.com/luis/v2.0/apps/_AppId_?staging=true&verbose=true&timezoneOffset=60&subscription-key=_YourKey_&q=_YourQuery_

  • Prod: https://_AzureRegion_.api.cognitive.microsoft.com/luis/v2.0/apps/_AppId_?verbose=true&timezoneOffset=60&subscription-key=_YourKey_&q=_YourQuery_

Implementation in Bot Builder

You can see in the BotBuilder sources that staging is never used in the configuration. But, in the class called LuisRecognizer, you can pass options where there is a staging boolean, see here for .Net, here for js.

So in js in your case:

// Map the contents to the required format for `LuisRecognizer`.
const luisApplication = {
    applicationId: process.env.appId,
    endpointKey: process.env.subscriptionKey,
    azureRegion: process.env.region
}

// Create configuration for LuisRecognizer's runtime behavior.
const luisPredictionOptions = {
    includeAllIntents: true,
    log: true,
    staging: **POINT TO A CONFIG VARIABLE FOR EXAMPLE**
}

const luisRecognizer = new LuisRecognizer(luisApplication, luisPredictionOptions, true);