Encountered an exception while running action 'action_search_restaurant'. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information

getting this error,

logs in “rasa run actions”:

Exception occurred while handling uri: ‘http://localhost:5055/webhook’ Traceback (most recent call last): File “c:\python3.6\lib\site-packages\sanic\app.py”, line 942, in handle_request response = await response File “c:\python3.6\lib\site-packages\rasa_sdk\endpoint.py”, line 86, in webhook result = await executor.run(action_call) File “c:\python3.6\lib\site-packages\rasa_sdk\executor.py”, line 280, in run events = action(dispatcher, tracker, domain) File “C:\Users\msi1\Desktop\projects\rasa\rasaenv\actions.py”, line 60, in run dispatcher.utter_message(text=message) UnboundLocalError: local variable ‘message’ referenced before assignment

error logs at " rasa shell" Your input -> show me indian res 2020-06-08 00:29:00 ERROR rasa.core.processor - Encountered an exception while running action ‘action_search_restaurant’. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information. Your input ->

i am attaching rasa files please check.

nlu.md (900 Bytes) stories.md (541 Bytes) actions.py (1.8 KB) domain.yml (872 Bytes) endpoints.yml (1.5 KB)

i have even tried for solution for following thread too, but no success:

thanks in advance

Hi @omkarcpatil

It looks like message variable is not declared globally in your actions.py and its been referenced into dispatcher,

I looked into your files.You have forgotten to declare the

entities:
- hotel

in your domain.yml

Try declaring your entities and it will work.

Hello @MuraliChandran14,

thanks for help, but changing this in domain.yml didnt help. the error is same. Your input -> show me indian res 2020-06-08 21:57:56 ERROR rasa.core.processor - Encountered an exception while running action ‘action_search_restaurant’. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information. domain.yml (893 Bytes)

i have attached my domain.yml file rest all files are the same. i searched a few places it says, mostly issue is in actions.py file

am i missing someting now?

Hi @omkarcpatil,

image

remove the space and rewrite your nlu.md

## intent: search_restaurant
- show me [indian](hotel) res
- show me [chinese](hotel) res
- show me [thai](hotel) res
- show me [italian](hotel) res

because of the space the entities are not extracted properly.

Thank you very much @MuraliChandran14,

that solved my issue but could you tell me why are spaces giving issue to entity extraction?

@omkarcpatil

This is my take on why space is a issue to entity extraction.

Rasa uses DIET architecture. In a Pipeline everything is executed step by step.

If It sees a WhitespaceTokenizer results will be coming out as text + tokens. The text and tokens are feed into separate blocks for training.

Entity is a label you are assigning to the particular vocabulary or word in your nlu.md

In DIET architecture the entities are extracted and pushed into CRF.

In your case when you provided space next to [indian]

show me [indian] (hotel) res.

The architecture does not quietly understand what the entity is. That’s why when you trained the model. The entity (hotel) which doesn’t have a value [indian]and was never recognized on the actions.py as well as nlu traning.

@koaning any comments on it.

2 Likes

One comment about DIET. Our standard method for extracting entities is indeed the DIETClassifier but you are also able to select other entities detectors. These can be based on regexes, tools like Duckling, spaCy or a custom tool that you’ve written yourself.

As far as the issue with the “spaces”. This is indeed a tokenizer related issue. This is less of a machine learning thing and more of a “this is the syntax of declaring an entity”-thing. The entities need to be extracted and encoded in a way that a entity detector can recognize them as such. If there is a space in between then the tokenizer will pick them up as two seperate words. This is not related to DIET rather related to how we map an entity to a token.

2 Likes