Language Understanding (LUIS) Quickstart
Learn how to create, train, and query a LUIS app in minutes using the Azure portal and the REST API.
Prerequisites
- Azure subscription – Free account
- Node.js 14+ installed
- Git client
1. Create a LUIS app
Use the Azure portal to provision a LUIS resource and create an app.
- Sign in to the Azure portal.
- Search for Language Understanding and click Create.
- Fill in the required fields and click Review + create.
- After deployment, navigate to the LUIS portal and click New App.
2. Add intents and utterances
Define intents that represent the actions your bot can perform.
{
"intents": [
{ "name": "BookFlight" },
{ "name": "CancelReservation" }
],
"utterances": [
{ "text": "I want to book a flight to London", "intent": "BookFlight" },
{ "text": "Cancel my reservation", "intent": "CancelReservation" }
]
}
3. Train and publish the model
Use the LUIS portal or REST API to train and publish.
curl -X POST "https://{region}.api.cognitive.microsoft.com/luis/api/v2.0/apps/{appId}/versions/{versionId}/train" \
-H "Ocp-Apim-Subscription-Key: {subscriptionKey}"
4. Query the endpoint
Send a request with a user utterance to get the predicted intent.
const fetch = require('node-fetch');
const endpoint = 'https://{region}.api.cognitive.microsoft.com/luis/prediction/v3.0/apps/{appId}/slots/production/predict';
const query = new URLSearchParams({
'subscription-key': '{subscriptionKey}',
'verbose': true,
'query': 'I need a flight to Paris'
});
fetch(`${endpoint}?${query}`)
.then(res => res.json())
.then(data => console.log(data));
Next steps
- Integrate with Bot Framework – Bot Service docs
- Add entities for dates, locations, and numbers
- Use Active Learning to improve accuracy