Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Slot filling enables your agent to intelligently gather information from user queries by using entities—special data types that recognize and extract specific pieces of information.
What is slot filling?
Instead of asking users multiple questions sequentially, slot filling lets your agent identify relevant information in their initial message and skip unnecessary questions.
An agent typically needs several pieces of information from a user to do its job. To acquire this information, you would typically ask separate questions, one for each fact the agent needs. When you use entities in your questions, Copilot Studio detects the required information and skips the questions where the information could be identified in the triggering user query.
For example, when a user asks: "I'd like to order 3 large blue t-shirts."
Copilot Studio Natural Language Understanding (NLU) immediately understands:
- Topic is Order
- Quantity is 3
- Color is Blue
- Item Type is T-Shirt
The agent can then skip unnecessary questions. If some pieces of information are missing, for example Size, it asks the unanswered questions before moving forward. Slot filling lets your agent acquire and use information more easily and reduces the number of questions you need to ask.
First, define which entities you want to use and their types.
Defining entities
Copilot Studio provides several built-in entities for the most common use cases, such as Email, Date and time, Person name, Phone number, Color, Country, City, Number, Money, and more.
Built-in entities are powerful because they can handle many variations of the form a piece of information can take. For example, when using Money in a conversation, the user might specify a value as "$100," "a hundred dollars," or "100 dollars." The NLU model in Copilot Studio figures out that the value is a monetary value of 100 dollars.
Tip
However values are entered, as long as they're requested with questions in your conversation flow, they're stored in variables that you can reuse.
You can also define your own custom entities, such as Item Type from the previous example. Custom entities can be one of two types:
- Closed list: For a predefined list of values.
- Regular expressions (RegEx): For information matching a specific pattern. RegEx is ideal when you need to capture data that always follows the same format (for example, INC000001 for a ticket number).
Improving the user experience
Entities help Copilot Studio gather and store information from user queries, then make that information available later in the conversation. Entities improve the user experience—they make your agent seem smarter. Use them whenever possible.
Entity best practices
When using entities, consider the following best practices to improve the accuracy of information extraction and the overall user experience.
Use synonyms
You can add synonyms to closed list entities values to manually expand the matching logic for each item in the entity's list. For example, in the "hiking" item, you can add "trekking" and "mountaineering" as synonyms.
Using synonyms can help topic triggering, as they increase the weight of a trigger phrase by adding related words as synonyms of an entity it contains. For example, for a "Complaint" option, add similar negative words or phrases as synonyms.
The NLU model generalizes on all entity variations (that is, all values and their synonyms) in case a topic trigger phrase includes at least one variation of this entity. It's good practice to include one example of a trigger phrase with one usage of this entity for the NLU to generalize on other entity variations.
Enable Smart Matching
For each closed list entity, you can also enable Smart Matching.
Smart Matching is part of the intelligence supported by the agent's NLU model. With this option enabled, the agent interprets the user's input using fuzzy logic, based on the listed items in the entity.
The agent automatically corrects misspellings and expands its matching logic semantically. For example, the agent can automatically match "softball" to "baseball".
Be creative with regular expressions
Sometimes, entity extraction from a user query can lead to confusion for the NLU model, especially when several entities of the same type are present in the user query.
For example, if a user says: "Can you bring 2 towels and 1 pillow to room 101?"
The built-in Number entity causes confusion between 2, 1, and 101. To work around this confusion, define the following regular expression entities:
- Towel Quantity: [1-9] towel
- Pillow Quantity: [1-9] pillow
- Room Number: [0-9]{3}
Alternatives to entities to store referential data
For large or evolving datasets (such as a list of products or customers), instead of using Copilot Studio closed list entities, consider checking external sources. You need to pass the user utterance to the external service by using a Power Automate cloud flow. Your topic logic can then validate the accuracy of the result (or ask the user to validate it) before moving forward in the conversation.
Dataverse is a good candidate to store such data, as it has a built-in Dataverse search capability that supports fuzzy matching to return the best results along with a confidence score. Even when searching a full sentence, it can retrieve potential matches.
Tip
Review a sample implementation in Return a list of results.