How to query the prediction runtime with user text

Important

LUIS will be retired on October 1st 2025 and starting April 1st 2023 you will not be able to create new LUIS resources. We recommend migrating your LUIS applications to conversational language understanding to benefit from continued product support and multilingual capabilities.

To understand what a LUIS prediction endpoint returns, view a prediction result in a web browser.

Prerequisites

In order to query a public app, you need:

  • Your Language Understanding (LUIS) resource information:
    • Prediction key - which can be obtained from LUIS Portal. If you do not already have a subscription to create a key, you can register for a free account.
    • Prediction endpoint subdomain - the subdomain is also the name of your LUIS resource.
  • A LUIS app ID - use the public IoT app ID of df67dcdb-c37d-46af-88e1-8b97951ca1c2. The user query used in the quickstart code is specific to that app. This app should work with any prediction resource other than the Europe or Australia regions, since it uses "westus" as the authoring region.

Use the browser to see predictions

  1. Open a web browser.

  2. Use the complete URLs below, replacing YOUR-KEY with your own LUIS Prediction key. The requests are GET requests and include the authorization, with your LUIS Prediction key, as a query string parameter.

    The format of the V3 URL for a GET endpoint (by slots) request is:

    https://YOUR-LUIS-ENDPOINT-SUBDOMAIN.api.cognitive.microsoft.com/luis/prediction/v3.0/apps/df67dcdb-c37d-46af-88e1-8b97951ca1c2/slots/production/predict?query=turn on all lights&subscription-key=YOUR-LUIS-PREDICTION-KEY

  3. Paste the URL into a browser window and press Enter. The browser displays a JSON result that indicates that LUIS detects the HomeAutomation.TurnOn intent as the top intent and the HomeAutomation.Operation entity with the value on.

    {
        "query": "turn on all lights",
        "prediction": {
            "topIntent": "HomeAutomation.TurnOn",
            "intents": {
                "HomeAutomation.TurnOn": {
                    "score": 0.5375382
                }
            },
            "entities": {
                "HomeAutomation.Operation": [
                    "on"
                ]
            }
        }
    }
    
  4. To see all the intents, add the appropriate query string parameter.

    Add show-all-intents=true to the end of the querystring to show all intents, and verbose=true to return all detailed information for entities.

    https://YOUR-LUIS-ENDPOINT-SUBDOMAIN.api.cognitive.microsoft.com/luis/prediction/v3.0/apps/df67dcdb-c37d-46af-88e1-8b97951ca1c2/slots/production/predict?query=turn on all lights&subscription-key=YOUR-LUIS-PREDICTION-KEY&show-all-intents=true&verbose=true

    {
        "query": "turn off the living room light",
        "prediction": {
            "topIntent": "HomeAutomation.TurnOn",
            "intents": {
                "HomeAutomation.TurnOn": {
                    "score": 0.5375382
                },
                "None": {
                    "score": 0.08687421
                },
                "HomeAutomation.TurnOff": {
                    "score": 0.0207554
                }
            },
            "entities": {
                "HomeAutomation.Operation": [
                    "on"
                ]
            }
        }
    }
    

Next steps