Reputation: 285
I'm trying to build a bot with rasa. At the very beginning of the conversation it should fill some slots with data from the database.
I have a custom action:
class ActionFillSlots(Action):
def name(self) -> Text:
return "action_fill_slots"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
example = "example"
return [SlotSet("example", example)]
And in my domain.yml file i have set the slot like this:
slots:
example:
type: text
And a response like:
utter_greet:
- text: "Show { example }"
And in my stories.yml file, i have stories like:
- story: greet happy path
steps:
- intent: greet
- action: action_fill_slots
- action: utter_greet
If I run the bot with rasa shell --debug
and then type something that matches the greeting intent, i get the following error:
Failed to fill utterance template 'Show { example }' Tried to replace ' example ' but could not find a valu e for it. There is no slot with this name nor did you pass the value explicitly when calling the template. Return template without filling the template.
In my debug window I can see, that the slot has been set by the action:
Current slot values: example: example
I'm using rasa 2.1.0
Upvotes: 1
Views: 2491
Reputation: 71
Does this help? let me know
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
class ActionFillSlots(Action):
def name(self) -> Text:
return "action_fill_slots"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
example = tracker.get_slot(example)
dispatcher.utter_message(text = str(example))
return []
Upvotes: 0