Luis Workers

Type: NLP Worker

A Luis worker takes user input and sends it to Luis for natural language processing. A Luis worker can be created through the CLI, or through portal.

Creating a Luis Application

The following contains useful documentation on getting started with a new Luis Application, which will be needed in the next sections https://docs.microsoft.com/en-us/azure/cognitive-services/luis/luis-get-started-create-app

Assuming you have setup a Luis Application, you can find the required information for creating a luis worker within the Luis portal by following these steps:

  • Navigate to the My Apps dashboard, this will show all of your Luis applications.
  • Select your Luis Application and click Manage.
  • Select the Manage tab on your Luis application.
  • On the Settings tab, take note of your App ID. The image below shows where your app id is located on the Settings tab.

Luis Application Settings

  • Select the Azure Resources tab and on the Prediction Resources tab take note of both the Location and PrimaryKey, the Primary Key is commonly referred to as the Prediction Key, we will refer to it as the Prediction Key from now on.
  • On the same page select the Authoring Resources tab, again take note of the PrimaryKey, we will refer to this as the Authoring Key from now on.

Luis Azure Resources

Details for Luis Worker Configuration

Once you have the information from the Creating a Luis Application, you can derive the details which will be required for creating a Luis Worker:

  • Secret: The secret will contain both the Authoring Key and Prediction Key that will be used to communicate with Luis. This is the Prediction Key and Authoring Key mentioned in the previous section. See Creating a Luis Secret for more information on creating the secret.

  • AppId (Optional): The identifier of the particular Luis application you wish to use for intent detection.

    • The App Id is an optional field for the worker, if you do not provide an App Id, the first time you publish a ServisBOT bot, ServisBOT will generate a Luis application for you and update your worker configuration with the new App Id and use this App Id for future communication with Luis. The application ServisBOT generates for you will be namespaced by your organization and bot. For example if your organization name is ‘myorg’ and your bot name is ‘botty’. In Luis you will see an application called ‘myorg-botty’.

    • If you do provide the App Id, ServisBOT will import and update intents using the App Id you have provided.

  • Region: This is the region the Luis Application is based in.

  • NluConfidenceThresholdOverride [Optional] You can use this as an override of the returned detected intent confidence. If this value is higher than that returned from the nlu provider it will change the response to be a fallback, this value defaults to 0.

  • You can now create a secret using your Luis Authoring Key, and a luis worker using the cli or portal, using information gathered above.

Creating a Luis Secret

  • You must create a secret using the Authoring Key and Prediction Key that you got from the Luis portal mentioned in the previous sections.
  • To do this with the cli do the following:
    • sb-cli secret create-interactive.
    • Enter the name of your secret.
    • Choose secretdoc.
    • Replace the values in the following with your ones.
    • ‘{“PredictionKey”: “your-prediction-key-here”, “AuthoringKey”: “your-authoring-key-here”}’.
    • Paste this where its asking for inline json.
  • To do this using portal do the following:
    • Navigate to the Secrets Management section.
    • Click Create Secret.
    • Enter the alias for your secret.
    • Select Microsoft Luis as your Secret Type Template.
    • Paste your Authoring Key into the AuthoringKey field.
    • Paste your Prediction Key into the PredictionKey field.
    • Click save.

Creating a Luis worker through the cli

Save this json to a file and create a worker using the cli command sb-cli worker create file.json

{
  "Data": {
    "NluConfiguration": {
      "AppId": "AppId",
      "Region": "westus",
      "Secret": "SRN:::HERE",
      "NluConfidenceThresholdOverride": 0.8
    },
    "NluType": "Luis"
  },
  "Organization": "ORGANIZATION",
  "Config": {
    "Avatar": "default-bot"
  },
  "Enabled": true,
  "Updated": 1608652074324,
  "Description": "A Luis worker",
  "Id": "4685b16c-a305-4b0c-b33d-8ae12b81ff9a",
  "Type": "nlp-worker",
  "Name": "LuisWorker",
  "Created": 1608652074324,
  "Status": "published",
  "Srn": "srn:botnet:REGION:ORGANIZATION:worker:4685b16c-a305-4b0c-b33d-8ae12b81ff9a"
}

Once you have created the worker using the CLI, it will return an ID for you. You need to then update/create a bot and place the worker at the top with the id and the type of nlp-worker.

Creating a Luis worker through portal

You can create a luis worker using portal by navigating to your bot, and clicking on the resources tab.

  • Click Add Resource.
  • Click Luis Worker and then click Next.
  • Fill in the details of your Luis worker.