How to use slots
Slots are a fundamental component of dynamic intents in AIsuru. They let you extract specific information from user requests, making intents more flexible and powerful.
What is a slot
A slot is a variable that can be extracted from the user's message and passed to the intent's webhook. Slots let you create dynamic intents that can handle a variety of user inputs, making interactions more natural and contextual.
Creating a new slot
To configure a new slot, follow these steps:
Go to the "Functions" > "Dynamic intents" section of your Agent;
Select the "Slots" tab and click "New slot";
Fill in the required fields:
Name: assign an identifying name to the slot;
Fixed values: add the preset values the slot can take; use the "Add value" button to enter multiple options;
Webhook: enter the URL of the external service that will handle this slot;
Validity (minutes): define how long the slot's response should be cached; if not specified, the response won't be cached;
Use the TEST button to make sure it works correctly.
Using slots in invocations
Slots let you extract specific information from user requests. To use slots in invocations:
Define the slots in the intent configuration;
Use curly braces {} to indicate where to extract the slot value in the invocation phrases, and put the slot name inside the curly braces.
Examples of slots in an invocation:
"What's the weather in {city}?"
"Book a flight from {departure_city} to {arrival_city} for {date}"
When a user asks something like "What's the weather in London?", AIsuru will recognize the intent and extract "London" as the value of the "city" slot.
Multiple slots
You can use multiple slots in a single invocation. For example: "Book a table for {number_of_people} people on {date} at {time}"
In this case, AIsuru would extract values for three different slots: number_of_people, date, and time.
Handling missing slots
If a required slot is not provided by the user, AIsuru can be configured to explicitly ask for the missing information. For example:
User: "What's the weather?";
AIsuru: "Which city would you like the weather for?";
User: "London";
AIsuru: [proceeds with the intent using "London" as the value for the "city" slot].
Validating slot values
You can implement validation logic in the webhook to make sure slot values are correct and usable. For example:
Checking that a date is in the correct format and in the future;
Verifying that a number of people is reasonable for a reservation;
Validating that a city is present in the weather service's database.
Best practices for using slots
Use descriptive, consistent slot names throughout your Agent;
Make sure invocations cover various ways users might phrase their requests;
Test invocations with different inputs to ensure slots are extracted correctly;
Provide clear descriptions for each slot to make maintenance and understanding easier over time;
Implement fallback logic in your webhook to handle cases where slot values are invalid or missing.
Advanced slot usage examples
Slots with default values: Configure slots with default values for cases where the user doesn't specify information. For example, a "date" slot might default to today's date;
Chained slots: Create intents that use information from previous slots to contextualize subsequent requests. For example, after asking about the weather for a city, the Agent could remember the city for follow-up questions about the same location.
Using slots effectively can make your dynamic intents more powerful and flexible, letting you create more natural and contextual conversational experiences for your users. Slots allow your Agent to adapt to a wide range of user inputs, improving its ability to understand and respond to requests accurately and relevantly.
Last updated