Hello everyone, I’m new rasa and I’m trying to learn it step by step and eventually use it for a school project, any help would be very appreciated I will explain my issue and provide my code below, have a great read!
I have implemented these stories in stories.yml:
version: "3.1"
stories:
- story: Interview
steps:
- intent: greet
- action: utter_greet
- action: utter_ready_check
- intent: candidate_ready
- action: utter_company_pres_po
- action: utter_any_questions
- checkpoint: utter_any_questions
- story: User has followup questions
steps:
- checkpoint: utter_any_questions
- intent: affirm
- action: utter_hr_follow_up
- intent: candidate_question
- action: utter_noted
- action: action_select_random_story
- slot_was_set:
- active_conversation_story
- story: User does not have any followup questions
steps:
- checkpoint: utter_any_questions
- intent: deny
- action: action_select_random_story
- slot_was_set:
- active_conversation_story
- story: shared_questions_1
steps:
- action: utter_pres_question1
- intent: pres_answer1
- action: utter_feedback
- story: shared_questions_2
steps:
- action: utter_pres_question2
- intent: pres_answer2
- action: utter_feedback
and this action in actions.py:
from typing import List, Text
from rasa_sdk import Action
from rasa_sdk.events import SlotSet
import random
class ActionSelectRandomStory(Action):
def name(self) -> Text:
return "action_select_random_story"
def run(self, dispatcher, tracker, domain) -> List[SlotSet]:
# Define a list of pre-defined story names
story_names = ["shared_questions_1", "shared_questions_2"]
# Randomly select a story name from the list
selected_story_name = random.choice(story_names)
# Set the selected story as the active conversation story
return [SlotSet("active_conversation_story", selected_story_name)]
domain.yml:
actions:
- action_select_random_story
slots:
active_conversation_story:
type: text
mappings:
- type: from_entity
entity: active_conversation_story
What I want to achieve is to have the a random story running from the 2 stories defined in stories.yml (shared_questions_1, shared_questions_2). One of the stories should be triggered after one of these intents “deny” in the story " User does not have any followup questions" or “candidate_question” in the story " User has followup questions". This not running as expected, Whenever I run rasa shell the bot reachs “deny” or “User does not have any followup questions” and doesn’t go through any of the stories, it just stops there