Custom Action registered, but not being called - Rasa CALM - Rasa Community Forum
👋 Introducing the Rasa Playground
Custom Action registered, but not being called
post by jlciii on Jan 9, 2025
I’ve started creating a Custom Action for managing survey ratings, and I can see that the custom_class.py is getting registered in the action server, but it never seems to get called. I think my slot definition points to it, but it’s acting like it never decides to call.
class SetRating(Action):
def name(self) -> str:
print("set_rating.name ENTERED")
return "set_rating"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker, domain: Dict[str, Any]):
print("set_rating ENTERED")
print("dispatcher:", dispatcher)
print("tracker:", tracker)
print("domain:", domain)
# account = get_account(tracker.sender_id)
print("set_rating LEAVING")
return [SlotSet("survey_question_applying_ai_in_organization", "3")]
and the slot is defined as:
slots:
survey_question_understanding_genai:
type: float
min_value: 1
max_value: 5
initial_value: null
influence_conversation: false
mappings:
- type: custom
action: set_rating
actions:
- set_rating
responses:
utter_ask_survey_question_understanding_genai:
- text: "On a scale of 1 to 5, how much do YOU AGREE that Understanding GenAI is important to you in your work? (1=Strongly Disagree, 5=Strongly Agree)"
and my endpoints are configured:
action_endpoint:
url: "http://localhost:5055/webhook"
The response after the utterance should call the custom action, right? I see the "
set_rating.name ENTERED
```getting
## post by camattin on Jan 10, 2025
Hi John, is this in an NLU + LLM CALM bot, or LLM-only?
Can you share your flow where you’re attempting to gather the feedback?
## post by jlciii on Jan 16, 2025
Thanks Chris. I just noticed your response yesterday, but unfortunately have gotten rid of all of the code, and replaced it with “type: from_llm” code that doesn’t require custom gatherers. The stuff I was writing was all CALM bot, but I may have been building it on top of the demo code that was goes both ways.
When I reported the original question, I was assuming that I could simply set my slots with
```yaml
survey_question_metrics_in_government:
type: float
influence_conversation: false
mappings:
- type: custom
action: set_rating
and then when the “collect” for that slot was stepped to in the following flow:
flows:
collect_survey_results:
description: Get student feedback to a course survey.
steps:
- action: utter_survey_start
- collect: survey_question_metrics_in_government
- collect: survey_question_behavioral_insights
- collect: survey_question_rate_general_knowledge
- collect: survey_question_what_tools_techniques_buzzwords
- collect: survey_question_how_you_use_gen_ai_now
- action: utter_survey_complete
that it would automatically call set_rating.py. But it didn’t do that, and I didn’t get it working.
However, my from_llm version of the collect is doing what I need right now, so I’m probably OK.