I am working on Rasa project that seta medication reminder. Please create very simple nlu.yml, rules.yml, stories.yml and action.py files to start with. Just enough to test it.
Assistant
Creating a Simple Rasa Project for Medication Reminder
Below are very basic examples of the Rasa files you'd need to start a project aimed at setting medication reminders. Note that these examples are meant to get you started; you'll likely want to expand and customize them further for a full project. Ensure you have Rasa installed and a project initialized where you place these files.
1. nlu.yml
This file is for understanding user intentions (intents) and entities if any.
yaml
version: "3.0"
nlu:
- intent: set_reminder
examples: |
- Remind me to take my medicine
- Set a medication reminder
- I need to be reminded about my pills
- Can you remind me to take my medication?
- intent: greet
examples: |
- Hi
- Hello
- Hey there
- intent: affirm
examples: |
- Yes
- Yup
- Sure
- Okay
2. rules.yml
This file is used for defining rules about how conversations should proceed.
Here we define intents, entities, actions, and templates for responses.
yaml
version: "3.0"
intents:
- greet
- set_reminder
- affirm
- inform
entities:
- time
actions:
- utter_greet
- utter_ask_for_time
- utter_affirm
- action_set_reminder
responses:
utter_greet:
- text: "Hello! How can I help you today?"
utter_ask_for_time:
- text: "When would you like me to remind you?"
utter_affirm:
- text: "Got it. Your reminder is all set!"
5. action.py
This Python file is where custom actions are defined. For simplicity, this example will not actually schedule reminders but will acknowledge the intent to do so.
python
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
class ActionSetReminder(Action):
def name(self) -> Text:
return "action_set_reminder"
def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
dispatcher.utter_message(text="Your reminder has been set.")
return []
Setup and Test
Make sure you have Rasa installed using pip install rasa.
Initialize a new Rasa project by running rasa init and choose No when asked to train an initial model.
Replace the generated nlu.yml, rules.yml, stories.yml, domain.yml, and actions.py (note the difference in naming convention from action.py to actions.py in typical Rasa projects) files with the content provided above.
Train your model with rasa train.
Start the action server in a separate terminal window with rasa run actions.
In another terminal window, start talking to your bot using rasa shell.
This should get you started with a very basic Rasa project for setting medication reminders. As you proceed, you might want to incorporate more advanced features like connecting to a database to store reminders, using custom entities to specify medication names, or integrating with external APIs to notify users when it's time to take their medication.