question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Global Slot Mappings: Dynamic slots not considered in `_get_slot_extractions`

See original GitHub issue

Rasa Open Source version

3.0.0rc1

Rasa SDK version

3.0.0rc1

Rasa X version

No response

Python version

3.9

What operating system are you using?

OSX

What happened?

When I try to fill a dynamically requested slot a ActionExecutionRejection is raised.

To reproduce:

  1. Specify a form and a required slot
  2. Add a validate_<form_name> action to your domain
  3. Override required_slots in your FormValidationAction so that it requests a slot2 if slot1 as a certain value
  4. When Rasa Open Source asks you to fill slot2 → fill it
  5. Expected: Form is submitted since all values are filled Actual: The form rejects it’s execution as _get_slot_extractions returns an empty list. As this means we have a slot_to_validate and some_slots_were_validated==False the form rejects its execution
version: "2.0"

intents:
  - greet
  - goodbye
  - affirm
  - deny
  - mood_great
  - mood_unhappy
  - bot_challenge
  - start_form

actions:
  - validate_tobi_form

entities:
  - entity1
  - entity2
  - entity3
  - entity4
  - entity5
  - entity6

slots:
  slot1:
    type: any
    influence_conversation: false
    mappings:
    - type: from_entity
      entity: entity1
      conditions:
      - active_loop: tobi_form
        requested_slot: slot1

  slot2:
    type: any
    influence_conversation: false
    mappings:
    - type: from_entity
      entity: entity1
      conditions:
      - active_loop: tobi_form
        requested_slot: slot2

responses:
  utter_greet:
  - text: "Hey! How are you?"

  utter_cheer_up:
  - text: "Here is something to cheer you up:"
    image: "https://i.imgur.com/nGF1K8f.jpg"

  utter_did_that_help:
  - text: "Did that help you?"

  utter_happy:
  - text: "Great, carry on!"

  utter_goodbye:
  - text: "Bye"

  utter_iamabot:
  - text: "I am a bot, powered by Rasa."

  utter_ask_slot1:
  - text: "Slot 1 please"

  utter_ask_slot2:
  - text: "Slot 2 please"

  utter_ask_slot3:
  - text: "Slot 3 please"

  utter_ask_slot4:
  - text: "Slot 4 please"

  utter_ask_slot5:
  - text: "Slot 5 please"

  utter_ask_slot6:
  - text: "Slot 6 please"

  utter_submit:
  - text: "Submitted"

session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true

forms:
  tobi_form:
    required_slots:
    - slot1
from typing import Dict, Text, Any, List

from rasa_sdk import Tracker
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.forms import FormValidationAction

class TobiFormValidation(FormValidationAction):
    def name(self) -> Text:
        return "validate_tobi_form"

    async def required_slots(
        self,
        domain_slots: List[Text],
        dispatcher: "CollectingDispatcher",
        tracker: "Tracker",
        domain: "DomainDict",
    ) -> List[Text]:
        """Returns slots which the validation action should fill.

        Args:
            domain_slots: Names of slots of this form which were mapped in
                the domain.
            dispatcher: the dispatcher which is used to
                send messages back to the user.
            tracker: the conversation tracker for the current user.
            domain: the bot's domain.

        Returns:
            A list of slot names.
        """
        if tracker.slots["slot1"] == "beer":
            return domain_slots + ["slot2"]

        return domain_slots

Command / Request

No response

Relevant log output

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ancalitacommented, Nov 11, 2021

@wochinge Ok, after removing the cache, I ran rasa train and then rasa shell --debug and the slots were filled, but the form was not deactivated but rejected, as you said, and a different bot response was predicted rather than utter_submit. No exception was raised this time.

1reaction
wochingecommented, Nov 11, 2021

@ancalita I think the exception is related to something @joejuzl has discovered and is working on. Can you please try to delete the cache with rm -r .rasa and then retry validating this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow slots added dynamically to a form via ... - GitHub
Problem description: A slot with a global slot mapping that is added dynamically to a form can be set by ActionExtractSlots in rasa...
Read more >
change default mapping for dynamic form - Rasa Open Source
Hi, i am using form action to achieve the use case. for dynamic slot mapping: depending on my doc_type entity value I am...
Read more >
Slots - Vue.js
Slot content is not just limited to text. It can be any valid template content. For example, we can pass in multiple elements,...
Read more >
Slot mapping | Amplience Developer Portal
The Dynamic Content integration supports two types of SFCC content slots: global slots and category slots. A Dynamic Content slot is mapped to...
Read more >
Use named slots inside grand-child component - Stack Overflow
You may need to set this up for each slot. If you want to pass all of them along dynamically(without knowing their names),...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found