I was able to finally complete this, I added below stuff in actions.py after reading docs, referring this example & thanks to @marcos.allysson for this answer
from typing import Text, List
from rasa_sdk import Tracker, FormValidationAction
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.types import DomainDict
class ValidateHealthForm(FormValidationAction):
def name(self) -> Text:
return "validate_health_form"
async def required_slots(
self,
slots_mapped_in_domain: List[Text],
dispatcher: "CollectingDispatcher",
tracker: "Tracker",
domain: "DomainDict"
) -> List[Text]:
if tracker.get_slot("confirm_exercise") == True:
return ["confirm_exercise", "exercise", "sleep", "diet", "stress", "goal"]
else:
return ["confirm_exercise", "sleep", "diet", "stress", "goal"]
after this I uncommented 2 lines in endpoints.yml most likely this is for telling rasa where to send requests for checking custom actions. (correct me if i am wrong)
action_endpoint:
url: "http://localhost:5055/webhook"
finally in domain.yml file I added below stuff just before form definition.
actions:
- validate_health_form
Note : The purpose of this thread to help a beginner fumbling across internet to understand & implement things in latest rasa sdk