here is my action file there is something wrong in my action file and i don’t know how to resolve it :(…can anyone help me plz…i am working on Rasa stack
from future import absolute_import from future import division from future import unicode_literals
from rasa_core_sdk import Action from rasa_core_sdk.events import SlotSet
class ActionWeather(Action): def name(self): return ‘action_weather’
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
from apixu.client import ApixuClient
api_key = '...' #your apixu key
client = ApixuClient(api_key)
loc = tracker.get_slot('location')
current = client.getcurrent(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)]