I am working on Rasa project that seta medication reminder, need help with that.
- User
I am working on Rasa project that seta medication reminder, need help with that.
- Assistant
- User
ok, here is my nlu.yml, please creata rules.yml, stories.yml and actions.py based on that file
- intent: set_medication_reminder
examples: |
- I need to take penicillin at 8 AM tomorrow.
- Can you remind me to take my blood pressure medication at 7 PM?
- Set a pill reminder for ibuprofen at 12 PM today.
- Schedule my vitamins reminder for 9 AM every morning.
- Make sure I do not forget my insulin shot before meals.
- Alert me to take my allergy pill when pollen count is high.
- Remind me twice a day for the antibiotic course I started.
- I have to apply my medicated cream every 4 hours; help me track that.
- Remember my asthma inhaler use before my workouts.
- Keep me on schedule with my cholesterol medications, twice daily.
- intent: set_medication_reminder
examples: |
- Assistant
- User
can you check this code?
- Assistant
Certainly! To provide you with the most accurate feedback, please share the specific code snippet or script you would like reviewed. You can include details regarding what the code is supposed to do, any specific problems you're encountering, or aspects you're unsure about. This will help me offer you more targeted assistance.
- User
from typing import Any, Text, Dict, List from rasa_sdk import Action, Tracker from rasa_sdk.executor import CollectingDispatcher from rasa_sdk.events import SlotSet
class ActionSetMedicationReminder(Action):
def name(self) -> Text: return "action_set_medication_reminder" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: # Extract entities with a simplistic approach - you might need a more nuanced extractor medication_entities = [e['value'] for e in tracker.latest_message['entities'] if e['entity'] == 'medication_name'] time_entities = [e['value'] for e in tracker.latest_message['entities'] if e['entity'] == 'time'] if medication_entities and time_entities: # Assuming the first identified medication and time are what user wants to be reminded of medication_name = medication_entities[0] time = time_entities[0] # Logic to set the reminder goes here. This is an abstraction. dispatcher.utter_message(text=f"Alright, I’ll remind you to take your {medication_name} at {time}.") else: dispatcher.utter_message(text='I am sorry, I could not catch the medication name or time. Can you please specify ?') return [] - Assistant
- User
Lets start from the very beginniing
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.