LUIS App Using SDK - Creating and Adding Intents and Utterances
Learn to build and consume LUIS app using Python SDK for Azure's LUIS service.
Introduction
In this lesson, we’ll build a LUIS application that will identify the city that is present in the user utterance and then check the weather for that city. We’ll use a pre-built entity to create the entity.
Dependencies
To work with this chapter and run the code snippets on your local machine, you would need the following package to be installed:
azure-cognitiveservices-language-luis
To learn how to install the packages, please visit the Appendix section.
Implementation
We’ll follow the steps mentioned below to create and consume the LUIS app:
-
Step 1: We’ll create an app in LUIS using the Python SDK’s
ApplicationCreateObject
class. -
Step 2: We’ll add one intent in the LUIS app that will contain the utterances to identify the user’s intent to check the weather of a particular city.
-
Step 3: We’ll add a pre-built entity, geographyV2. This entity will identify and extract all the geography-related text from the user utterance like country name, city name, state name, and so on.
-
Step 4: We need to add the utterances to the intent that we created in the second step.
-
Step 5: We’ll train and publish the LUIS app, which will enable us to consume the LUIS app. In the previous lesson, we used the LUIS app’s endpoint to send the user utterance to LUIS and get the response back, but in this lesson, we’ll use the Python SDK classes to consume the LUIS application.
-
Step 6: We’ll provide input for some user utterances and build a small application that will fetch the weather from Open Weather.
Now let’s start the implementation step by step.
Creating the LUIS app
As discussed, we’ll first create a LUIS app using the Python SDK’s ApplicationCreateObject
class.
Get hands-on with 1400+ tech skills courses.