I built a small chat bot using rasa. I want my bot to tell a joke by calling an external api but i'm getting None as the response.
I'm attaching the API call method here.
class ApiAction(Action):
def name(self):
return "action_get_jokes"
def run(self, dispatcher, tracker, domain):
r = requests.get('https://api.chucknorris.io/jokes/random')
response = r.text
json_data= json.loads(response)
for k,v in json_data.items():
if k == 'value':
return [SlotSet("jokes_response",v)]
else:
return [SlotSet("jokes_response","404 not found")]
In my domain.yml i have slot for joke response
slots:
jokes_response:
type: unfeaturized
auto_fill: false
utter_jokes:
- text: "Here you go : {jokes_response} "
- text: "There you go: {jokes_response} "
under actions i tried using both main and directly specifying '- action_get_jokes' but none of them worked.
actions:
- action_get_jokes
- __main__.ApiAction