Quickstart: Use prebuilt Home automation app

In this quickstart, create a LUIS app that uses the prebuilt domain HomeAutomation for turning lights and appliances on and off. This prebuilt domain provides intents, entities, and example utterances for you. When you're finished, you'll have a LUIS endpoint running in the cloud.

Prerequisites

For this article, you need a free LUIS account, created on the LUIS portal at https://www.luis.ai.

Sign in to LUIS portal

A new user to LUIS needs to follow this procedure:

  1. Sign in to LUIS portal, select your country and agree to the terms of use.

  2. Select Create Azure resource then select Create an authoring resource to migrate your apps to.

    Choose a type of Language Understanding authoring resource

  3. Fill in the details for the resource.

    Create authoring resource

    When creating a new authoring resource, provide the following information:

    • Resource name - a custom name you choose, used as part of the URL for your authoring and prediction endpoint queries.
    • Tenant - the tenant your Azure subscription is associated with.
    • Subscription name - the subscription that will be billed for the resource.
    • Resource group - a custom resource group name you choose or create. Resource groups allow you to group Azure resources for access and management.
    • Location - the location choice is based on the resource group selection.
    • Pricing tier - the pricing tier determines the maximum transaction per second and month.
  4. A summary of the resource to be created is displayed. Select Next.

    Create authoring resource

  5. Step 3 is a confirmation. Confirm your select by selecting Continue.

    Create authoring resource

Create a new app

You can create and manage your applications on My Apps.

  1. Select Create new app.

    Screenshot of app list

  2. In the dialog box, name your application "Home Automation".

    Screenshot of Create new app pop-up dialog

  3. Choose your application culture. For this Home Automation app, choose English. Then select Done. LUIS creates the Home Automation app.

    Note

    The culture cannot be changed once the application is created.

Add prebuilt domain

Select Prebuilt domains in the left-side navigation pane. Then search for "Home". Select Add domain.

Screenshot of Home Automation domain called out in prebuilt domain menu

When the domain is successfully added, the prebuilt domain box displays a Remove domain button.

Screenshot of Home Automation domain with remove button

Intents and entities

Select Intents in the left-side navigation pane to review the HomeAutomation domain intents. Each intent has sample utterances.

Screenshot of HomeAutomation intents list]

Note

None is an intent provided by all LUIS apps. You use it to handle utterances that don't correspond to functionality your app provides.

Select the HomeAutomation.TurnOff intent. You can see that the intent contains a list of utterances that are labeled with entities.

Screenshot of HomeAutomation.TurnOff intent

Train the LUIS app

  1. In the top right side of the LUIS website, select the Train button.

    Train button

  2. Training is complete when you see the green status bar at the top of the website confirming success.

    Trained status bar

Test your app

Once you've trained your app, you can test it. Select Test in the top navigation. Type a test utterance like "Turn off the lights" into the Interactive Testing pane, and press Enter.

Turn off the lights

Check that the top scoring intent corresponds to the intent you expected for each test utterance.

In this example, Turn off the lights is correctly identified as the top scoring intent of HomeAutomation.TurnOff.

Screenshot of Test panel with utterance highlighted

Select Inspect to review more information about the prediction.

Screenshot of Test panel with utterance highlighted

Select Test again to collapse the test pane.

Publish the app to get the endpoint URL

In order to receive a LUIS prediction in a chat bot or other client application, you need to publish the app to the endpoint.

  1. Select Publish in the top right navigation.

    LUIS publish to endpoint button in top right menu

  2. Select the Production slot and the Publish button.

    LUIS publish to endpoint

  3. Publishing is complete when you see the green status bar at the top of the website confirming success.

    LUIS publish to endpoint

  4. Select the endpoints link in the green status bar to go to the Keys and endpoints page. The endpoint URLs are listed at the bottom.

Query the V2 API prediction endpoint

  1. In the Manage section (top right menu), on the Keys and endpoints page (left menu), select the endpoint URL at the bottom of the page. This action opens another browser tab with the endpoint URL in the address bar.

    The endpoint URL looks like https://<region>.api.cognitive.microsoft.com/luis/v2.0/apps/<appID>?verbose=true&subscription-key=<YOUR_KEY>&<optional-name-value-pairs>&q=<user-utterance-text>.

  2. Go to the end of the URL in the address and enter turn off the living room light, and then press Enter.

    https://<region>.api.cognitive.microsoft.com/luis/**v2.0**/apps/<appID>?subscription-key=<YOUR_KEY>&**q=<user-utterance-text>**

    The browser displays the V2 API version of the JSON response of your HTTP endpoint.

    {
      "query": "turn off the lights",
      "topScoringIntent": {
        "intent": "HomeAutomation.TurnOff",
        "score": 0.995867
      },
      "entities": [
        {
          "entity": "lights",
          "type": "HomeAutomation.DeviceType",
          "startIndex": 13,
          "endIndex": 18,
          "resolution": {
            "values": [
              "light"
            ]
          }
        }
      ]
    }
    

Clean up resources

When no longer needed, delete the LUIS app. To do so, select My apps from the top left menu. Select the ellipsis (...) to the right of the app name in the app list, select Delete. On the pop-up dialog Delete app?, select Ok.

Next steps

You can call the endpoint from code: