💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants
Issue: I'm building a weatherbot and while testing the dialogue model using rasa shell / rasa interative , I'm receiving an error ' Key Error : 'location ' in country = current['location']['country'] , when I perform a query like ' Tell me the weather in Paris' . The entity is extracted correctly as Paris(location) and the slot(for location) is also filled . What could be causing this error given that the entity is correctly extracted ?
Error (including full traceback):
Exception occurred while handling uri: 'http://localhost:5055/webhook/'
Traceback (most recent call last):
File "c:\users\91887\anaconda3\envs\myenv\lib\site-packages\sanic\app.py", line 976, in handle_request
response = await response
File "c:\users\91887\anaconda3\envs\myenv\lib\site-packages\rasa_sdk\endpoint.py", line 102, in webhook
result = await executor.run(action_call)
File "c:\users\91887\anaconda3\envs\myenv\lib\site-packages\rasa_sdk\executor.py", line 387, in run
events = action(dispatcher, tracker, domain)
File "D:\Data Mining\Mini Projects\WeatherBot\actions.py", line 15, in run
country = current['location']['country']
KeyError: 'location'
Command or request that led to error:
The action action_weather while running rasa shell/ rasa interactive to get weather updates for a given location ( Tell me the weather in Paris -> action_weather )
Content of configuration file (config.yml) (if relevant):
from rasa_sdk import Action
from rasa_sdk.events import SlotSet
class ActionWeather(Action):
def name(self):
return 'action_weather'
def run(self,dispatcher,tracker,domain):
from apixu.client import ApixuClient
api_key = '*****'
client = ApixuClient(api_key)
loc = tracker.get_slot('location')
current = client.current(q=loc)
country = current['location']['country']
city = current['location']['name']
condition = current['current']['condition']['text']
temperature_c = current['current']['temp_c']
humidity = current['current']['humidity']
wind_mph = current['current']['wind_mph']
response =""" It is currently {} in {} at the moment . The temperature is {} degrees,the humidity is {}% and the wind speed is {} mph.""".format(condition,city,temperature_c,humidity,wind_mph)
dispatcher.utter_message(response)
return [SlotSet('location',loc)]
What could be causing this error ? Please help me . Thanks
Rasa version: 1.10.1
Python version: 3.6
Operating system: Windows
Issue: I'm building a weatherbot and while testing the dialogue model using rasa shell / rasa interative , I'm receiving an error ' Key Error : 'location ' in
country = current['location']['country']
, when I perform a query like ' Tell me the weather in Paris' . The entity is extracted correctly as Paris(location) and the slot(for location) is also filled . What could be causing this error given that the entity is correctly extracted ?Error (including full traceback):
Command or request that led to error:
Content of configuration file (config.yml) (if relevant):
Content of domain file (domain.yml) (if relevant):
Content of stories.md :
Content of actions.py :
What could be causing this error ? Please help me . Thanks