Version: Latest

Flow Builder — Collect information

The "Collect information" step lets your assistant ask a question, usually to obtain information from the user. For example, if a user wants to make a money transfer, the assistant might ask for the recipient. This will populate the "recipient" memory slot, making it available to be used in the next steps and future conversation.

image

Ask

  1. Once you've set up the Collect Information step, instruct the assistant what information it should collect in the "Description" field. We recommend to standardise these prompts format across your assistant to optimise its performance.

    image
  2. You'll also need to define what piece of information the assistant should collect from the user's reply. To do this, create a new slot.

    image
  3. Name your slot descriptively: choose names that clearly indicate the information you aim to gather. To manage slots more effectively, we recommend to differentiate between those used in specific flows and those used universally. If a slot is meant only for a specific flow, you can prefix the slot name with the flow's name. For global, universally used slots, you can use the prefix global_. Always check if a slot already exists before creating a new one to avoid duplication.

    image
  4. Choose the type of the slot and don't forget to click "Save". Read more about slot types.

    image
  5. Finally, generate a message that the assistant will use to collect this information from the user. To do so, click "Create message" in "How to collect" section.

    image
  6. The name will automatically be pre-filled as utter_ask_{slot name}. All you need to do is enter the message text below.

    image
  7. Optionally, you can add buttons to allow the user to select an answer more quickly and present user with structured choices. This is particularly helpful for complex tasks or when the assistant needs specific information to proceed. Learn more about buttons

    image
  8. Instead of using a message for the collect step, you can use a custom action. This is useful if, for example, you want to display available slot values fetched from a database as buttons. The custom action must follow a specific naming convention and be called action_ask_{slot_name}, which is why the name will be pre-filled. Make sure to add this custom action to your domain file outside of Studio.

    image
  9. By default, a "Collect Information" step can be skipped if the slot is already filled. For instance, if a user says "I want to transfer money to John," the assistant will already know the recipient's name and won't need to ask this question to fill the slot. If you prefer the assistant to always ask the question, regardless of whether the slot is already filled, enable the "Ask before filling" option.

    image
  10. By default, the "Reset slot value" option is turned on. This means the value of the slot will be reset after the flow reaches one of its final steps. When a slot is reset, its value is cleared, and the corresponding question will be asked again the next time it's triggered. This feature is particularly useful for slots that usually have different values in separate sessions, such as transfer_amount, recipient_name, or mood. If you disable this option, the slot value will remain once set, and the question will be skipped if "Ask before filling" is turned off.

    image

Validate

This is optional but sometimes you may want to validate a slot to ensure the user has provided the correct information before proceeding to the next step in the dialogue.

  1. To do this, go to the Validate tab of Collect information step.

    image
  2. Prevent user from going to the next step if certain conditions are not met.

    image
  3. Select an existing validation message or click "Create validation message" to create a new validation message. If the user's answer deviates from these values, a validation message will be displayed to them.

    image
  4. In the window that appears, specify the text for this message, and then click "Save."

    image
  5. You can edit or delete previously created validation messages by clicking on the drop-down menu and choosing the "Manage validation messages" option. The process is exactly the same as working with a regular message.

    image

Slots

Slots are your assistant's memory. They act as a key-value store which can be used to store information the user provided (e.g. their home city) as well as information gathered about the outside world (e.g. the result of a database query).

Slot types

Text

A text slot is used to store textual information such as names of countries, cities, or personal names. It's designed to hold various types of alphanumeric characters, making it suitable for a wide range of textual data.

Boolean

A boolean slot is designed to store binary information, representing either a true or false value. It's commonly used for yes/no questions or scenarios where only two opposing options exist, like true/false statements.

Categorical

A categorical slot is used to store data that can take on one of a specific set of values. It's well-suited for scenarios where data can be classified into distinct categories, like labels such as low, medium, or high to describe levels of something.

Float

A float slot is employed for storing numerical values that can have decimal points. It's suitable for handling continuous numeric data, such as age, temperature, or monetary amounts involving fractions.

Any

An any slot is capable of storing a wide variety of data types without any specific constraints. It's a flexible option for cases where the data type might vary or is not well-defined in advance, allowing you to store arbitrary values with diverse characteristics.

Buttons

You can make your assistant even more interactive by adding buttons to the messages in the Collect Information step. Instead of making users type, they can simply click on buttons to give their answers.

image

Button properties

Each button has two important parts:

  • Title: This is the text your users will see on the button.

  • Payload: Think of this as a behind-the-scenes command the assistant uses when the button is clicked. You don’t have to fill it in unless you want to give your assistant extra instructions like skipping LLM calls and going straight to a specific command, intent, or entity.

    image

How to add buttons

  1. Click "Add buttons" in your Collect Information message.

    image
  2. Enter a title for your button. This is the text that will appear on the button for users to click.

    image
  3. Optional: If you want the button to bypass the LLM, choose a payload. Here are the types of things you can set it to do:

    • Intent — triggers an intent.
    • Intent and entity — passes entities along with the intent.
    • Set slot — sends commands to set or reset slot values.
    • Text — sends a predefined free-form text to the assistant. This should only be used if none of the above options apply.
    • If you leave the field empty, it will automatically be pre-filled with the same text as the title.
    image
  4. Click "Add another button" to add as many buttons as needed.

    image

Advanced configuration: Slot mappings

Slot mappings are advanced settings that define how slot values should be extracted. Rasa provides five predefined mappings to fill slots based on the latest user message.

From LLM

By default, the slot value is extracted from the user's message using an LLM, which interprets the message and fills the slot accordingly. The prompt includes descriptions and slot definitions from each flow as relevant information. However, if your assistant includes NLU components (intents and entities), you might consider using alternative extraction methods.

image

From text

This mapping type uses the text of the last user message to fill the slot. Optionally it can be configured with the following parameters:

  • Intent — Only applies the mapping when this intent is predicted.

  • Intent is not — Excludes the mapping when this intent is predicted.

  • Active flows — Restricts the mapping to certain flows, selectable in this field.

image

From entity

This mapping type fills slots based on extracted entities. The following parameters are required:

  • Entity — The entity used to fill the slot.

Optional parameters to specify the application of the mapping include:

  • Intent — Applies only when this intent is predicted.

  • Intent is not — Excludes the mapping when this intent is predicted.

  • Role — Applies only if the extracted entity has this specified role.

  • Active flows — Restricts the mapping to certain flows, selectable in this field.

image

From intent

This mapping fills a slot with a specified value if the user's intent matches. If no intent is specified, the slot fills regardless, unless the intent matches those listed under "Intent is not."

Required parameter:

  • Value — The value to fill the slot.

Optional parameters include:

  • Intent — Applies the mapping only when this intent is predicted.

  • Intent is not — Excludes the mapping when this intent is predicted.

  • Active flows — Restricts the mapping to certain flows, selectable in this field.

image

From custom action

Use the "From custom action" mapping type for slots that need to be filled by a specified custom action. This action must be detailed in the "Custom action" field of the slot mapping.

image

In case you use multiple mappings for one slot, they will be prioritized in the order they are listed. The first slot mapping found to apply will be used to fill the slot.

Recommendation on combining slot mapping types

A slot cannot have both "From LLM" and NLU-based predefined mappings or mappings from custom actions simultaneously. If you set a slot to use the "From LLM" mapping, you must not define any other types of mappings for that slot.

Learn more about slot mappings