Hi Team,
I am going through the blog “Going beyond ‘Hey Google’: building a Rasa-powered Google Assistant” to connect my rasa bot with google assistant. However facing issues with latest rasa version. Please check below steps which I performed, after that facing one small issue in run-app file.
- trained the nlu and core model separately.
- Changed the imports and model path in run_app file as mentioned below
from rasa_core.interpreter import RasaNLUInterpreter from ga_connector_updated import GoogleConnector from rasa.utils.endpoints import EndpointConfig
action_endpoint = EndpointConfig(url=“http://localhost:5055/webhook”) nlu_interpreter = RasaNLUInterpreter(’./models/nlu’) agent = Agent.load(’./models/core’, interpreter = nlu_interpreter, action_endpoint=action_endpoint)
input_channel = GoogleConnector()
agent.handle_channels([input_channel], 5004)
-
used the ga_connector_updated file for google connector
-
Ran the run-app file successfully .
-
ran this command >python -m rasa_core_sdk.endpoint --actions actions
-
Exposed the port 5004 using ngrok and updated URL in action.json.
-
When I ran this command with project Id - gactions update --action_package action.json --project sample-bot-b3759
-
After running test command , gactions test --action_package action.json --project sample-bot-b3759
-
On google console , when I started testing it says, place finder dosent exist and can see below logs in console
Exception occurred while handling uri: ‘http://5040971a.ngrok.io/webhooks/google_home/webhook’ Traceback (most recent call last): File “C:\Ana\lib\site-packages\sanic\app.py”, line 917, in handle_request response = await response File “C:\RASA\SampleBot\Demo\tutorial-rasa-google-assistant-master\tutorial-rasa-google-assistant-master\place_finder\ga_connector.py”, line 118, in receive sender_id = payload[‘user’][‘userId’] KeyError: ‘userId’
When I removed userId key in connector class,getting below exception
C:\Ana\lib\site-packages\rasa_core_init_.py:12: UserWarning: The ‘rasa_core’ package has been renamed. You should change your imports to use ‘rasa.core’ instead. UserWarning, Exception occurred in one of response middleware handlers Traceback (most recent call last): File “C:\Ana\lib\site-packages\sanic\app.py”, line 958, in handle_request request, response File “C:\Ana\lib\site-packages\spf\framework.py”, line 543, in _run_response_middleware _response = await _response File “C:\Ana\lib\site-packages\sanic_cors\extension.py”, line 266, in unapplied_cors_response_middleware set_cors_headers(req, resp, context, res_options) File “C:\Ana\lib\site-packages\sanic_cors\core.py”, line 248, in set_cors_headers if resp.headers is None: AttributeError: ‘str’ object has no attribute ‘headers’ Invalid response object for url b’/webhooks/google_home/webhook’, Expected Type: HTTPResponse, Actual Type: <class ‘str’> Exception occurred while handling uri: ‘http://###.ngrok.io/webhooks/google_home/webhook’ Traceback (most recent call last): File “C:\Ana\lib\site-packages\sanic\server.py”, line 417, in write_response response.output( AttributeError: ‘str’ object has no attribute ‘output’
Root cause - In request json there is no user Id , when we test through simulator
{‘user’: ‘locale’: ‘en-US’, ‘lastSeen’: ‘2019-07-08T12:37:40Z’, ‘userVerificationStatus’: ‘VERIFIED’}