from typing import Any, Text, Dict, List
from rasa_sdk.events import SlotSet, EventType
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
class ActionHelloWorld(Action):
def name(self) -> Text:
return "action_date"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
# date = tracker.get_slot("time")
date = next(tracker.get_latest_entity_values("time"), None)
dispatcher.utter_message("utter_ask_time", tracker, timer=date)
return []
Getting following error for custom action for above code, any help would be appreciated
While executing rasa run actions-
Traceback (most recent call last):
File "handle_request", line 83, in handle_request
)
File "/home/anushkas/.local/lib/python3.8/site-packages/rasa_sdk/endpoint.py", line 114, in webhook
return response.json(result, status=200)
File "/home/anushkas/.local/lib/python3.8/site-packages/sanic/response.py", line 217, in json
dumps(body, **kwargs),
TypeError: <rasa_sdk.interfaces.Tracker object at 0x7f19400203d0> is not JSON serializable
In rasa shell-
Traceback (most recent call last):
File "/home/anushkas/.local/lib/python3.8/site-packages/rasa/core/processor.py", line 874, in _run_action
events = await action.run(
File "/home/anushkas/.local/lib/python3.8/site-packages/rasa/core/actions/action.py", line 765, in run
raise RasaException(
rasa.shared.exceptions.RasaException: Failed to execute custom action 'action_date'