Circuit breaker tripped in form action when using dynamic values from database

Similar to the issue described here my bot is running a form and asking questions with buttons retrieved from an external datasource for a subset of the required slots.

As noted in the linked post, I’ve overloaded the request_next_slot method in the service_form and interactive training goes as planned; however, when the bot runs it loops through the action associated with the first slot using custom buttons 10x (thus tripping the circuit breaker before finally returning the response with buttons and waits for the user button input (action_listen).

After all entities are filled it loops through the list of entities set by buttons from user input once more before completing the story successfully.

I’ve tried this with a mostly bare stories file and get the same results.

Referring to the overloaded function below; is this done correctly?

    def request_next_slot(
        dispatcher,  # type: CollectingDispatcher
        tracker,  # type: Tracker
        domain,  # type: Dict[Text, Any]
        # type: … -> Optional[List[Dict]]
        """Request the next slot and utter template if needed,
            else return None"""

        for slot in self.required_slots(tracker):
            if self._should_request_slot(tracker, slot):
                logger.debug("Request next slot '{}'".format(slot))
                if slot == "service":
                    return[SlotSet(REQUESTED_SLOT, slot), FollowupAction("action_button_service")]
                elif slot == "host":
                    return[SlotSet(REQUESTED_SLOT, slot), FollowupAction("action_button_host")]
                    return [SlotSet(REQUESTED_SLOT, slot)]

        # no more required slots to fill
        return None

Hi @mkoser,

what are the actions action_button_service and action_button_host doing? Could you directly execute them as part of request_next_slot?

Hey @Tobias_Wochinger,

Those actions query an external datasource and present the result as button choices. I was reluctant to move the calling of those actions to the FormAction class as I like to keep any decision making logic outside of the action file, but after retraining that seems to have done the trick.

Thanks for your help!

Can you post you working code? i seems to have the same issue

1 Like