A multi-turn conversation is a type of conversation where an AI needs to ask follow-up questions to clearly understand the user’s intent. For instance, if a user says, “Book me a flight,” the AI might need to ask, “Where are you flying to?” or “When do you plan to travel?” Such conversations occur in multi-turns as the bot needs additional information for comprehension.
Implementation Using Language Understanding (LUIS)
Azure AI utilizes Language Understanding (LUIS) to understand user commands or queries effectively. Here are the steps to create a multi-turn conversation using LUIS:
- Define Entities: The first step is to define entities that represent the critical data that the bot should extract from the user’s utterances. In the case of booking a flight, these might include `Destination` and `DepartureDate`.
- Define Intents: The next step is to define the user’s intentions, represented by a specific action that the user wants the AI to perform. In our example, the significant intent could be `BookFlight`.
- Create Dialogues: Now you need to create dialogues that deploy these entities and intents. LUIS can then use these dialogues to understand the user’s intentions and extract entity data.
- Train Model: Finally, train the model to understand the intents and entities and communicate with the user accurately.
Once you’ve created, trained, and published your application, you can use it in a multi-turn conversation, as depicted in the following table:
User | Bot |
---|---|
Book me a flight | To which destination are you planning to travel? |
New York | When do you wish to depart? |
10th June | Confirmed. You’ve booked a flight to New York on 10th June. |
Implementation Using QnA Maker
QnA Maker is another path you can take in Azure to develop multi-turn conversations. QnA Maker simplifies the creation, training, and implementation process of a question and answering bot. Here are the steps to create a multi-turn conversation using QnA Maker:
- Creating a QnA Service: Use the Azure portal to create a new QnA Maker service.
- Preparing Your Content: You should have a hierarchical .txt or .tsv file or a fresh URL. It can help your bot to answer user questions contextually.
- Creating a Knowledge Base: With your QnA service and content ready, you can create a knowledge base. This base will serve as the core of the bot’s knowledge.
- Training Your Knowledge Base: As with the LUIS example, you must train your knowledge base.
The QnA maker can handle a multi-turn conversation as follows:
User | Bot |
---|---|
How do I reset my password? | Are you using a Windows or a Mac system? |
Windows | On your Windows system, go to the control panel and click on the ‘Reset Password’ option. |
To conclude, developing a multi-turn conversation in Azure AI involves a series of steps that rely heavily on relevant user data. When adequately implemented, it can immensely improve user interaction. They are a key concept in the AI-102 Designing and Implementing a Microsoft Azure AI Solution exam and the AI applications today as they significantly enhance user experience through context-oriented conversations.
Practice Test
True or False: The P-turns in a multi-turn conversation setup indicate user’s turn
- 1) True
- 2) False
Answer: True
Explanation: P-turns stand for ‘participant turns’ and indicate the user’s turn in the interaction.
A multi-turn conversation in AI requires:
- 1) Exception Handling
- 2) Entity Recognition
- 3) Both of the above
- 4) None of the above
Answer: Both of the above
Explanation: Exception Handling and Entity Recognition are vital in a multi-turn conversation for ensuring smooth and contextually accurate interactions.
The Bot Framework Composer is used to create:
- 1) Single-Turn Conversations
- 2) Multi-Turn Conversations
- 3) Both
- 4) None of the Above
Answer: Multi-Turn Conversations
Explanation: The Bot Framework Composer allows developers to design and build sophisticated conversations, including multi-turn interactions.
True or False: The first turn in a multi-turn conversation must be initiated by the bot.
- 1) True
- 2) False
Answer: False
Explanation: The first turn in a multi-turn conversation can be initiated by either the bot or the user.
Which components effectively handle errors in a multi-turn conversation?
- 1) Bot Framework
- 2) Language Understanding (LUIS)
- 3) Adaptive Dialogs
- 4) Both Bot Framework and Adaptive Dialogs
Answer: Both Bot Framework and Adaptive Dialogs
Explanation: Both the Bot Framework and Adaptive Dialogs have mechanisms to effectively handle errors and exceptions in a conversation.
True or False: Microsoft Azure AI doesn’t provide tools for designing and implementing a multi-turn conversation.
- 1) True
- 2) False
Answer: False
Explanation: Microsoft Azure AI provides various tools such as LUIS, QnA Maker, and the Bot Framework Composer to assist in designing and implementing multi-turn conversations.
In a multi-turn conversation, keeping track of the conversation history is:
- 1) Unnecessary
- 2) Crucial
- 3) Helpful, but not required
- 4) None of the above
Answer: Crucial
Explanation: Keeping track of the conversation history allows the bot to maintain context, understand the user’s intent, and provide relevant responses.
True or False: Confirmation and elaboration are unnecessary in multi-turn conversations.
- 1) True
- 2) False
Answer: False
Explanation: Confirmation and elaboration are key aspects of multi-turn conversations that ensure the bot correctly understands and executes the user’s wishes.
A dialog in a multi-turn conversation :
- 1) Seeks and confirms user’s intent
- 2) Handles errors
- 3) Both the above
- 4) None of the above
Answer: Both the above
Explanation: A dialog in a multi-turn conversation both seeks and confirms user’s intent and handles any errors in understanding or execution.
True or False: The QnA Maker is not suitable for creating multi-turn conversations.
- 1) True
- 2) False
Answer: False
Explanation: The QnA Maker can be used to create simple multi-turn conversations by structuring the question and answer contents.
Single turn and multi-turn conversations can be differentiated by:
- 1) Complexity
- 2) Length of Interaction
- 3) Depth of Context
- 4) All of the above
Answer: All of the above
Explanation: Single-turn conversations are typically simpler, shorter, and lack the depth of context that characterizes multi-turn conversations.
True or False: In multi-turn conversations, inputs from users are rigid and limited.
- 1) True
- 2) False
Answer: False
Explanation: In multi-turn conversations, users can provide a variety of inputs, and responses can be adapted and contextualized based on these inputs.
In a multi-turn conversation, forgetting past exchanges leads to:
- 1) Loss of Context
- 2) Failed Understanding
- 3) Better User Experience
- 4) Both Loss of Context and Failed Understanding
Answer: Both Loss of Context and Failed Understanding
Explanation: Remembering past exchanges is crucial in multi-turn conversations to maintain the context and ensure proper understanding of user input.
True or False: All multi-turn conversations need exception handling.
- 1) True
- 2) False
Answer: True
Explanation: Exception handling is crucial in multi-turn conversations to handle unexpected user inputs or situations where the bot fails to understand the user.
Exception handling in a multi-turn conversation is implemented using:
- 1) LUIS
- 2) Bot Framework Composer
- 3) Adaptive Dialogs
- 4) All of the above
Answer: All of the above
Explanation: LUIS, Bot Framework Composer, and Adaptive Dialogs all provide mechanisms to implement exception handling in multi-turn conversations.
Interview Questions
What is a multi-turn conversation and where it is used in Azure AI Solution?
A multi-turn conversation allows a bot to maintain a contextual interaction with a user across multiple dialog turns. Within Azure AI, these are used with the Bot Framework to improve user interaction when it comes to deploying complex tasks or inquiries.
How are Azure Bot Service and the Bot Framework SDK used to create multi-turn conversations?
Azure Bot Service and the Bot Framework SDK provide libraries, services, templates, and connectors that developers use to establish and manage the dialog flow in a conversation, including enabling multi-turn conversations.
What is the purpose of QnA Maker in the context of multi-turn conversations?
QnA Maker allows developers to build, train and publish a simple question-and-answer bot based on FAQ URLs, structured documents, and other data sources. By using this, a bot can be enabled to ask for more details or clarify the user’s question, creating a multi-turn conversation.
What function does LUIS (Language Understanding Intelligent Service) serve in shaping the multi-turn conversation?
LUIS helps in understanding what users want to do (their intent) based on their input, as part of a conversation. It plays a crucial role in implementing multi-turn conversation by understanding context and extracting relevant information.
What is a dialog within a multi-turn conversation in terms of Azure bot services?
A dialog is a conversation flow which includes a series of interactions between the bot and the user. This serves as the mechanism to manage multi-turn conversations in a bot application.
Can you name a few examples of dialog libraries in Bot Framework SDK for implementing multi-turn conversation?
Bot Framework SDK includes .NET, Java, JavaScript, and Python dialog libraries to manage multi-turn conversations.
How is the multi-turn dialog usually structured in Bot Framework SDK?
Multi-turn dialog in Bot Framework SDK are usually structured via a stack system where dialogs are stacked on each other as they are opened and popped off the stack as they close.
What role does ‘WaterfallDialog’ play in a multi-turn conversation?
WaterfallDialog in the Bot Framework SDK helps to define a sequence of steps to execute in order which is very useful for implementing multi-turn conversations.
What is the purpose of ‘ComponentDialog’?
The ComponentDialog class in Bot Framework SDK is useful to manage and encapsulate multiple related dialogs in implementing more complex multi-turn conversations.
How does ‘PromptDialog’ help during a conversation?
PromptDialogs are used to ask the user for information. They automatically re-prompt the user if they provide invalid input, simplifying the process for developers when managing multi-turn conversations.
What role does a ‘turn’ play in multi-turn conversations?
A ‘turn’ consists of the user’s incoming activity and any corresponding responses from the bot. It is the base of the multi-turn conversation, as the conversation is modelled as a turn-based process between user and bot.
Can Adaptive Dialogs be used while creating multi-turn Conversations?
Yes, Adaptive Dialogs offer a flexible approach that can manage conversational flow and context adjustments within Cloud and AI applications. This allows bots to switch the course of the conversation dynamically, aiding in effective multi-turn conversations.
How does a ‘TurnContext’ object support the multi-turn conversation development process?
The ‘TurnContext’ object carries all the data for an individual turn in the conversation. It helps developers to manage state and directing activities in the conversation.
What is the ‘state’ and how does it function in multi-turn conversations?
‘State’ is data that is associated with a user, a conversation or a specific user within the conversation. It functions in multi-turn conversations by preserving dialogue data and context, allowing ongoing exchanges and providing continuity over multiple user interactions.
How can multi-turn conversations be tested and refined?
Tools such as Bot Framework Emulator and Language Understanding Intelligent Service (LUIS) can be used to iteratively test, debug, and refine multi-turn conversations.