Hi all, I am Mike, an enthusiastic amateur programmer diving into the exciting world of chatbot development. Although I’m still learning the ropes, I’m eager to explore the capabilities of RASA and enhance my skills in this field.
I am having an issue with a basic testing bot that I am creating as the base for a future virtual assistance chatbot. In this test my intention is to recognise the question and extract the entity by using a custom action. However, the wanted intent is not recognised (classified) at all. Then, if I use the interactive mode, I am able to tell the bot which intent is instead (selecting my intent and connected action), but the entity is not extracted at all.
This is domain.yml:
version: "3.0"
intents:
- ask_maintenance_details
# Add more intents as needed
entities:
- equipment
# Add more entities as needed
slots:
equipment:
type: text
mappings:
- type: from_entity
entity: equipment
responses:
utter_query_maintenance_details:
- text: "You have asked for [equipment]."
actions:
- action_query_maintenance_details
# Define other custom actions if needed
session_config:
session_expiration_time: 60 # Time in minutes before a session expires
carry_over_slots_to_new_session: true # Carry over slots from previous session
This is stories.yml:
version: "3.0"
stories:
- story: User requests maintenance details
steps:
- intent: ask_maintenance_details
- action: action_query_maintenance_details
This is nlu.yml I am using for the training (rasa train
):
version: "3.0"
nlu:
- intent: ask_maintenance_details
examples: |
- Can you provide details of the maintenance performed on [valve V-003/A](equipment)?
- Show me the maintenance details for [pump 200-P-001/A](equipment)
- Can you provide the maintenance history for [valve V-002/B](equipment)?
- Show me the maintenance records for [pump 300-P-003/C](equipment)
(there are many more similar examples in my nlu.yml, around 200…)
This is actions.py:
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
import mysql.connector
class ActionQueryMaintenanceDetails(Action):
def name(self) -> Text:
return "action_query_maintenance_details"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
entity = tracker.get_slot('equipment')
dispatcher.utter_message(text=f"You have asked for {entity}.")
return []
This is endpoint.yml:
action_endpoint:
url: "http://localhost:5055/webhook"
I am using rasa shell
or rasa interactive
and rasa run actions
.
Output from rasa shell
:
Your input -> Show me the maintenance details for pump 201-P-002/A
Your input ->
Your input -> Can you provide the maintenance history for valve V-002/B?
Your input ->
Nothing happens:
Output from rasa interactive
:
Your input -> What maintenance work has been done on heat exchanger H-103?
? Your NLU model classified 'What maintenance work has been done on heat exchanger H-103?' with intent 'nlu_fallbac
k' and there are no entities, is this correct? No
? What intent is it? 0.00 ask_maintenance_details
? Please mark the entities using [value](type) notation What maintenance work has been done on [heat exchanger H-103](equipment)
?
Then, nothing happens, the entity is not extracted:
Current slots:
equipment: None, session_started_metadata: None
This is the output of rasa run actions
:
2024-03-20 09:37:30 INFO rasa_sdk.endpoint - Starting action endpoint server...
2024-03-20 09:37:32 INFO rasa_sdk.executor - Registered function for 'action_query_maintenance_details'.
2024-03-20 09:37:32 INFO rasa_sdk.endpoint - Starting plugins...
2024-03-20 09:37:32 INFO rasa_sdk.endpoint - Action endpoint is up and running on http://0.0.0.0:5055
Certainly I am doing wrong somewhere, but I do not understand. I am following many tutorials and videos, but I am missing something.
Any help will be really appreciated.
Many thanks Mike