Entities are similar to “type definitions” and serve as a way to define “units of information,” such as “phone numbers” or “ZIP codes.”
※ Note: This is different from Dataverse’s older terminology for tables, also called “entities.”
Entities in Copilot Studio include pre-built entities provided by the platform (e.g., ZIP codes, dates, emails, etc.). ※ Keep in mind that some entities, like ZIP codes, follow U.S. formats, which may not be suitable for agents used in other countries such as Japan.
There are also custom entities, which allow you to define your own types.
Custom Entities
There are two ways to define custom entities in Copilot Studio.
The first method, “Closed List,” is similar to a list of options. For example, defining a “Vacation” entity might look like this:
By the way, “Synonyms” refer to words with the same meaning. For example, synonyms for “Paid Leave” would look like this:
The second method is defining entities using “Regular Expressions.” For instance, creating a Japanese postal code entity (both with and without hyphens) would look like this:
Slot Filling
Slot filling is a feature that extracts information defined by an entity from a user’s message and assigns it to a variable. ※ Slot filling is typically performed using the “Ask a Question” action.
Rather than explaining it in words, it’s quicker to try it out. I created a topic called “Vacation Request Submission” within an agent with generative AI turned off.
* The official documentation on slot filling can be found here.
Sample: Building a “Vacation Request Submission Agent”
Structure
First, use the “Vacation” entity created earlier:
And use the pre-built “Date” and “Duration” entities:
Add a topic and set a suitable phrase to trigger the conversation:
Start with slot filling for “Vacation Type.” Ask the question “What type of vacation would you like to take?” and let users select an option (e.g., Paid Leave, Parental Leave). Assign the selected value to a variable (in this case, `type`).
Next, perform slot filling for the date. Ask the question “From when would you like to start?” Extract the “Date” from the user’s response and assign it to a variable (in this case, `start`).
Then, handle slot filling for the duration. Ask the question “How many days would you like to take?” Extract the “Duration” from the user’s response and assign it to a variable (in this case, `days`).
Finally, use the extracted information to send a message to the user, completing the process. ※ Ideally, this step would be followed by asking “yes or no” and using Power Automate to check “Remaining Vacation Days” or initiate a “Vacation Request Workflow” (e.g., executing an approval action). However, these steps are omitted in this sample.
Behavior Check
When you trigger the topic with a message like “I want to take a vacation,” a question about the vacation type will appear:
If you answer “Paid Leave,” questions about the date and duration entities will follow:
After answering all the questions, the extracted values from each answer will be successfully assigned to variables:
Even casual expressions like this will work for successful slot filling:
In conclusion, entities are used to define the necessary information for interactions with users, while slot filling is the process of extracting those values during the conversation.
Bonus: Custom Entities Are Managed Per Agent and Can Be Included in Solutions
Custom entities are created per agent and can be included in solutions, making them potentially usable in ALM (Application Lifecycle Management):
Update – December 30, 2024: If slot filling fails to extract information properly, consider using AI Builder prompts.
コメント