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.

Sign in to LUIS portal

A new user to LUIS needs to follow this procedure:

  1. Sign in to LUIS portal, select your country/region and agree to the terms of use. If you see My Apps instead, a LUIS resource already exists and you should skip ahead to create an app. For supported regions, visit authoring and publishing regions and the associated keys.

  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. Confirm by selecting Continue.

    Create authoring resource

Select subscription and authoring resource

In the LUIS portal, to see a list of apps or to create an app, select the subscription and authoring resource. Apps are accessed by the LUIS authoring resource.

Select authoring subscription and authoring resource

Create a new app

You can create and manage your applications on My Apps.

  1. On the My apps list, select + New app for conversation, then in the list of options, select + New app for conversation again.

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

  3. Select English as the culture.

  4. Enter an optional description.

  5. Don't select a prediction resource if you haven't already created the resource. To use your app's prediction endpoint (staging or production), you need assign a prediction resource.

  6. Select Done.

    LUIS creates the app.

    In the dialog box, name your application Home Automation

    Note

    The culture cannot be changed once the application is created.

Add prebuilt domain

  1. In the left navigation, select Prebuilt domains.

  2. Search for HomeAutomation.

  3. Select Add domain on the HomeAutomation card.

    Select 'Prebuilt domains' then search for 'HomeAutomation'. Select 'Add domain' on the HomeAutomation card.

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

Intents and entities

  1. Select Intents to review the HomeAutomation domain intents. The prebuilt domain intents have example 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.

  2. Select the HomeAutomation.TurnOff intent. The intent contains a list of example 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 status indicator on the Train button is green.

Test your app

Once you've trained your app, you can test it.

  1. Select Test from the top-right navigation.

  2. Type a test utterance like Turn off the lights into the interactive test pane, and press Enter.

    Turn off the lights
    

    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

  3. Select Inspect to view more information about the prediction.

    Screenshot of Test panel with inspection information

  4. Close 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 prediction endpoint.

  1. Select Publish in the top-right navigation.

    Screenshot of LUIS publish to endpoint button in top right menu

  2. Select the Production slot, then select Done.

    Screenshot of LUIS publish to endpoint

  3. Select the Access your endpoint URLs link in the notification to go to the Azure Resources page. The endpoint URLs are listed as the Example Query.

Query the V3 API prediction endpoint

  1. In the LUIS portal, in the Manage section (top-right menu), on the Azure Resources page (left menu), on the Prediction Resources tab, copy the Example Query at the bottom of the page.

    Paste the URL into a new browser tab.

    The URL has your app ID, key, and slot name. The V3 prediction endpoint URL looks like:

    https://YOUR-RESOURCE-NAME.api.cognitive.microsoft.com/luis/prediction/v3.0/apps/APP-ID/slots/SLOT-NAME/predict?subscription-key=YOUR-PREDICTION-KEY&<optional-name-value-pairs>&query=YOUR_QUERY_HERE

  1. In the browser address bar, for the query string, make sure the following name and value bars are in the URL. If they are not in the query string, add them:

    Name/value pair
    verbose=true
    show-all-intents=true
  2. In the browser address bar, go to the end of the URL and enter turn off the living room light for the query value, then press Enter.

    {
        "query": "turn off the living room light",
        "prediction": {
            "topIntent": "HomeAutomation.TurnOff",
            "intents": {
                "HomeAutomation.TurnOff": {
                    "score": 0.969448864
                },
                "HomeAutomation.QueryState": {
                    "score": 0.0122336326
                },
                "HomeAutomation.TurnUp": {
                    "score": 0.006547436
                },
                "HomeAutomation.TurnDown": {
                    "score": 0.0050634006
                },
                "HomeAutomation.SetDevice": {
                    "score": 0.004951761
                },
                "HomeAutomation.TurnOn": {
                    "score": 0.00312553928
                },
                "None": {
                    "score": 0.000552945654
                }
            },
            "entities": {
                "HomeAutomation.Location": [
                    "living room"
                ],
                "HomeAutomation.DeviceName": [
                    [
                        "living room light"
                    ]
                ],
                "HomeAutomation.DeviceType": [
                    [
                        "light"
                    ]
                ],
                "$instance": {
                    "HomeAutomation.Location": [
                        {
                            "type": "HomeAutomation.Location",
                            "text": "living room",
                            "startIndex": 13,
                            "length": 11,
                            "score": 0.902181149,
                            "modelTypeId": 1,
                            "modelType": "Entity Extractor",
                            "recognitionSources": [
                                "model"
                            ]
                        }
                    ],
                    "HomeAutomation.DeviceName": [
                        {
                            "type": "HomeAutomation.DeviceName",
                            "text": "living room light",
                            "startIndex": 13,
                            "length": 17,
                            "modelTypeId": 5,
                            "modelType": "List Entity Extractor",
                            "recognitionSources": [
                                "model"
                            ]
                        }
                    ],
                    "HomeAutomation.DeviceType": [
                        {
                            "type": "HomeAutomation.DeviceType",
                            "text": "light",
                            "startIndex": 25,
                            "length": 5,
                            "modelTypeId": 5,
                            "modelType": "List Entity Extractor",
                            "recognitionSources": [
                                "model"
                            ]
                        }
                    ]
                }
            }
        }
    }
    

    Learn more about the V3 prediction endpoint.

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: