rasa icon indicating copy to clipboard operation
rasa copied to clipboard

Defining dispatcher.utter_message() in action_session_start causing issue in interactive learning

Open b-quachtran opened this issue 2 years ago β€’ 2 comments

Rasa Open Source version

3.0

Rasa SDK version

3.0

Rasa X version

No response

Python version

3.8

What operating system are you using?

Linux

What happened?

Using dispatcher.utter_message in action_session_start results in an error when running interactive learning

class ActionSessionStart(Action): """Executes at start of session"""

def name(self) -> Text: """Unique identifier of the action""" return "action_session_start"

async def run( self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any], ) -> List[EventType]: """Executes the custom action"""

  1. the session should begin with a session_started event events = [SessionStarted()]

  2. add action_listen at the end events.append(ActionExecuted("action_listen"))

dispatcher.utter_message(text="Hello there!")

return events

Command / Request

rasa interactive

Relevant log output

2022-01-21 11:45:03 INFO root - Rasa server is up and running.
 Processed story blocks: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 6/6 [00:00<00:00, 4054.43it/s, # trackers=1](#trackers=1)(#trackers=1)
 Processed rules: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 6/6 [00:00<00:00, 7043.33it/s, # trackers=1](#trackers=1)(#trackers=1)
 [2022-01-21 11:45:03 -0500] [56064] [ERROR] Exception occurred while handling uri: 'http://localhost:5005/conversations/7107bd6567054e92812e7eec81c0a591/tracker?include_events=ALL'
 Traceback (most recent call last):
 File "/Users/chris/miniforge3/envs/rasa/lib/python3.8/site-packages/sanic/app.py", line 770, in handle_request
 response = await response
 File "/Users/chris/miniforge3/envs/rasa/lib/python3.8/site-packages/rasa/server.py", line 254, in decorated
 return await result if isawaitable(result) else result
 File "/Users/chris/miniforge3/envs/rasa/lib/python3.8/site-packages/rasa/server.py", line 703, in retrieve_tracker
 tracker = await app.agent.processor.fetch_tracker_with_initial_session(
 File "/Users/chris/miniforge3/envs/rasa/lib/python3.8/site-packages/rasa/core/processor.py", line 322, in fetch_tracker_with_initial_session
 await self._update_tracker_session(tracker, output_channel, metadata)
 File "/Users/chris/miniforge3/envs/rasa/lib/python3.8/site-packages/rasa/core/processor.py", line 267, in _update_tracker_session
 await self._run_action(
 File "/Users/chris/miniforge3/envs/rasa/lib/python3.8/site-packages/rasa/core/processor.py", line 894, in _run_action
 await self.execute_side_effects(events, tracker, output_channel)
 File "/Users/chris/miniforge3/envs/rasa/lib/python3.8/site-packages/rasa/core/processor.py", line 795, in execute_side_effects
 await self._send_bot_messages(events, tracker, output_channel)
 File "/Users/chris/miniforge3/envs/rasa/lib/python3.8/site-packages/rasa/core/processor.py", line 811, in _send_bot_messages
 await output_channel.send_response(tracker.sender_id, e.message())
 AttributeError: 'NoneType' object has no attribute 'send_response'
 2022-01-21 11:45:03 ERROR rasa.core.training.interactive - An exception occurred while recording messages.
 Traceback (most recent call last):
 File "/Users/chris/miniforge3/envs/rasa/lib/python3.8/site-packages/rasa/core/training/interactive.py", line 1486, in record_messages
 await _plot_trackers(events_including_current_user_id, plot_file, endpoint)
 File "/Users/chris/miniforge3/envs/rasa/lib/python3.8/site-packages/rasa/core/training/interactive.py", line 1422, in _plot_trackers
 event_sequences = await _fetch_events(conversation_ids, endpoint)
 File "/Users/chris/miniforge3/envs/rasa/lib/python3.8/site-packages/rasa/core/training/interactive.py", line 1393, in _fetch_events
 tracker = await retrieve_tracker(endpoint, conversation_id)
 File "/Users/chris/miniforge3/envs/rasa/lib/python3.8/site-packages/rasa/core/training/interactive.py", line 196, in retrieve_tracker
 result = await endpoint.request(
 File "/Users/chris/miniforge3/envs/rasa/lib/python3.8/site-packages/rasa/utils/endpoints.py", line 173, in request
 raise ClientResponseError(

b-quachtran avatar Jan 21 '22 16:01 b-quachtran

Hi everyone, hello @b-quachtran, I have a similar issue. Is there any developent on this? or any workaround that you found?

This issue also happens when using "Talk to your bot" on RASA X. My error message is:

Encountered an exception while running action 'action_session_start'.Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.
Traceback (most recent call last):
  File "/opt/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 869, in _run_action
    events = await action.run(
  File "/opt/venv/lib/python3.8/site-packages/rasa/core/actions/action.py", line 750, in run
    bot_messages: List[Event] = await self._utter_responses(
  File "/opt/venv/lib/python3.8/site-packages/rasa/core/actions/action.py", line 699, in _utter_responses
    generated_response, tracker, output_channel.name(), **response
AttributeError: 'NoneType' object has no attribute 'name'

Using rasa open-source 3.1.0 and rasa x 1.1.0

Thank you in advance, SΓΆren

soerenetler avatar Apr 29 '22 11:04 soerenetler

Is there any update on this? What is exactly the cause of the error? If you help me, I could also try to contribute.

soerenetler avatar May 27 '22 07:05 soerenetler

➀ Maxime Verger commented:

:bulb: Heads up! We're moving issues to Jira: https://rasa-open-source.atlassian.net/browse/OSS.

From now on, this Jira board is the place where you can browse (without an account) and create issues (you'll need a free Jira account for that). This GitHub issue has already been migrated to Jira and will be closed on January 9th, 2023. Do not forget to subscribe to the corresponding Jira issue!

:arrow_right: More information in the forum: https://forum.rasa.com/t/migration-of-rasa-oss-issues-to-jira/56569.

sync-by-unito[bot] avatar Dec 16 '22 10:12 sync-by-unito[bot]