Created
October 6, 2023 08:58
-
-
Save cgawron/1a24e64d23a4bec33585d7389613ba0a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rasa_sdk import Action | |
from rasa_sdk.events import SlotSet | |
import requests | |
class ActionTellJoke(Action): | |
def name(self) -> Text: | |
return "action_tell_joke" | |
def run(self, dispatcher: CollectingDispatcher, | |
tracker: Tracker, | |
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: | |
response = requests.get('https://witzapi.de/api/joke/') | |
joke = response.json() | |
joketext = joke[0]['text'] | |
dispatcher.utter_message(text=joketext) | |
return [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment